2023-08-31 18:03:01 +05:30
|
|
|
package flow
|
|
|
|
|
|
2023-10-17 17:44:13 +05:30
|
|
|
import "github.com/projectdiscovery/nuclei/v3/pkg/operators"
|
2023-08-31 18:03:01 +05:30
|
|
|
|
|
|
|
|
// Checks if template has matchers
|
|
|
|
|
func hasMatchers(all []*operators.Operators) bool {
|
|
|
|
|
for _, operator := range all {
|
|
|
|
|
if len(operator.Matchers) > 0 {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// hasOperators checks if template has operators (i.e matchers/extractors)
|
|
|
|
|
func hasOperators(all []*operators.Operators) bool {
|
|
|
|
|
for _, operator := range all {
|
|
|
|
|
if operator != nil {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false
|
|
|
|
|
}
|
2024-01-29 05:20:01 +05:30
|
|
|
|
|
|
|
|
func flatten(v interface{}) interface{} {
|
|
|
|
|
switch v := v.(type) {
|
|
|
|
|
case []interface{}:
|
|
|
|
|
if len(v) == 1 {
|
|
|
|
|
return v[0]
|
|
|
|
|
}
|
|
|
|
|
return v
|
|
|
|
|
case []string:
|
|
|
|
|
if len(v) == 1 {
|
|
|
|
|
return v[0]
|
|
|
|
|
}
|
|
|
|
|
return v
|
|
|
|
|
default:
|
|
|
|
|
return v
|
|
|
|
|
}
|
|
|
|
|
}
|