mirror of https://github.com/daffainfo/nuclei.git
Merge pull request #1488 from projectdiscovery/issue-1459-new-templates-loader
Excluding non yaml file from new additions loadingdev
commit
a4c3a5c106
|
@ -38,6 +38,7 @@ import (
|
||||||
"github.com/projectdiscovery/nuclei/v2/pkg/utils"
|
"github.com/projectdiscovery/nuclei/v2/pkg/utils"
|
||||||
"github.com/projectdiscovery/nuclei/v2/pkg/utils/stats"
|
"github.com/projectdiscovery/nuclei/v2/pkg/utils/stats"
|
||||||
yamlwrapper "github.com/projectdiscovery/nuclei/v2/pkg/utils/yaml"
|
yamlwrapper "github.com/projectdiscovery/nuclei/v2/pkg/utils/yaml"
|
||||||
|
"github.com/projectdiscovery/stringsutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Runner is a client for running the enumeration process.
|
// Runner is a client for running the enumeration process.
|
||||||
|
@ -452,8 +453,10 @@ func (r *Runner) readNewTemplatesFile() ([]string, error) {
|
||||||
if text == "" {
|
if text == "" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if isNewTemplate(text) {
|
||||||
templatesList = append(templatesList, text)
|
templatesList = append(templatesList, text)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return templatesList, nil
|
return templatesList, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -476,11 +479,19 @@ func (r *Runner) countNewTemplates() int {
|
||||||
if text == "" {
|
if text == "" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if isNewTemplate(text) {
|
||||||
count++
|
count++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
return count
|
return count
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isNewTemplate(filename string) bool {
|
||||||
|
return stringsutil.EqualFoldAny(filepath.Ext(filename), templates.TemplateExtension)
|
||||||
|
}
|
||||||
|
|
||||||
// SaveResumeConfig to file
|
// SaveResumeConfig to file
|
||||||
func (r *Runner) SaveResumeConfig() error {
|
func (r *Runner) SaveResumeConfig() error {
|
||||||
resumeCfg := types.NewResumeCfg()
|
resumeCfg := types.NewResumeCfg()
|
||||||
|
|
|
@ -21,6 +21,11 @@ import (
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// TemplateExtension defines the template default file extension
|
||||||
|
TemplateExtension = ".yaml"
|
||||||
|
)
|
||||||
|
|
||||||
// Template is a YAML input file which defines all the requests and
|
// Template is a YAML input file which defines all the requests and
|
||||||
// other metadata for a template.
|
// other metadata for a template.
|
||||||
type Template struct {
|
type Template struct {
|
||||||
|
|
Loading…
Reference in New Issue