From b83de5fb88e5db5d0fb87c3da5120e1301e6a171 Mon Sep 17 00:00:00 2001 From: Ice3man543 Date: Fri, 27 Aug 2021 23:23:01 +0530 Subject: [PATCH] Fixed internal config reading crashes --- v2/internal/runner/runner.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/v2/internal/runner/runner.go b/v2/internal/runner/runner.go index c0588fa8..d8514407 100644 --- a/v2/internal/runner/runner.go +++ b/v2/internal/runner/runner.go @@ -379,8 +379,9 @@ func (r *Runner) RunEnumeration() error { messageStr = builder.String() builder.Reset() - gologger.Info().Msgf("Using Nuclei Templates %s%s", r.templatesConfig.CurrentVersion, messageStr) - + if r.templatesConfig != nil { + gologger.Info().Msgf("Using Nuclei Templates %s%s", r.templatesConfig.CurrentVersion, messageStr) + } if r.interactsh != nil { gologger.Info().Msgf("Using Interactsh Server %s", r.options.InteractshURL) } @@ -513,6 +514,9 @@ func (r *Runner) RunEnumeration() error { // readNewTemplatesFile reads newly added templates from directory if it exists func (r *Runner) readNewTemplatesFile() ([]string, error) { + if r.templatesConfig == nil { + return nil, nil + } additionsFile := filepath.Join(r.templatesConfig.TemplatesDirectory, ".new-additions") file, err := os.Open(additionsFile) if err != nil { @@ -534,6 +538,9 @@ func (r *Runner) readNewTemplatesFile() ([]string, error) { // readNewTemplatesFile reads newly added templates from directory if it exists func (r *Runner) countNewTemplates() int { + if r.templatesConfig == nil { + return 0 + } additionsFile := filepath.Join(r.templatesConfig.TemplatesDirectory, ".new-additions") file, err := os.Open(additionsFile) if err != nil {