Skip to content

Commit c361d77

Browse files
committed
Merge features for 2.0.1
2 parents d8be724 + 9604142 commit c361d77

File tree

3 files changed

+27
-21
lines changed

3 files changed

+27
-21
lines changed

README.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Gobuster v2.0.0 (OJ Reeves @TheColonial)
1+
Gobuster v2.0.1 (OJ Reeves @TheColonial)
22
========================================
33

44
Gobuster is a tool used to brute-force:
@@ -112,7 +112,7 @@ Default options looks like this:
112112
$ gobuster -u https://buffered.io -w ~/wordlists/shortlist.txt
113113
114114
=====================================================
115-
Gobuster v2.0.0 OJ Reeves (@TheColonial)
115+
Gobuster v2.0.1 OJ Reeves (@TheColonial)
116116
=====================================================
117117
[+] Mode : dir
118118
[+] Url/Domain : https://buffered.io/
@@ -136,7 +136,7 @@ Default options with status codes disabled looks like this:
136136
$ gobuster -u https://buffered.io -w ~/wordlists/shortlist.txt -n
137137
138138
=====================================================
139-
Gobuster v2.0.0 OJ Reeves (@TheColonial)
139+
Gobuster v2.0.1 OJ Reeves (@TheColonial)
140140
=====================================================
141141
[+] Mode : dir
142142
[+] Url/Domain : https://buffered.io/
@@ -161,7 +161,7 @@ Verbose output looks like this:
161161
$ gobuster -u https://buffered.io -w ~/wordlists/shortlist.txt -v
162162
163163
=====================================================
164-
Gobuster v2.0.0 OJ Reeves (@TheColonial)
164+
Gobuster v2.0.1 OJ Reeves (@TheColonial)
165165
=====================================================
166166
[+] Mode : dir
167167
[+] Url/Domain : https://buffered.io/
@@ -188,7 +188,7 @@ Example showing content length:
188188
$ gobuster -u https://buffered.io -w ~/wordlists/shortlist.txt -l
189189
190190
=====================================================
191-
Gobuster v2.0.0 OJ Reeves (@TheColonial)
191+
Gobuster v2.0.1 OJ Reeves (@TheColonial)
192192
=====================================================
193193
[+] Mode : dir
194194
[+] Url/Domain : https://buffered.io/
@@ -228,7 +228,7 @@ Normal sample run goes like this:
228228
$ gobuster -m dns -w ~/wordlists/subdomains.txt -u google.com
229229
230230
=====================================================
231-
Gobuster v2.0.0 OJ Reeves (@TheColonial)
231+
Gobuster v2.0.1 OJ Reeves (@TheColonial)
232232
=====================================================
233233
[+] Mode : dns
234234
[+] Url/Domain : google.com
@@ -264,7 +264,7 @@ Show IP sample run goes like this:
264264
$ gobuster -m dns -w ~/wordlists/subdomains.txt -u google.com -i
265265
266266
=====================================================
267-
Gobuster v2.0.0 OJ Reeves (@TheColonial)
267+
Gobuster v2.0.1 OJ Reeves (@TheColonial)
268268
=====================================================
269269
[+] Mode : dns
270270
[+] Url/Domain : google.com
@@ -300,7 +300,7 @@ Base domain validation warning when the base domain fails to resolve. This is a
300300
$ gobuster -m dns -w ~/wordlists/subdomains.txt -u yp.to -i
301301
302302
=====================================================
303-
Gobuster v2.0.0 OJ Reeves (@TheColonial)
303+
Gobuster v2.0.1 OJ Reeves (@TheColonial)
304304
=====================================================
305305
[+] Mode : dns
306306
[+] Url/Domain : yp.to
@@ -320,7 +320,7 @@ Wildcard DNS is also detected properly:
320320
$ gobuster -m dns -w ~/wordlists/subdomains.txt -u 0.0.1.xip.io
321321
322322
=====================================================
323-
Gobuster v2.0.0 OJ Reeves (@TheColonial)
323+
Gobuster v2.0.1 OJ Reeves (@TheColonial)
324324
=====================================================
325325
[+] Mode : dns
326326
[+] Url/Domain : 0.0.1.xip.io
@@ -340,7 +340,7 @@ If the user wants to force processing of a domain that has wildcard entries, use
340340
$ gobuster -m dns -w ~/wordlists/subdomains.txt -u 0.0.1.xip.io -fw
341341
342342
=====================================================
343-
Gobuster v2.0.0 OJ Reeves (@TheColonial)
343+
Gobuster v2.0.1 OJ Reeves (@TheColonial)
344344
=====================================================
345345
[+] Mode : dns
346346
[+] Url/Domain : 0.0.1.xip.io

gobusterdns/gobusterdns.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"bytes"
55
"fmt"
66
"log"
7-
"net"
87
"strings"
98

