Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
projectdiscovery
GitHub Repository: projectdiscovery/nuclei
Path: blob/dev/pkg/tmplexec/flow/util.go
2070 views
1
package flow
2
3
import "github.com/projectdiscovery/nuclei/v3/pkg/operators"
4
5
// Checks if template has matchers
6
func hasMatchers(all []*operators.Operators) bool {
7
for _, operator := range all {
8
if len(operator.Matchers) > 0 {
9
return true
10
}
11
}
12
return false
13
}
14
15
// hasOperators checks if template has operators (i.e matchers/extractors)
16
func hasOperators(all []*operators.Operators) bool {
17
for _, operator := range all {
18
if operator != nil {
19
return true
20
}
21
}
22
return false
23
}
24
25
func flatten(v interface{}) interface{} {
26
switch v := v.(type) {
27
case []interface{}:
28
if len(v) == 1 {
29
return v[0]
30
}
31
return v
32
case []string:
33
if len(v) == 1 {
34
return v[0]
35
}
36
return v
37
default:
38
return v
39
}
40
}
41
42