@@ -3,17 +3,23 @@ package tgen
33import (
44 _ "github.com/OWASP/OFFAT/src/pkg/logging"
55 "github.com/OWASP/OFFAT/src/pkg/parser"
6+ "github.com/OWASP/OFFAT/src/pkg/utils"
67 "github.com/rs/zerolog/log"
78)
89
910type TGenHandler struct {
10- RunUnrestrictedHttpMethodTest bool
11- RunSimpleSQLiTest bool
12-
1311 Doc []* parser.DocHttpParams
1412 DefaultQueryParams map [string ]string
1513 DefaultHeaders map [string ]string
1614 BaseUrl string
15+
16+ // Register all tests using bool values below
17+ RunUnrestrictedHttpMethodTest bool
18+ RunBasicSQLiTest bool
19+ RunBasicSSRFTest bool
20+
21+ // SSRF Test related data
22+ SsrfUrl string
1723}
1824
1925func (t * TGenHandler ) GenerateTests () []* ApiTest {
@@ -25,18 +31,33 @@ func (t *TGenHandler) GenerateTests() []*ApiTest {
2531 log .Info ().Msgf ("%d tests generated for Unrestricted HTTP Methods/Verbs" , len (newTests ))
2632 }
2733
28- if t .RunSimpleSQLiTest {
34+ // Basic SQLI Test
35+ if t .RunBasicSQLiTest {
36+ injectionConfig := InjectionConfig {
37+ InBody : true ,
38+ InCookie : true ,
39+ InHeader : true ,
40+ InPath : true ,
41+ InQuery : true ,
42+ }
43+ newTests := BasicSqliTest (t .BaseUrl , t .Doc , t .DefaultQueryParams , t .DefaultHeaders , injectionConfig )
44+ tests = append (tests , newTests ... )
45+
46+ log .Info ().Msgf ("%d tests generated for Basic SQLI" , len (newTests ))
47+ }
48+
49+ if t .RunBasicSSRFTest && utils .ValidateURL (t .SsrfUrl ) {
2950 injectionConfig := InjectionConfig {
3051 InBody : true ,
3152 InCookie : true ,
32- InHeader : false ,
53+ InHeader : true ,
3354 InPath : true ,
3455 InQuery : true ,
3556 }
36- newTests := SimpleSQLiTest ( t .BaseUrl , t .Doc , t .DefaultQueryParams , t .DefaultHeaders , injectionConfig )
57+ newTests := BasicSsrfTest ( t . SsrfUrl , t .BaseUrl , t .Doc , t .DefaultQueryParams , t .DefaultHeaders , injectionConfig )
3758 tests = append (tests , newTests ... )
3859
39- log .Info ().Msgf ("%d tests generated for Simple SQLI " , len (newTests ))
60+ log .Info ().Msgf ("%d tests generated for Basic SSRF " , len (newTests ))
4061 }
4162
4263 return tests
0 commit comments