mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-17 18:35:25 +00:00
If debug is enabled, show matchers that are not named also #1084
This commit is contained in:
parent
404f8ebb27
commit
ed3b80b5d7
@ -1,6 +1,8 @@
|
||||
package operators
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/projectdiscovery/nuclei/v2/pkg/operators/extractors"
|
||||
@ -136,14 +138,10 @@ func (operators *Operators) Execute(data map[string]interface{}, match MatchFunc
|
||||
}
|
||||
}
|
||||
|
||||
for _, matcher := range operators.Matchers {
|
||||
// Check if the matcher matched
|
||||
for matcherIndex, matcher := range operators.Matchers {
|
||||
if isMatch, matched := match(data, matcher); isMatch {
|
||||
// If the matcher has matched, and it's an OR
|
||||
// write the first output then move to next matcher.
|
||||
if matcherCondition == matchers.ORCondition && matcher.Name != "" {
|
||||
result.Matches[matcher.Name] = matched
|
||||
}
|
||||
matcherName := getMatcherName(matcher, matcherIndex)
|
||||
result.Matches[matcherName] = matched
|
||||
|
||||
matches = true
|
||||
} else if matcherCondition == matchers.ANDCondition {
|
||||
@ -172,6 +170,14 @@ func (operators *Operators) Execute(data map[string]interface{}, match MatchFunc
|
||||
return nil, false
|
||||
}
|
||||
|
||||
func getMatcherName(matcher *matchers.Matcher, matcherIndex int) string {
|
||||
if matcher.Name != "" {
|
||||
return matcher.Name
|
||||
} else {
|
||||
return matcher.Type + "-" + strconv.Itoa(matcherIndex)
|
||||
}
|
||||
}
|
||||
|
||||
// ExecuteInternalExtractors executes internal dynamic extractors
|
||||
func (operators *Operators) ExecuteInternalExtractors(data map[string]interface{}, extract ExtractFunc) map[string]interface{} {
|
||||
dynamicValues := make(map[string]interface{})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user