mirror of https://github.com/daffainfo/nuclei.git
Merge branch 'dev' of https://github.com/projectdiscovery/nuclei into dev
commit
3052d8a7f6
|
@ -7,7 +7,6 @@ import (
|
|||
|
||||
"gopkg.in/yaml.v2"
|
||||
|
||||
"github.com/projectdiscovery/gologger"
|
||||
"github.com/projectdiscovery/nuclei/v2/pkg/catalog/loader/filter"
|
||||
"github.com/projectdiscovery/nuclei/v2/pkg/model"
|
||||
"github.com/projectdiscovery/nuclei/v2/pkg/templates"
|
||||
|
@ -104,7 +103,6 @@ var (
|
|||
parsedTemplatesCache *cache.Templates
|
||||
ShouldValidate bool
|
||||
NoStrictSyntax bool
|
||||
fieldErrorRegexp = regexp.MustCompile(`not found in`)
|
||||
templateIDRegexp = regexp.MustCompile(`^([a-zA-Z0-9]+[-_])*[a-zA-Z0-9]+$`)
|
||||
)
|
||||
|
||||
|
@ -140,17 +138,8 @@ func ParseTemplate(templatePath string) (*templates.Template, error) {
|
|||
err = yaml.UnmarshalStrict(data, template)
|
||||
}
|
||||
if err != nil {
|
||||
errString := err.Error()
|
||||
if !fieldErrorRegexp.MatchString(errString) {
|
||||
stats.Increment(SyntaxErrorStats)
|
||||
return nil, err
|
||||
}
|
||||
stats.Increment(SyntaxWarningStats)
|
||||
if ShouldValidate {
|
||||
gologger.Error().Msgf("Syntax warnings for template %s: %s", templatePath, err)
|
||||
} else {
|
||||
gologger.Warning().Msgf("Syntax warnings for template %s: %s", templatePath, err)
|
||||
}
|
||||
stats.Increment(SyntaxErrorStats)
|
||||
return nil, err
|
||||
}
|
||||
parsedTemplatesCache.Store(templatePath, template, nil)
|
||||
return template, nil
|
||||
|
|
Loading…
Reference in New Issue