Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
projectdiscovery
GitHub Repository: projectdiscovery/nuclei
Path: blob/dev/pkg/catalog/config/ignorefile.go
2861 views
1
package config
2
3
import (
4
"os"
5
6
"github.com/projectdiscovery/gologger"
7
"gopkg.in/yaml.v2"
8
)
9
10
// IgnoreFile is an internal nuclei template blocking configuration file
11
type IgnoreFile struct {
12
Tags []string `yaml:"tags"`
13
Files []string `yaml:"files"`
14
}
15
16
// ReadIgnoreFile reads the nuclei ignore file returning blocked tags and paths
17
func ReadIgnoreFile() IgnoreFile {
18
file, err := os.Open(DefaultConfig.GetIgnoreFilePath())
19
if err != nil {
20
gologger.Error().Msgf("Could not read nuclei-ignore file: %s\n", err)
21
return IgnoreFile{}
22
}
23
defer func() {
24
_ = file.Close()
25
}()
26
27
ignore := IgnoreFile{}
28
if err := yaml.NewDecoder(file).Decode(&ignore); err != nil {
29
gologger.Error().Msgf("Could not parse nuclei-ignore file: %s\n", err)
30
return IgnoreFile{}
31
}
32
return ignore
33
}
34
35