Codebase list gobuster / 78d41b5
Import Upstream version 2.0.1 Sophie Brun 5 years ago
8 changed file(s) with 159 addition(s) and 34 deletion(s). Raw diff Collapse all Expand all
2424 *.txt
2525 *.swp
2626
27 gobuster
27 gobuster
28 build
0 TARGET=./build
1 OSES=darwin linux windows
2 ARCHS=amd64 386
3
4 current: outputdir
5 @go build -o ./gobuster; \
6 echo "Done."
7
8 outputdir:
9 @mkdir -p ${TARGET}
10
11 windows: outputdir
12 @for GOARCH in ${ARCHS}; do \
13 echo "Building for windows $${GOARCH} ..." ; \
14 GOOS=windows GARCH=$${GOARCH} go build -o ${TARGET}/gobuster-$${GOARCH}.exe ; \
15 done; \
16 echo "Done."
17
18 linux: outputdir
19 @for GOARCH in ${ARCHS}; do \
20 echo "Building for linux $${GOARCH} ..." ; \
21 GOOS=linux GARCH=$${GOARCH} go build -o ${TARGET}/gobuster-linux-$${GOARCH} ; \
22 done; \
23 echo "Done."
24
25 darwin: outputdir
26 @for GOARCH in ${ARCHS}; do \
27 echo "Building for darwin $${GOARCH} ..." ; \
28 GOOS=darwin GARCH=$${GOARCH} go build -o ${TARGET}/gobuster-darwin-$${GOARCH} ; \
29 done; \
30 echo "Done."
31
32
33 all: darwin linux windows
34
35 test:
36 @go test -v -race ./... ; \
37 echo "Done."
38
39 clean:
40 @rm -rf ${TARGET}/* ; \
41 echo "Done."
0 Gobuster v2.0.0 (OJ Reeves @TheColonial)
0 Gobuster v2.0.1 (OJ Reeves @TheColonial)
11 ========================================
22
33 Gobuster is a tool used to brute-force:
7777 ```
7878 gobuster $ go install
7979 ```
80 If you have all the dependencies already, you can make use of the build scripts:
81 * `make` - builds for the current Go configuration (ie. runs `go build`).
82 * `make windows` - builds 32 and 64 bit binaries for windows, and writes them to the `build` subfolder.
83 * `make linux` - builds 32 and 64 bit binaries for linux, and writes them to the `build` subfolder.
84 * `make darwin` - builds 32 and 64 bit binaries for darwin, and writes them to the `build` subfolder.
85 * `make all` - builds for all platforms and architectures, and writes the resulting binaries to the `build` subfolder.
86 * `make clean` - clears out the `build` subfolder.
87 * `make test` - runs the tests (requires you to `go get githubcom/h2non/gock` first).
8088
8189 #### Running as a script
8290 ```
103111 $ gobuster -u https://buffered.io -w ~/wordlists/shortlist.txt
104112
105113 =====================================================
106 Gobuster v2.0.0 OJ Reeves (@TheColonial)
114 Gobuster v2.0.1 OJ Reeves (@TheColonial)
107115 =====================================================
108116 [+] Mode : dir
109117 [+] Url/Domain : https://buffered.io/
127135 $ gobuster -u https://buffered.io -w ~/wordlists/shortlist.txt -n
128136
129137 =====================================================
130 Gobuster v2.0.0 OJ Reeves (@TheColonial)
138 Gobuster v2.0.1 OJ Reeves (@TheColonial)
131139 =====================================================
132140 [+] Mode : dir
133141 [+] Url/Domain : https://buffered.io/
152160 $ gobuster -u https://buffered.io -w ~/wordlists/shortlist.txt -v
153161
154162 =====================================================
155 Gobuster v2.0.0 OJ Reeves (@TheColonial)
163 Gobuster v2.0.1 OJ Reeves (@TheColonial)
156164 =====================================================
157165 [+] Mode : dir
158166 [+] Url/Domain : https://buffered.io/
179187 $ gobuster -u https://buffered.io -w ~/wordlists/shortlist.txt -l
180188
181189 =====================================================
182 Gobuster v2.0.0 OJ Reeves (@TheColonial)
190 Gobuster v2.0.1 OJ Reeves (@TheColonial)
183191 =====================================================
184192 [+] Mode : dir
185193 [+] Url/Domain : https://buffered.io/
219227 $ gobuster -m dns -w ~/wordlists/subdomains.txt -u google.com
220228
221229 =====================================================
222 Gobuster v2.0.0 OJ Reeves (@TheColonial)
230 Gobuster v2.0.1 OJ Reeves (@TheColonial)
223231 =====================================================
224232 [+] Mode : dns
225233 [+] Url/Domain : google.com
255263 $ gobuster -m dns -w ~/wordlists/subdomains.txt -u google.com -i
256264
257265 =====================================================
258 Gobuster v2.0.0 OJ Reeves (@TheColonial)
266 Gobuster v2.0.1 OJ Reeves (@TheColonial)
259267 =====================================================
260268 [+] Mode : dns
261269 [+] Url/Domain : google.com
291299 $ gobuster -m dns -w ~/wordlists/subdomains.txt -u yp.to -i
292300
293301 =====================================================
294 Gobuster v2.0.0 OJ Reeves (@TheColonial)
302 Gobuster v2.0.1 OJ Reeves (@TheColonial)
295303 =====================================================
296304 [+] Mode : dns
297305 [+] Url/Domain : yp.to
311319 $ gobuster -m dns -w ~/wordlists/subdomains.txt -u 0.0.1.xip.io
312320
313321 =====================================================
314 Gobuster v2.0.0 OJ Reeves (@TheColonial)
322 Gobuster v2.0.1 OJ Reeves (@TheColonial)
315323 =====================================================
316324 [+] Mode : dns
317325 [+] Url/Domain : 0.0.1.xip.io
331339 $ gobuster -m dns -w ~/wordlists/subdomains.txt -u 0.0.1.xip.io -fw
332340
333341 =====================================================
334 Gobuster v2.0.0 OJ Reeves (@TheColonial)
342 Gobuster v2.0.1 OJ Reeves (@TheColonial)
335343 =====================================================
336344 [+] Mode : dns
337345 [+] Url/Domain : 0.0.1.xip.io
33 "bytes"
44 "fmt"
55 "log"
6 "net"
76 "strings"
87
98 "github.com/OJ/gobuster/libgobuster"
1716 func (d GobusterDNS) Setup(g *libgobuster.Gobuster) error {
1817 // Resolve a subdomain sthat probably shouldn't exist
1918 guid := uuid.New()
20 wildcardIps, err := net.LookupHost(fmt.Sprintf("%s.%s", guid, g.Opts.URL))
19 wildcardIps, err := g.DNSLookup(fmt.Sprintf("%s.%s", guid, g.Opts.URL))
2120 if err == nil {
2221 g.IsWildcard = true
2322 g.WildcardIps.AddRange(wildcardIps)
2928
3029 if !g.Opts.Quiet {
3130 // Provide a warning if the base domain doesn't resolve (in case of typo)
32 _, err = net.LookupHost(g.Opts.URL)
31 _, err = g.DNSLookup(g.Opts.URL)
3332 if err != nil {
3433 // Not an error, just a warning. Eg. `yp.to` doesn't resolve, but `cr.py.to` does!
3534 log.Printf("[-] Unable to validate base domain: %s", g.Opts.URL)
4241 // Process is the process implementation of gobusterdns
4342 func (d GobusterDNS) Process(g *libgobuster.Gobuster, word string) ([]libgobuster.Result, error) {
4443 subdomain := fmt.Sprintf("%s.%s", word, g.Opts.URL)
45 ips, err := net.LookupHost(subdomain)
44 ips, err := g.DNSLookup(subdomain)
4645 var ret []libgobuster.Result
4746 if err == nil {
4847 if !g.IsWildcard || !g.WildcardIps.ContainsAny(ips) {
5251 if g.Opts.ShowIPs {
5352 result.Extra = strings.Join(ips, ", ")
5453 } else if g.Opts.ShowCNAME {
55 cname, err := net.LookupCNAME(subdomain)
54 cname, err := g.DNSLookupCname(subdomain)
5655 if err == nil {
5756 result.Extra = cname
5857 }
44 "bytes"
55 "context"
66 "fmt"
7 "net"
78 "os"
89 "strings"
910 "sync"
1112
1213 const (
1314 // VERSION contains the current gobuster version
14 VERSION = "2.0.0"
15 VERSION = "2.0.1"
1516 )
1617
1718 // SetupFunc is the "setup" function prototype for implementations
110111 // GetRequest issues a GET request to the target and returns
111112 // the status code, length and an error
112113 func (g *Gobuster) GetRequest(url string) (*int, *int64, error) {
113 g.incrementRequests()
114114 return g.http.makeRequest(url, g.Opts.Cookies)
115 }
116
117 // DNSLookup looks up a domain via system default DNS servers
118 func (g *Gobuster) DNSLookup(domain string) ([]string, error) {
119 return net.LookupHost(domain)
120 }
121
122 // DNSLookupCname looks up a CNAME record via system default DNS servers
123 func (g *Gobuster) DNSLookupCname(domain string) (string, error) {
124 return net.LookupCNAME(domain)
115125 }
116126
117127 func (g *Gobuster) worker(wordChan <-chan string, wg *sync.WaitGroup) {
125135 if !ok {
126136 return
127137 }
138 g.incrementRequests()
128139 // Mode-specific processing
129140 res, err := g.plugin.Process(g, word)
130141 if err != nil {
156167 return nil, fmt.Errorf("failed to get number of lines: %v", err)
157168 }
158169
159 // mutiply by extensions to get the total number of requests
160 if len(g.Opts.ExtensionsParsed.Set) > 0 {
161 lines = lines + (lines * len(g.Opts.ExtensionsParsed.Set))
162 }
163170 g.requestsExpected = lines
164171 g.requestsIssued = 0
165172
0 @echo off
1
2 SET ARG=%1
3 SET TARGET=.\build
4
5 IF "%ARG%"=="test" (
6 go test -v -race ./...
7 echo Done.
8 GOTO Done
9 )
10
11 IF "%ARG%"=="clean" (
12 del /F /Q %TARGET%\*.*
13 echo Done.
14 GOTO Done
15 )
16
17 IF "%ARG%"=="windows" (
18 CALL :Windows
19 GOTO Done
20 )
21
22 IF "%ARG%"=="darwin" (
23 CALL :Darwin
24 GOTO Done
25 )
26
27 IF "%ARG%"=="linux" (
28 CALL :Linux
29 GOTO Done
30 )
31
32 IF "%ARG%"=="all" (
33 CALL :Darwin
34 CALL :Linux
35 CALL :Windows
36 GOTO Done
37 )
38
39 IF "%ARG%"=="" (
40 go build -o .\gobuster.exe
41 GOTO Done
42 )
43
44 GOTO Done
45
46 :Darwin
47 set GOOS=darwin
48 set GOARCH=amd64
49 echo Building for %GOOS% %GOARCH% ...
50 go build -o %TARGET%\gobuster-%GOOS%-%GOARCH%
51 set GOARCH=386
52 echo Building for %GOOS% %GOARCH% ...
53 go build -o %TARGET%\gobuster-%GOOS%-%GOARCH%
54 echo Done.
55 EXIT /B 0
56
57 :Linux
58 set GOOS=linux
59 set GOARCH=amd64
60 echo Building for %GOOS% %GOARCH% ...
61 go build -o %TARGET%\gobuster-%GOOS%-%GOARCH%
62 set GOARCH=386
63 echo Building for %GOOS% %GOARCH% ...
64 go build -o %TARGET%\gobuster-%GOOS%-%GOARCH%
65 echo Done.
66 EXIT /B 0
67
68 :Windows
69 set GOOS=windows
70 set GOARCH=amd64
71 echo Building for %GOOS% %GOARCH% ...
72 go build -o %TARGET%\gobuster-%GOARCH%.exe
73 set GOARCH=386
74 echo Building for %GOOS% %GOARCH% ...
75 go build -o %TARGET%\gobuster-%GOARCH%.exe
76 echo Done.
77 EXIT /B 0
78
79 :Done
+0
-6
make_linux.bat less more
0 @echo off
1 set GOOS=linux
2 set GOARCH=amd64
3
4 go test -v -race ./...
5 go build -o gobuster
+0
-6
make_windows.bat less more
0 @echo off
1 set GOOS=windows
2 set GOARCH=amd64
3
4 go test -v -race ./...
5 go build -o gobuster.exe