mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-29 22:23:02 +00:00
* adds template manager * refactor: checkpoint * centrailized config & template download logic * refactor removed unused code * use global template directory * update related bug fixes * bug fix create cfg dir if missing * fix lint error * bug fix skip writing template dir in callback * misc update * remove unused code * use strings.equalfold for comparison --------- Co-authored-by: sandeep <8293321+ehsandeep@users.noreply.github.com>
32 lines
766 B
Go
32 lines
766 B
Go
package config
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/projectdiscovery/gologger"
|
|
"gopkg.in/yaml.v2"
|
|
)
|
|
|
|
// IgnoreFile is an internal nuclei template blocking configuration file
|
|
type IgnoreFile struct {
|
|
Tags []string `yaml:"tags"`
|
|
Files []string `yaml:"files"`
|
|
}
|
|
|
|
// ReadIgnoreFile reads the nuclei ignore file returning blocked tags and paths
|
|
func ReadIgnoreFile() IgnoreFile {
|
|
file, err := os.Open(DefaultConfig.GetIgnoreFilePath())
|
|
if err != nil {
|
|
gologger.Error().Msgf("Could not read nuclei-ignore file: %s\n", err)
|
|
return IgnoreFile{}
|
|
}
|
|
defer file.Close()
|
|
|
|
ignore := IgnoreFile{}
|
|
if err := yaml.NewDecoder(file).Decode(&ignore); err != nil {
|
|
gologger.Error().Msgf("Could not parse nuclei-ignore file: %s\n", err)
|
|
return IgnoreFile{}
|
|
}
|
|
return ignore
|
|
}
|