@@ -2,33 +2,44 @@ package inspector
22
33type InspectorName string
44
5- var (
6- RegexInspectorName InspectorName = "RegexInspector "
7- MatchListInspectorName InspectorName = "MatchListInspector "
8- LibInjectionSQLIInspectorName InspectorName = "LibInjectionSQLIInspector "
9- LibInjectionXSSInspectorName InspectorName = "LibInjectionXSSInspector "
10- SQLiInspectorName InspectorName = "SQLiInspector "
11- LFIInspectorName InspectorName = "LFIInspector "
12- SSRFInspectorName InspectorName = "SSRFInspector "
13- AccountTakeoverInspectorName InspectorName = "AccountTakeoverInspector "
5+ const (
6+ RegexInspectorName InspectorName = "regex "
7+ MatchListInspectorName InspectorName = "match_list "
8+ LibInjectionSQLIInspectorName InspectorName = "libinjection_sqli "
9+ LibInjectionXSSInspectorName InspectorName = "libinjection_xss "
10+ SQLiInspectorName InspectorName = "sqli "
11+ LFIInspectorName InspectorName = "lfi "
12+ SSRFInspectorName InspectorName = "ssrf "
13+ AccountTakeoverInspectorName InspectorName = "account_takeover "
1414)
1515
16- func NewInspector () map [string ]Inspector {
17- return map [string ]Inspector {
18- string ( "regex" ): NewRegexInspector (),
19- string ( "match_list" ) : NewMatchListInspector (),
20- string ( "libinjection_sqli" ) : NewLibInjectionSQLIInspector (),
21- string ( "libinjection_xss" ) : NewLibInjectionXSSInspector (),
22- string ( "sqli" ): NewSQLiInspector (),
23- string ( "lfi" ): NewLFIInspector (),
24- string ( "ssrf" ): NewSSRFInspector (),
25- string ( "account_takeover" ) : NewAccountTakeoverInspector (),
16+ func NewInspectors () map [InspectorName ]Inspector {
17+ return map [InspectorName ]Inspector {
18+ RegexInspectorName : NewRegexInspector (),
19+ MatchListInspectorName : NewMatchListInspector (),
20+ LibInjectionSQLIInspectorName : NewLibInjectionSQLIInspector (),
21+ LibInjectionXSSInspectorName : NewLibInjectionXSSInspector (),
22+ SQLiInspectorName : NewSQLiInspector (),
23+ LFIInspectorName : NewLFIInspector (),
24+ SSRFInspectorName : NewSSRFInspector (),
25+ AccountTakeoverInspectorName : NewAccountTakeoverInspector (),
2626 }
2727}
2828
29+ type InspectorArgs struct {
30+ TargetOptions []InspectTargetOptions
31+
32+ RegexInspectorArgs RegexInspectorArgs
33+ MatchListInspectorArgs MatchListInspectorArgs
34+ AccountTakeoverInspectorArgs AccountTakeoverInspectorArgs
35+ }
36+
37+ type InspectTargetOptions struct {
38+ Target InspectTarget
39+ Params []string
40+ }
41+
2942type Inspector interface {
30- // Name returns the name of the inspector
31- Name () InspectorName
3243 // Inspect inspects the given data
3344 // Returns SuspiciousResult if the inspected data is determined to be an attack, otherwise returns nil
3445 // If an error occurs during inspection, returns an error
@@ -37,15 +48,6 @@ type Inspector interface {
3748 IsSupportTarget (target InspectTarget ) bool
3849}
3950
40- type InspectorArgs interface {
41- IsArgOf () string
42- }
43-
44- type InspectTargetOptions struct {
45- Target InspectTarget
46- Params []string
47- }
48-
4951// InspectResult represents the result of an inspection
5052type InspectResult struct {
5153 Target InspectTarget // the target that was inspected
0 commit comments