| skipped 4 lines |
5 | 5 | | "net/http" |
6 | 6 | | "net/url" |
7 | 7 | | "strings" |
| 8 | + | "time" |
8 | 9 | | |
9 | 10 | | "github.com/google/cel-go/checker/decls" |
10 | 11 | | "github.com/zan8in/afrog/pkg/config" |
| skipped 64 lines |
75 | 76 | | k := ruleMap.Key |
76 | 77 | | rule := ruleMap.Value |
77 | 78 | | |
| 79 | + | if rule.BeforeSleep != 0 { |
| 80 | + | time.Sleep(time.Duration(rule.BeforeSleep) * time.Second) |
| 81 | + | } |
78 | 82 | | utils.RandSleep(500) |
79 | 83 | | |
80 | 84 | | isMatch := false |
| skipped 13 lines |
94 | 98 | | c.UpdateVariableMap(rule.Output) |
95 | 99 | | } |
96 | 100 | | |
97 | | - | c.Result.AllPocResult = append(c.Result.AllPocResult, |
98 | | - | &PocResult{IsVul: isMatch, ResultRequest: c.VariableMap["request"].(*proto.Request), ResultResponse: c.VariableMap["response"].(*proto.Response)}) |
| 101 | + | pocRstTemp := PocResult{IsVul: isMatch} |
| 102 | + | if c.VariableMap["response"] != nil { |
| 103 | + | pocRstTemp.ResultResponse = c.VariableMap["response"].(*proto.Response) |
| 104 | + | } |
| 105 | + | if c.VariableMap["request"] != nil { |
| 106 | + | pocRstTemp.ResultRequest = c.VariableMap["request"].(*proto.Request) |
| 107 | + | } |
| 108 | + | c.Result.AllPocResult = append(c.Result.AllPocResult, &pocRstTemp) |
99 | 109 | | |
100 | 110 | | if rule.StopIfMismatch && !isMatch { |
101 | 111 | | c.Result.IsVul = false |
| skipped 83 lines |