mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-18 05:25:25 +00:00
fixing and condition
This commit is contained in:
parent
caedc8afaf
commit
a4ef3ea3a9
@ -89,3 +89,9 @@ func (matcher *Matcher) CompileMatchers() error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetType returns the condition type of the matcher
|
||||
// todo: the field should be exposed natively
|
||||
func (matcher *Matcher) GetCondition() ConditionType {
|
||||
return matcher.condition
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ type Matcher struct {
|
||||
MatchAll bool `yaml:"match-all,omitempty" json:"match-all,omitempty" jsonschema:"title=match all values,description=match all matcher values ignoring condition"`
|
||||
|
||||
// cached data for the compiled matcher
|
||||
condition ConditionType
|
||||
condition ConditionType // todo: this field should be the one used for overridden marshal ops
|
||||
matcherType MatcherType
|
||||
binaryDecoded []string
|
||||
regexCompiled []*regexp.Regexp
|
||||
|
||||
@ -200,9 +200,22 @@ func (request *Request) findMatchesWithReader(reader io.Reader, input, filePath
|
||||
isResponseDebug := request.options.Options.Debug || request.options.Options.DebugResponse
|
||||
totalBytesString := units.BytesSize(float64(totalBytes))
|
||||
|
||||
// we are forced to check if the whole file needs to be elaborated
|
||||
// - matchers-condition option set to AND
|
||||
hasAndCondition := request.CompiledOperators.GetMatchersCondition() == matchers.ANDCondition
|
||||
// - any matcher has AND condition
|
||||
for _, matcher := range request.CompiledOperators.Matchers {
|
||||
if hasAndCondition {
|
||||
break
|
||||
}
|
||||
if matcher.GetCondition() == matchers.ANDCondition {
|
||||
hasAndCondition = true
|
||||
}
|
||||
}
|
||||
|
||||
scanner := bufio.NewScanner(reader)
|
||||
buffer := []byte{}
|
||||
if request.CompiledOperators.GetMatchersCondition() == matchers.ANDCondition {
|
||||
if hasAndCondition {
|
||||
scanner.Buffer(buffer, int(defaultMaxReadSize))
|
||||
scanner.Split(func(data []byte, atEOF bool) (advance int, token []byte, err error) {
|
||||
defaultMaxReadSizeInt := int(defaultMaxReadSize)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user