nuclei/pkg/catalog/config/ignorefile.go
nu11z ca543d7885
Remove the stack trace when the nuclei-ignore file does not exist (#6455)
* remove the stack trace when the nuclei-ignore file does not exist

* removing useless debug stack

---------

Co-authored-by: Mzack9999 <mzack9999@protonmail.com>
2025-09-12 23:36:36 +05:30

34 lines
786 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 func() {
_ = 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
}