1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
package main
import (
"flag"
"log"
)
var (
// boolean flags
color bool
verbose bool
dryrun bool
followRedirects bool
// string values
proxy string
url string
payload string
wordlist string
data string
header string
// int values
threads int
delay int
httpServerPort int
// string values defining what request to show or hide
hide Hide
show Show
)
func registerFlags() {
log.Printf("%s Reading flags", green("[i]"))
shortcut := " (shortcut)"
// Boolean values
colorUsage := "Output with color"
flag.BoolVar(&color, "color", false, colorUsage)
flag.BoolVar(&color, "c", false, colorUsage+shortcut)
verboseUsage := "Verbose output"
flag.BoolVar(&verbose, "verbose", false, verboseUsage)
flag.BoolVar(&verbose, "v", false, verboseUsage+shortcut)
dryrunUsage := "Print the results of applying the requests without actually making any HTTP requests"
flag.BoolVar(&dryrun, "dryrun", false, dryrunUsage)
flag.BoolVar(&dryrun, "D", false, dryrunUsage+shortcut)
followRedirectsUsage := "Follow HTTP redirects"
flag.BoolVar(&followRedirects, "followRedirects", false, followRedirectsUsage)
flag.BoolVar(&followRedirects, "L", false, followRedirectsUsage+shortcut)
// Strings
proxyUsage := "Proxy to use"
flag.StringVar(&proxy, "proxy", "", proxyUsage)
flag.StringVar(&proxy, "p", "", proxyUsage+shortcut)
urlUsage := "url to use"
flag.StringVar(&url, "url", "", urlUsage)
flag.StringVar(&url, "u", "", urlUsage+shortcut)
payloadUsage := "payload type"
flag.StringVar(&payload, "payload", "file", payloadUsage)
flag.StringVar(&payload, "P", "file", payloadUsage+shortcut)
wordlistUsage := "wordlist type"
flag.StringVar(&wordlist, "wordlist", "", wordlistUsage)
flag.StringVar(&wordlist, "w", "", wordlistUsage+shortcut)
headerUsage := "Define the headers to set"
flag.StringVar(&header, "header", "", headerUsage)
flag.StringVar(&header, "h", "", headerUsage+shortcut)
// Ints
threadsUsage := "Amount of threads connections to use"
flag.IntVar(&threads, "threads", 1, threadsUsage)
flag.IntVar(&threads, "t", 1, threadsUsage+shortcut)
delayUsage := "Amount of delay in between the requests"
flag.IntVar(&delay, "delay", 0, delayUsage)
flag.IntVar(&delay, "d", 0, delayUsage+shortcut)
httpServerPortUsage := "Port the http server exposing the findings should listen on"
flag.IntVar(&httpServerPort, "httpServerPort", 8080, httpServerPortUsage)
flag.IntVar(&httpServerPort, "hsp", 8080, httpServerPortUsage+shortcut)
// parse the flags
flag.Parse()
log.Printf("%s Done reading flags", boldGreen("[+]"))
}
|