Skip to content

Commit

Permalink
Allow comments with # in nuclei-ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
Ice3man543 committed Oct 2, 2020
1 parent 3519673 commit f26d518
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions v2/internal/runner/config.go
Expand Up @@ -35,46 +35,38 @@ func (r *Runner) readConfiguration() (*nucleiConfig, error) {

templatesConfigFile := path.Join(home, nucleiConfigFilename)
file, err := os.Open(templatesConfigFile)

if err != nil {
return nil, err
}

defer file.Close()

config := &nucleiConfig{}
err = jsoniter.NewDecoder(file).Decode(config)

if err != nil {
return nil, err
}

return config, nil
}

// readConfiguration reads the nuclei configuration file from disk.
func (r *Runner) writeConfiguration(config *nucleiConfig) error {
home, err := os.UserHomeDir()

if err != nil {
return err
}

config.LastChecked = time.Now()
templatesConfigFile := path.Join(home, nucleiConfigFilename)
file, err := os.OpenFile(templatesConfigFile, os.O_WRONLY|os.O_CREATE, 0777)

if err != nil {
return err
}

defer file.Close()

err = jsoniter.NewEncoder(file).Encode(config)
if err != nil {
return err
}

return nil
}

Expand All @@ -94,7 +86,9 @@ func (r *Runner) readNucleiIgnoreFile() {
if text == "" {
continue
}

if strings.HasPrefix(text, "#") {
continue
}
r.templatesConfig.IgnorePaths = append(r.templatesConfig.IgnorePaths, text)
}
}
Expand Down

0 comments on commit f26d518

Please sign in to comment.