From 7b411354b1711058fe6c7c2e79ec83dd52c99c74 Mon Sep 17 00:00:00 2001 From: Christian Mehlmauer Date: Wed, 29 Aug 2018 23:56:22 +0200 Subject: [PATCH 1/3] fix increment error --- libgobuster/libgobuster.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libgobuster/libgobuster.go b/libgobuster/libgobuster.go index 9d15db58..1c4c8fd4 100644 --- a/libgobuster/libgobuster.go +++ b/libgobuster/libgobuster.go @@ -111,7 +111,6 @@ func (g *Gobuster) ClearProgress() { // GetRequest issues a GET request to the target and returns // the status code, length and an error func (g *Gobuster) GetRequest(url string) (*int, *int64, error) { - g.incrementRequests() return g.http.makeRequest(url, g.Opts.Cookies) } @@ -126,6 +125,7 @@ func (g *Gobuster) worker(wordChan <-chan string, wg *sync.WaitGroup) { if !ok { return } + g.incrementRequests() // Mode-specific processing res, err := g.plugin.Process(g, word) if err != nil { From 8f6dd9f4f9ba911e86cb8db316bce9b25a64ee80 Mon Sep 17 00:00:00 2001 From: Christian Mehlmauer Date: Thu, 30 Aug 2018 00:15:09 +0200 Subject: [PATCH 2/3] counter is now word counter --- gobusterdns/gobusterdns.go | 9 ++++----- libgobuster/libgobuster.go | 15 +++++++++++---- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/gobusterdns/gobusterdns.go b/gobusterdns/gobusterdns.go index 1002e9b9..b8c1182f 100644 --- a/gobusterdns/gobusterdns.go +++ b/gobusterdns/gobusterdns.go @@ -4,7 +4,6 @@ import ( "bytes" "fmt" "log" - "net" "strings" "github.com/OJ/gobuster/libgobuster" @@ -18,7 +17,7 @@ type GobusterDNS struct{} func (d GobusterDNS) Setup(g *libgobuster.Gobuster) error { // Resolve a subdomain sthat probably shouldn't exist guid := uuid.New() - wildcardIps, err := net.LookupHost(fmt.Sprintf("%s.%s", guid, g.Opts.URL)) + wildcardIps, err := g.DNSLookup(fmt.Sprintf("%s.%s", guid, g.Opts.URL)) if err == nil { g.IsWildcard = true g.WildcardIps.AddRange(wildcardIps) @@ -30,7 +29,7 @@ func (d GobusterDNS) Setup(g *libgobuster.Gobuster) error { if !g.Opts.Quiet { // Provide a warning if the base domain doesn't resolve (in case of typo) - _, err = net.LookupHost(g.Opts.URL) + _, err = g.DNSLookup(g.Opts.URL) if err != nil { // Not an error, just a warning. Eg. `yp.to` doesn't resolve, but `cr.py.to` does! log.Printf("[-] Unable to validate base domain: %s", g.Opts.URL) @@ -43,7 +42,7 @@ func (d GobusterDNS) Setup(g *libgobuster.Gobuster) error { // Process is the process implementation of gobusterdns func (d GobusterDNS) Process(g *libgobuster.Gobuster, word string) ([]libgobuster.Result, error) { subdomain := fmt.Sprintf("%s.%s", word, g.Opts.URL) - ips, err := net.LookupHost(subdomain) + ips, err := g.DNSLookup(subdomain) var ret []libgobuster.Result if err == nil { if !g.IsWildcard || !g.WildcardIps.ContainsAny(ips) { @@ -53,7 +52,7 @@ func (d GobusterDNS) Process(g *libgobuster.Gobuster, word string) ([]libgobuste if g.Opts.ShowIPs { result.Extra = strings.Join(ips, ", ") } else if g.Opts.ShowCNAME { - cname, err := net.LookupCNAME(subdomain) + cname, err := g.DNSLookupCname(subdomain) if err == nil { result.Extra = cname } diff --git a/libgobuster/libgobuster.go b/libgobuster/libgobuster.go index 1c4c8fd4..1b3407cd 100644 --- a/libgobuster/libgobuster.go +++ b/libgobuster/libgobuster.go @@ -5,6 +5,7 @@ import ( "bytes" "context" "fmt" + "net" "os" "strings" "sync" @@ -114,6 +115,16 @@ func (g *Gobuster) GetRequest(url string) (*int, *int64, error) { return g.http.makeRequest(url, g.Opts.Cookies) } +// DNSLookup looks up a domain via system default DNS servers +func (g *Gobuster) DNSLookup(domain string) ([]string, error) { + return net.LookupHost(domain) +} + +// DNSLookupCname looks up a CNAME record via system default DNS servers +func (g *Gobuster) DNSLookupCname(domain string) (string, error) { + return net.LookupCNAME(domain) +} + func (g *Gobuster) worker(wordChan <-chan string, wg *sync.WaitGroup) { defer wg.Done() for { @@ -157,10 +168,6 @@ func (g *Gobuster) getWordlist() (*bufio.Scanner, error) { return nil, fmt.Errorf("failed to get number of lines: %v", err) } - // mutiply by extensions to get the total number of requests - if len(g.Opts.ExtensionsParsed.Set) > 0 { - lines = lines + (lines * len(g.Opts.ExtensionsParsed.Set)) - } g.requestsExpected = lines g.requestsIssued = 0 From 96041428bc9383a63db93200cc317de3aa5b703a Mon Sep 17 00:00:00 2001 From: OJ Date: Thu, 30 Aug 2018 09:05:36 +1000 Subject: [PATCH 3/3] Update version number for 2.0.1 --- README.md | 20 ++++++++++---------- libgobuster/libgobuster.go | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index fb0c2c0e..91cb81ec 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Gobuster v2.0.0 (OJ Reeves @TheColonial) +Gobuster v2.0.1 (OJ Reeves @TheColonial) ======================================== Gobuster is a tool used to brute-force: @@ -112,7 +112,7 @@ Default options looks like this: $ gobuster -u https://buffered.io -w ~/wordlists/shortlist.txt ===================================================== -Gobuster v2.0.0 OJ Reeves (@TheColonial) +Gobuster v2.0.1 OJ Reeves (@TheColonial) ===================================================== [+] Mode : dir [+] Url/Domain : https://buffered.io/ @@ -136,7 +136,7 @@ Default options with status codes disabled looks like this: $ gobuster -u https://buffered.io -w ~/wordlists/shortlist.txt -n ===================================================== -Gobuster v2.0.0 OJ Reeves (@TheColonial) +Gobuster v2.0.1 OJ Reeves (@TheColonial) ===================================================== [+] Mode : dir [+] Url/Domain : https://buffered.io/ @@ -161,7 +161,7 @@ Verbose output looks like this: $ gobuster -u https://buffered.io -w ~/wordlists/shortlist.txt -v ===================================================== -Gobuster v2.0.0 OJ Reeves (@TheColonial) +Gobuster v2.0.1 OJ Reeves (@TheColonial) ===================================================== [+] Mode : dir [+] Url/Domain : https://buffered.io/ @@ -188,7 +188,7 @@ Example showing content length: $ gobuster -u https://buffered.io -w ~/wordlists/shortlist.txt -l ===================================================== -Gobuster v2.0.0 OJ Reeves (@TheColonial) +Gobuster v2.0.1 OJ Reeves (@TheColonial) ===================================================== [+] Mode : dir [+] Url/Domain : https://buffered.io/ @@ -228,7 +228,7 @@ Normal sample run goes like this: $ gobuster -m dns -w ~/wordlists/subdomains.txt -u google.com ===================================================== -Gobuster v2.0.0 OJ Reeves (@TheColonial) +Gobuster v2.0.1 OJ Reeves (@TheColonial) ===================================================== [+] Mode : dns [+] Url/Domain : google.com @@ -264,7 +264,7 @@ Show IP sample run goes like this: $ gobuster -m dns -w ~/wordlists/subdomains.txt -u google.com -i ===================================================== -Gobuster v2.0.0 OJ Reeves (@TheColonial) +Gobuster v2.0.1 OJ Reeves (@TheColonial) ===================================================== [+] Mode : dns [+] Url/Domain : google.com @@ -300,7 +300,7 @@ Base domain validation warning when the base domain fails to resolve. This is a $ gobuster -m dns -w ~/wordlists/subdomains.txt -u yp.to -i ===================================================== -Gobuster v2.0.0 OJ Reeves (@TheColonial) +Gobuster v2.0.1 OJ Reeves (@TheColonial) ===================================================== [+] Mode : dns [+] Url/Domain : yp.to @@ -320,7 +320,7 @@ Wildcard DNS is also detected properly: $ gobuster -m dns -w ~/wordlists/subdomains.txt -u 0.0.1.xip.io ===================================================== -Gobuster v2.0.0 OJ Reeves (@TheColonial) +Gobuster v2.0.1 OJ Reeves (@TheColonial) ===================================================== [+] Mode : dns [+] 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 $ gobuster -m dns -w ~/wordlists/subdomains.txt -u 0.0.1.xip.io -fw ===================================================== -Gobuster v2.0.0 OJ Reeves (@TheColonial) +Gobuster v2.0.1 OJ Reeves (@TheColonial) ===================================================== [+] Mode : dns [+] Url/Domain : 0.0.1.xip.io diff --git a/libgobuster/libgobuster.go b/libgobuster/libgobuster.go index 1b3407cd..eeb8d341 100644 --- a/libgobuster/libgobuster.go +++ b/libgobuster/libgobuster.go @@ -13,7 +13,7 @@ import ( const ( // VERSION contains the current gobuster version - VERSION = "2.0.0" + VERSION = "2.0.1" ) // SetupFunc is the "setup" function prototype for implementations