banner
lca

lca

真正的不自由,是在自己的心中设下牢笼。

gobuster基礎用法

image

概述#

gobuster 這款工具個人主要用來做目錄掃描,平常也用的比較少,用的比較多的是ffuf,後面也會總結下 ffuf 工具。

gobuster 是一款用 go 語言寫的目錄掃描、DNS 和 vhost 暴力破解工具,gobuster 支持多種模式,在使用前根據使用目的選擇不同的模式,掃描模式可以設置多種類型,dir、dns、s3、gcs、vhost、fuzz、tftp 等。

模式如下:

模式描述
dir網站目錄 / 文件暴力破解
dnsdns 子域名爆破
vhost虛擬主機爆破
fuzz爆破指定的 FUZZ 關鍵字
s3枚舉開放的 s3 buckets
gcs枚舉 google cloud buckets
tftp枚舉 tftp 文件
  • 項目地址

Directory/File, DNS and VHost busting tool written in Go

  • 安裝

設置了 go 環境直接安裝

go install github.com/OJ/gobuster/v3@latest

如果想查看幫助文檔,可以在命令行下指定不同的模式查看不同的文檔。

gobuster dir -h

image

gobuster dns -h

image

dir 模式#

  • 基礎用法
gobuster dir -u "http://example.com/" -w /Users/lca/pentesting/web-basic/p12-字典收集/fuzz1.txt

image

dir 模式一些常用的設置選項

-c: 指定 cookie 掃描,掃描認證後台
-x: 指定掃描文件後綴,如 php,jsp,asp
-m: 指定 http 請求方法
-b: 指定不需要的狀態碼,默認過濾 404 狀態碼
-s: 只接受特定 http 狀態碼
-u: 指定目標 url
-w: 指定字典文件
-q: 靜默模式
-t: 指定掃描線程,默認是 10 個線程
-f: 每個 url 後面強制接/
--wildcard: 發現通配符時強制掃描,這個參數告訴 gobuster 應該如何處理響應中的通配符或不完整的響應,如遇到 404 頁面是否繼續掃描等,開啟後,遇到這種 404,403 的狀態碼就會強制掃描,保證掃描的完整性和準確性
-exclude-length ints: 排除指定長度的內容
-r: 跟隨重定向
-e: 擴展模式,打印完整的 URL
-k: 跳過 TLS 證書驗證

如下:

  • 掃描目標網站 mysite.com,指定 cookie 進行登錄掃描,url 後綴是 php,html,50 個線程,字典文件為 common-files.txt 。
gobuster dir -u https://mysite.com/ -c 'session=123456' -t 50 -w common-files.txt -x .php,.html
  • 使用 --wildcard 參數強制掃描,過濾 301,401,403,404,500,掃描線程為 20
gobuster dir -u https://mysite.com/ -w common-files.txt --wildcard -b 301,401,403,404,500 -t 20
gobuster dir -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -u http://mysite.com/ -f -t 200

dns 模式#

dns 模式用來枚舉目標子域名

  • 基礎用法
gobuster dns -d mysite.com -w ~/wordlists/subdomains.txt
  • 常用的選項參數

-d: 指定域名
-i: 顯示 ip 地址
--wildcard: 通 dir 模式,強制掃描通配符
-t: 指定掃描速度

vhost 模式#

vhost 模式是一種用於模擬虛擬主機攻擊的模式,它可以幫助我們在不知道 Web 應用程序所有可能的虛擬主機的情況下,枚舉目標網站上存在的虛擬主機。

這個模式在玩htb的時候遇到的比較多。

gobuster vhost -w /usr/share/wordlists/subnames.txt -u http://shoppy.htb

image

同時在此模式下指定 dir 可以進行目錄掃描。

gobuster vhost dir -u shoppy.htb -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-110000.txt -t 150

fuzz 模式#

fuzz 模式可以用來掃描一些 url 的參數,如有個 url 如下:http://example.com/about.php?id=1,需要枚舉 id 參數,那麼可以通過 fuzz 模式進行參數枚舉,id 替換成 FUZZ。

gobuster fuzz -u http://example.com/about.php?FUZZ=1 -w parameter-names.txt

image

其他模式#

用的比較少,就簡單的列舉寫使用方式

  • s3
gobuster s3 -w bucket-names.txt
  • gcs
gobuster gcs -w bucket-names.txt
  • tftp
gobuster tftp -s tftp.example.com -w common-filenames.txt

@hacking articles上有個關於 gobuster 的思維導圖。

image

參考#

  • Directory/File, DNS and VHost busting tool written in Go

圖片來自:https://wallhaven.cc/

載入中......
此文章數據所有權由區塊鏈加密技術和智能合約保障僅歸創作者所有。