What is Gobuster?
Gobuster is a command-line tool used during reconnaissance to discover hidden directories, files, DNS subdomains and virtual hosts.
Gobuster uses a wordlist, which is a file containing possible names. It tests those names against a target and reports matching results.
For example, if your wordlist contains
admin, login and
backup, Gobuster DIR can test paths such as
https://example.com/admin.
Gobuster DIR — Directory and File Discovery
Gobuster DIR checks a website for directories and files that might not appear in its navigation menu.
Suppose you are testing your own website
https://example.com. Gobuster may try
paths such as /admin, /login
and /backup using a wordlist.
Important Gobuster DIR Flags
| Flag | Purpose | Example |
|---|---|---|
dir |
Start directory discovery | gobuster dir |
-u |
Target website URL | -u https://example.com |
-w |
Wordlist location | -w common.txt |
-x |
File extensions | -x php,html,js |
-t |
Concurrent threads | -t 10 |
-o |
Save results to a file | -o results.txt |
--exclude-length |
Filter specific response lengths | --exclude-length 1234 |
Important Gobuster DIR Commands
1. Basic directory discovery
gobuster dir -u https://example.com -w /usr/share/wordlists/dirb/common.txt
-u specifies the website and
-w specifies the wordlist.
2. Discover files with extensions
gobuster dir -u https://example.com -w /usr/share/wordlists/dirb/common.txt -x php,html,js,txt -t 10
-x tries file extensions such as
.php and .html.
-t 10 uses 10 concurrent threads.
3. Save discovered paths
gobuster dir -u https://example.com -w /usr/share/wordlists/dirb/common.txt -t 10 -o dir-results.txt
Example Output
200: Request succeeded.
301: Resource redirects.
403: Access denied.
404: Resource not found.
Gobuster DNS — Subdomain Discovery
Gobuster DNS uses a wordlist to generate possible subdomains and checks whether they resolve through DNS.
For example, if your domain is
example.com, Gobuster may check
mail.example.com,
dev.example.com and
api.example.com.
Important Gobuster DNS Flags
| Flag | Purpose | Example |
|---|---|---|
dns |
Start DNS enumeration | gobuster dns |
-do |
Target domain in newer versions | -do example.com |
-w |
Subdomain wordlist | -w subdomains.txt |
-r |
Custom DNS resolver | -r 8.8.8.8:53 |
-t |
Concurrent threads | -t 10 |
-o |
Save results | -o dns-results.txt |
Important Gobuster DNS Commands
1. Basic subdomain discovery
gobuster dns -do example.com -w subdomains.txt
-do specifies the domain in newer
Gobuster versions, while -w
provides the subdomain wordlist.
2. Use a custom DNS resolver
gobuster dns -do example.com -w subdomains.txt -r 8.8.8.8:53
-r chooses the resolver.
8.8.8.8 is a public DNS resolver,
and 53 is the DNS port.
3. Save DNS results
gobuster dns -do example.com -w subdomains.txt -t 10 -o dns-results.txt
Example Output
Gobuster VHOST — Virtual Host Discovery
A virtual host allows a web server to serve different websites based on the hostname used in an HTTP request.
For example, www.example.com,
admin.example.com and
dev.example.com can share
the same server IP address.
Gobuster VHOST tries possible hostnames against a web server and compares the responses to identify configured virtual hosts.
Important Gobuster VHOST Flags
| Flag | Purpose | Example |
|---|---|---|
vhost |
Start virtual-host discovery | gobuster vhost |
-u |
Target web server URL | -u https://example.com |
-w |
Wordlist location | -w subdomains.txt |
--append-domain |
Add the domain to each word | --append-domain |
-t |
Concurrent threads | -t 10 |
-o |
Save results | -o vhost-results.txt |
--exclude-length |
Filter repeated response sizes | --exclude-length 1234 |
Important Gobuster VHOST Commands
1. Basic virtual-host discovery
gobuster vhost -u https://example.com -w subdomains.txt --append-domain
--append-domain converts a word such
as admin into
admin.example.com.
2. Save discovered virtual hosts
gobuster vhost -u https://example.com -w subdomains.txt --append-domain -t 10 -o vhost-results.txt
3. Filter repeated response lengths
gobuster vhost -u https://example.com -w subdomains.txt --append-domain --exclude-length 1234
1234 is only an example.
First inspect the actual response lengths before
filtering results. HTTPS and reverse proxies
can also affect virtual-host testing.
Three Gobuster Commands to Remember
DIR — Find directories and files
gobuster dir -u https://example.com -w /usr/share/wordlists/dirb/common.txt -x php,html,js -t 10 -o dir-results.txt
DNS — Discover subdomains
gobuster dns -do example.com -w subdomains.txt -t 10 -o dns-results.txt
VHOST — Discover virtual hosts
gobuster vhost -u https://example.com -w subdomains.txt --append-domain -t 10 -o vhost-results.txt
Before Running Gobuster
- Check your installed version using
gobuster version. - Use
gobuster dns --helpto verify DNS flags for your version. - Make sure your wordlist exists.
- Start with a small wordlist and modest thread count.
- Verify the results manually before reporting any finding.