109
"github.com/OJ/gobuster/libgobuster"
@@ -18,7 +17,7 @@ type GobusterDNS struct{}
1817
func (d GobusterDNS) Setup(g *libgobuster.Gobuster) error {
1918
// Resolve a subdomain sthat probably shouldn't exist
2019
guid := uuid.New()
21-
wildcardIps, err := net.LookupHost(fmt.Sprintf("%s.%s", guid, g.Opts.URL))
20+
wildcardIps, err := g.DNSLookup(fmt.Sprintf("%s.%s", guid, g.Opts.URL))
2221
if err == nil {
2322
g.IsWildcard = true
2423
g.WildcardIps.AddRange(wildcardIps)
@@ -30,7 +29,7 @@ func (d GobusterDNS) Setup(g *libgobuster.Gobuster) error {
3029

3130
if !g.Opts.Quiet {
3231
// Provide a warning if the base domain doesn't resolve (in case of typo)
33-
_, err = net.LookupHost(g.Opts.URL)
32+
_, err = g.DNSLookup(g.Opts.URL)
3433
if err != nil {
3534
// Not an error, just a warning. Eg. `yp.to` doesn't resolve, but `cr.py.to` does!
3635
log.Printf("[-] Unable to validate base domain: %s", g.Opts.URL)
@@ -43,7 +42,7 @@ func (d GobusterDNS) Setup(g *libgobuster.Gobuster) error {
4342
// Process is the process implementation of gobusterdns
4443
func (d GobusterDNS) Process(g *libgobuster.Gobuster, word string) ([]libgobuster.Result, error) {
4544
subdomain := fmt.Sprintf("%s.%s", word, g.Opts.URL)
46-
ips, err := net.LookupHost(subdomain)
45+
ips, err := g.DNSLookup(subdomain)
4746
var ret []libgobuster.Result
4847
if err == nil {
4948
if !g.IsWildcard || !g.WildcardIps.ContainsAny(ips) {
@@ -53,7 +52,7 @@ func (d GobusterDNS) Process(g *libgobuster.Gobuster, word string) ([]libgobuste
5352
if g.Opts.ShowIPs {
5453
result.Extra = strings.Join(ips, ", ")
5554
} else if g.Opts.ShowCNAME {
56-
cname, err := net.LookupCNAME(subdomain)
55+
cname, err := g.DNSLookupCname(subdomain)
5756
if err == nil {
5857
result.Extra = cname
5958
}

libgobuster/libgobuster.go

+13-6
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ import (
55
"bytes"
66
"context"
77
"fmt"
8+
"net"
89
"os"
910
"strings"
1011
"sync"
1112
)
1213

1314
const (
1415
// VERSION contains the current gobuster version
15-
VERSION = "2.0.0"
16+
VERSION = "2.0.1"
1617
)
1718

1819
// SetupFunc is the "setup" function prototype for implementations
@@ -111,10 +112,19 @@ func (g *Gobuster) ClearProgress() {
111112
// GetRequest issues a GET request to the target and returns
112113
// the status code, length and an error
113114
func (g *Gobuster) GetRequest(url string) (*int, *int64, error) {
114-
g.incrementRequests()
115115
return g.http.makeRequest(url, g.Opts.Cookies)
116116
}
117117

118+
// DNSLookup looks up a domain via system default DNS servers
119+
func (g *Gobuster) DNSLookup(domain string) ([]string, error) {
120+
return net.LookupHost(domain)
121+
}
122+
123+
// DNSLookupCname looks up a CNAME record via system default DNS servers
124+
func (g *Gobuster) DNSLookupCname(domain string) (string, error) {
125+
return net.LookupCNAME(domain)
126+
}
127+
118128
func (g *Gobuster) worker(wordChan <-chan string, wg *sync.WaitGroup) {
119129
defer wg.Done()
120130
for {
@@ -126,6 +136,7 @@ func (g *Gobuster) worker(wordChan <-chan string, wg *sync.WaitGroup) {
126136
if !ok {
127137
return
128138
}
139+
g.incrementRequests()
129140
// Mode-specific processing
130141
res, err := g.plugin.Process(g, word)
131142
if err != nil {
@@ -157,10 +168,6 @@ func (g *Gobuster) getWordlist() (*bufio.Scanner, error) {
157168
return nil, fmt.Errorf("failed to get number of lines: %v", err)
158169
}
159170

160-
// mutiply by extensions to get the total number of requests
161-
if len(g.Opts.ExtensionsParsed.Set) > 0 {
162-
lines = lines + (lines * len(g.Opts.ExtensionsParsed.Set))
163-
}
164171
g.requestsExpected = lines
165172
g.requestsIssued = 0
166173

0 commit comments

Comments
 (0)