mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-17 22:45:28 +00:00
* use parsed options while signing * update project layout to v3 * fix .gitignore * remove example template * misc updates * bump tlsx version * hide template sig warning with env * js: retain value while using log * fix nil pointer derefernce * misc doc update --------- Co-authored-by: sandeep <8293321+ehsandeep@users.noreply.github.com>
42 lines
919 B
Go
42 lines
919 B
Go
package http
|
|
|
|
import (
|
|
"regexp"
|
|
)
|
|
|
|
var (
|
|
// Determines if request condition are needed by detecting the pattern _xxx
|
|
reRequestCondition = regexp.MustCompile(`(?m)_\d+`)
|
|
)
|
|
|
|
// NeedsRequestCondition determines if request condition should be enabled
|
|
func (request *Request) NeedsRequestCondition() bool {
|
|
for _, matcher := range request.Matchers {
|
|
if checkRequestConditionExpressions(matcher.DSL...) {
|
|
return true
|
|
}
|
|
if checkRequestConditionExpressions(matcher.Part) {
|
|
return true
|
|
}
|
|
}
|
|
for _, extractor := range request.Extractors {
|
|
if checkRequestConditionExpressions(extractor.DSL...) {
|
|
return true
|
|
}
|
|
if checkRequestConditionExpressions(extractor.Part) {
|
|
return true
|
|
}
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
func checkRequestConditionExpressions(expressions ...string) bool {
|
|
for _, expression := range expressions {
|
|
if reRequestCondition.MatchString(expression) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|