mirror of https://github.com/daffainfo/nuclei.git
Fixed file protocol bugs
parent
1cfc5ce6ef
commit
2717a8b647
|
@ -66,20 +66,20 @@ func (r *Request) Compile(options *protocols.ExecuterOptions) error {
|
||||||
if extension == "all" {
|
if extension == "all" {
|
||||||
r.allExtensions = true
|
r.allExtensions = true
|
||||||
} else {
|
} else {
|
||||||
if strings.HasPrefix(extension, ".") {
|
if !strings.HasPrefix(extension, ".") {
|
||||||
extension = "." + extension
|
extension = "." + extension
|
||||||
}
|
}
|
||||||
r.extensions[extension] = struct{}{}
|
r.extensions[extension] = struct{}{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, extension := range defaultDenylist {
|
for _, extension := range defaultDenylist {
|
||||||
if strings.HasPrefix(extension, ".") {
|
if !strings.HasPrefix(extension, ".") {
|
||||||
extension = "." + extension
|
extension = "." + extension
|
||||||
}
|
}
|
||||||
r.extensionDenylist[extension] = struct{}{}
|
r.extensionDenylist[extension] = struct{}{}
|
||||||
}
|
}
|
||||||
for _, extension := range r.ExtensionDenylist {
|
for _, extension := range r.ExtensionDenylist {
|
||||||
if strings.HasPrefix(extension, ".") {
|
if !strings.HasPrefix(extension, ".") {
|
||||||
extension = "." + extension
|
extension = "." + extension
|
||||||
}
|
}
|
||||||
r.extensionDenylist[extension] = struct{}{}
|
r.extensionDenylist[extension] = struct{}{}
|
||||||
|
|
|
@ -16,7 +16,7 @@ func TestFileCompile(t *testing.T) {
|
||||||
ID: templateID,
|
ID: templateID,
|
||||||
MaxSize: 1024,
|
MaxSize: 1024,
|
||||||
NoRecursive: false,
|
NoRecursive: false,
|
||||||
Extensions: []string{"*", ".lock"},
|
Extensions: []string{"all", ".lock"},
|
||||||
ExtensionDenylist: []string{".go"},
|
ExtensionDenylist: []string{".go"},
|
||||||
}
|
}
|
||||||
executerOpts := testutils.NewMockExecuterOptions(options, &testutils.TemplateInfo{
|
executerOpts := testutils.NewMockExecuterOptions(options, &testutils.TemplateInfo{
|
||||||
|
|
|
@ -19,7 +19,7 @@ func TestFindInputPaths(t *testing.T) {
|
||||||
ID: templateID,
|
ID: templateID,
|
||||||
MaxSize: 1024,
|
MaxSize: 1024,
|
||||||
NoRecursive: false,
|
NoRecursive: false,
|
||||||
Extensions: []string{"*", ".lock"},
|
Extensions: []string{"all", ".lock"},
|
||||||
ExtensionDenylist: []string{".go"},
|
ExtensionDenylist: []string{".go"},
|
||||||
}
|
}
|
||||||
executerOpts := testutils.NewMockExecuterOptions(options, &testutils.TemplateInfo{
|
executerOpts := testutils.NewMockExecuterOptions(options, &testutils.TemplateInfo{
|
||||||
|
|
|
@ -23,7 +23,7 @@ func TestFileExecuteWithResults(t *testing.T) {
|
||||||
ID: templateID,
|
ID: templateID,
|
||||||
MaxSize: 1024,
|
MaxSize: 1024,
|
||||||
NoRecursive: false,
|
NoRecursive: false,
|
||||||
Extensions: []string{"*"},
|
Extensions: []string{"all"},
|
||||||
ExtensionDenylist: []string{".go"},
|
ExtensionDenylist: []string{".go"},
|
||||||
Operators: operators.Operators{
|
Operators: operators.Operators{
|
||||||
Matchers: []*matchers.Matcher{{
|
Matchers: []*matchers.Matcher{{
|
||||||
|
|
Loading…
Reference in New Issue