■ ■ ■ ■ ■ ■
internal/runner/runner.go
| skipped 1 lines |
2 | 2 | | |
3 | 3 | | import ( |
4 | 4 | | "fmt" |
| 5 | + | "net/http" |
5 | 6 | | "os" |
6 | 7 | | "sync" |
7 | 8 | | "time" |
| skipped 6 lines |
14 | 15 | | "github.com/zan8in/afrog/pkg/fingerprint" |
15 | 16 | | "github.com/zan8in/afrog/pkg/html" |
16 | 17 | | "github.com/zan8in/afrog/pkg/log" |
| 18 | + | "github.com/zan8in/afrog/pkg/output" |
17 | 19 | | "github.com/zan8in/afrog/pkg/poc" |
18 | 20 | | "github.com/zan8in/afrog/pkg/protocols/http/retryhttpclient" |
19 | 21 | | "github.com/zan8in/afrog/pkg/targetlive" |
| skipped 36 lines |
56 | 58 | | htemplate.Filename = options.Output |
57 | 59 | | if err := htemplate.New(); err != nil { |
58 | 60 | | gologger.Fatal().Msgf("Output failed, %s", err.Error()) |
| 61 | + | } |
| 62 | + | |
| 63 | + | // output to json file |
| 64 | + | if len(options.OutputJson) > 0 { |
| 65 | + | options.OJ = output.NewOutputJson(options.OutputJson) |
59 | 66 | | } |
60 | 67 | | |
61 | 68 | | // show banner |
| skipped 126 lines |
188 | 195 | | // url, statusCode := http2.CheckTargetHttps(url) |
189 | 196 | | url, statusCode = retryhttpclient.CheckHttpsAndLives(url) |
190 | 197 | | |
191 | | - | if statusCode == -1 || statusCode >= 500 { |
| 198 | + | if statusCode == -1 || statusCode >= http.StatusInternalServerError { |
192 | 199 | | if statusCode == -1 && !utils.IsURL(url) { |
193 | 200 | | url = "http://" + url |
194 | 201 | | } |
| skipped 10 lines |
205 | 212 | | // url, statusCode := http2.CheckTargetHttps(url) |
206 | 213 | | url, statusCode = retryhttpclient.CheckHttpsAndLives(url) |
207 | 214 | | |
208 | | - | if statusCode == -1 || statusCode >= 500 { |
| 215 | + | if statusCode == -1 || statusCode >= http.StatusInternalServerError { |
209 | 216 | | if statusCode == -1 && !utils.IsURL(url) { |
210 | 217 | | url = "http://" + url |
211 | 218 | | } |
| skipped 44 lines |