about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEmile <hanemile@protonmail.com>2019-10-30 17:48:28 +0100
committerEmile <hanemile@protonmail.com>2019-10-30 17:48:28 +0100
commitc852c772aab04e4b09d99f08cc7968cecd743ee7 (patch)
tree60e02b75abcccd1abf745895e93d509e7907ce8d
parentcb44831712db83ca7af6854dae96710453875ba1 (diff)
basic structure (flags)
-rw-r--r--src/flags.go87
-rw-r--r--src/main.go2
-rw-r--r--src/structs.go35
3 files changed, 124 insertions, 0 deletions
diff --git a/src/flags.go b/src/flags.go
new file mode 100644
index 0000000..c96a7d2
--- /dev/null
+++ b/src/flags.go
@@ -0,0 +1,87 @@
+package main
+
+import (
+	"flag"
+)
+
+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
+	concurrent int
+	delay      int
+
+	// string values defining what request to show or hide
+	hide Hide
+	show Show
+)
+
+func registerFlags() {
+	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
+
+	concurrentUsage := "Amount of concurrent connections to use"
+	flag.IntVar(&concurrent, "concurrent", 1, concurrentUsage)
+	flag.IntVar(&concurrent, "t", 1, concurrentUsage+shortcut)
+
+	delayUsage := "Amount of delay in between the requests"
+	flag.IntVar(&delay, "delay", 0, delayUsage)
+	flag.IntVar(&delay, "d", 0, delayUsage+shortcut)
+
+	// parse the flags
+
+	flag.Parse()
+}
diff --git a/src/main.go b/src/main.go
index 50e8d8d..ce29777 100644
--- a/src/main.go
+++ b/src/main.go
@@ -3,5 +3,7 @@ package main
 import "fmt"
 
 func main() {
+	registerFlags()
+
 	fmt.Println("vim-go")
 }
diff --git a/src/structs.go b/src/structs.go
new file mode 100644
index 0000000..4458dc8
--- /dev/null
+++ b/src/structs.go
@@ -0,0 +1,35 @@
+package main
+
+// Hide stores what requests to hide
+type Hide struct {
+	hideCode, hideLine, hideWord, hideChar string
+}
+
+// Show stores what requests to show
+type Show struct {
+	showCode, showLine, showWord, showChar string
+}
+
+// Config stores the overall config
+type Config struct {
+
+	// show / hide config
+	Show Show
+	Hide Hide
+
+	// misc config
+	color          bool
+	verbose        bool
+	printer        string
+	dryrun         bool
+	proxy          string
+	concurrent     int
+	delay          int
+	followRedirect bool
+	url            string
+	payload        string
+	wordlist       string
+	postData       string
+	headers        string
+	basicauth      string
+}