-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
62 lines (50 loc) · 1.55 KB
/
main.go
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
package main
import (
"flag"
"fmt"
gg "gogasm/src"
)
var header string = `
______ ______ ______ ______ ______ __ __
/\ ___\ /\ __ \ /\ ___\ /\ __ \ /\ ___\ /\ "-./ \
\ \ \__ \ \ \ \/\ \ \ \ \__ \ \ \ __ \ \ \___ \ \ \ \-./\ \
\ \_____\ \ \_____\ \ \_____\ \ \_\ \_\ \/\_____\ \ \_\ \ \_\
\/_____/ \/_____/ \/_____/ \/_/\/_/ \/_____/ \/_/ \/_/
`
var seperator string = "--------------------------------------------------------------------"
type config struct {
wordlist string
addr string
port string
}
func parseFlags() *config {
c := &config{}
flag.StringVar(&c.wordlist, "w", "", "Wordlist file path")
flag.StringVar(&c.addr, "a", "", "Address eg. localhost")
flag.StringVar(&c.port, "p", "80", "Port eg. 80")
flag.Parse()
return c
}
func printHeader() {
version := "beta"
versionLen := len(version) + 2
seperatorLen := len(seperator)
seperatorSize := (seperatorLen - versionLen) / 2
version_seperator := fmt.Sprintf("%s %s %s", seperator[:seperatorSize], version, seperator[:seperatorSize])
fmt.Printf("%s\n%s\n%s\n\n", version_seperator, header[1:], seperator)
}
func main() {
printHeader()
config := parseFlags()
if config.wordlist == "" {
fmt.Println("Please provide a wordlist :: $ gogasm -w /path/to/wordlist \n")
return
}
if config.addr == "" {
fmt.Println("Please provide an address :: $ gogasm -a localhost \n")
return
}
addr := fmt.Sprintf("%s:%s", config.addr, config.port)
runner := gg.NewRunner("tcp", addr, config.wordlist)
runner.Start()
}