-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
122 lines (105 loc) · 2.84 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
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
package main
import (
"fmt"
"github.com/akamensky/argparse"
"github.com/putabones/RATT/target"
"os"
)
// TODO
// - add dirb and wfuzz methods
// - eventually add switches for dirb, wfuzz, etc.
// - wfuzz -c -w /usr/share/wordlists/dirb/common.txt http://10.10.10.180/FUZZ/web.config
// - dirb http://10.10.10.180 /usr/share/wordlists/dirb/small.txt -x /usr/share/wordlists/dirb/extensions_common.txt
// - add showmount listing method
// - sudo showmount -e 10.10.10.180
// parses user inputs
func parserFunc(t *target.Target) {
var parse = argparse.NewParser("RATT", "RATT stands for \"Recon All The Things\", it will perform "+
"scans against a target that is as intrusive as you want. Version: 1.3")
var i = parse.String("i", "ip", &argparse.Options{
Required: true,
Validate: nil,
Help: "IP address to scan",
Default: nil,
})
var f = parse.String("f", "folder", &argparse.Options{
Required: false,
Validate: nil,
Help: "Folder to save outputs",
Default: "/tmp/",
})
// can add multiple -n to append to the list
var o = parse.String("o", "nmap", &argparse.Options{
Required: false,
Validate: nil,
Help: "Override NMAP Options",
Default: "-sT",
})
// amount of ports to scan, starts at 1
var p = parse.Int("p", "ports", &argparse.Options{
Required: false,
Validate: nil,
Help: "Ports to scan, starts at 1 then up to 65535",
Default: 200,
})
// number of concurrent workers
var w = parse.Int("w", "workers", &argparse.Options{
Required: false,
Validate: nil,
Help: "Amount of concurrent workers to spawn",
Default: 100,
})
// hostname
var n = parse.String("n", "hostname", &argparse.Options{
Required: false,
Validate: nil,
Help: "Hostname for your target, will be added to host file if added",
Default: "NoName",
})
var b = parse.Flag("b", "banner", &argparse.Options{
Required: false,
Validate: nil,
Help: "Banner grabs on open TCP Ports",
Default: false,
})
// check inputs
err := parse.Parse(os.Args)
if err != nil {
fmt.Println(parse.Usage(nil))
} else if *i == "" {
fmt.Println("[-] Need an IP with \"-i\"")
fmt.Println("[-] Try \"-h\" or \"--help\" for arguments")
} else if *p > 65535 {
fmt.Println("[-] Ports can't be more than 65535")
} else {
t.Ip = *i
t.Amt = *p
t.NmapOptions = *o
t.PortsCap = *w
t.Hostname = *n
t.Folder = *f
t.Banner = *b
}
}
// main
func main() {
// new target
var tgt = new(target.Target)
// parse user input
parserFunc(tgt)
if tgt.Ip != "" {
// ids linux or windows and empty string slice
var user = os.Getuid()
// looks from windows or nix
switch user {
case -1:
fmt.Println("\n[+] OS: Windows")
case 0:
fmt.Println("\n[+] OS: Linux, User: root")
default:
fmt.Println("\n[-] OS: Linux, User: not root, some of the scans may not work...")
}
// launch scan
tgt.Start()
}
}