Merge pull request #132 from projectdiscovery/dsl-fix

DSL Fix
dev
Mzack9999 2020-07-06 20:51:45 +02:00 committed by GitHub
commit 606c46ba29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 13 deletions

View File

@ -20,8 +20,8 @@ jobs:
- name: Test
run: go test .
working-directory: cmd/nuclei/
working-directory: v2/cmd/nuclei/
- name: Build
run: go build .
working-directory: cmd/nuclei/
working-directory: v2/cmd/nuclei/

View File

@ -17,7 +17,6 @@ import (
"github.com/pkg/errors"
"github.com/projectdiscovery/gologger"
"github.com/projectdiscovery/nuclei/v2/pkg/extractors"
"github.com/projectdiscovery/nuclei/v2/pkg/matchers"
"github.com/projectdiscovery/nuclei/v2/pkg/requests"
"github.com/projectdiscovery/nuclei/v2/pkg/templates"
@ -156,12 +155,7 @@ mainLoop:
var headers string
matcherCondition := e.httpRequest.GetMatchersCondition()
for _, matcher := range e.httpRequest.Matchers {
// Only build the headers string if the matcher asks for it
part := matcher.GetPart()
if part == matchers.AllPart || part == matchers.HeaderPart && headers == "" {
headers = headersToString(resp.Header)
}
// Check if the matcher matched
if !matcher.Match(resp, body, headers) {
// If the condition is AND we haven't matched, try next request.
@ -182,10 +176,7 @@ mainLoop:
// next task which is extraction of input from matchers.
var extractorResults []string
for _, extractor := range e.httpRequest.Extractors {
part := extractor.GetPart()
if part == extractors.AllPart || part == extractors.HeaderPart && headers == "" {
headers = headersToString(resp.Header)
}
for match := range extractor.Extract(body, headers) {
extractorResults = append(extractorResults, match)
}