目录爆破 — 工具配置
Web 题开放了端口但页面是空的?先试试目录爆破——flag 可能藏在某个隐藏目录里。
核心工具
| 工具 | 语言 | 特点 |
|---|---|---|
| dirsearch | Python | 最常用、速度快、结果美观 |
| gobuster | Go | 极快、并发强、无依赖 |
| ffuf | Go | 速度最快、FUZZ 全场景 |
| dirb | C | 经典老牌 |
dirsearch(推荐)
# 安装
git clone https://github.com/maurosoria/dirsearch.git
cd dirsearch
pip install -r requirements.txt
# 基础扫描
python3 dirsearch.py -u http://target.com/
# 带扩展名扫描(Web 题常用 .php / .txt / .html / .bak)
python3 dirsearch.py -u http://target.com/ -e php,txt,html,bak,zip,sql
# 指定字典
python3 dirsearch.py -u http://target.com/ -w /usr/share/wordlists/dirb/common.txt
# 多线程加速
python3 dirsearch.py -u http://target.com/ -t 50
# 输出到文件
python3 dirsearch.py -u http://target.com/ -o result.txtgobuster(极速扫描)
# 安装
# 安装 gobuster:用包管理器或从 GitHub 获取(Arch)
go install github.com/OJ/gobuster/v3@latest # Go
# 目录扫描
gobuster dir -u http://target.com/ -w /usr/share/wordlists/dirb/common.txt
# 指定扩展名
gobuster dir -u http://target.com/ -w /usr/share/wordlists/dirb/common.txt -x php,txt,html
# 指定状态码过滤
gobuster dir -u http://target.com/ -w /usr/share/wordlists/dirb/common.txt -s 200,301,403curl 手动探测常用隐藏路径
# CTF 题中 flag 常见的几个隐藏路径
for path in robots.txt flag.txt flag.php admin.php .git/HEAD .svn/entries backup/ www.zip index.html.bak; do
code=$(curl -s -o /dev/null -w "%{http_code}" "http://target.com/$path")
[ "$code" != "404" ] && echo " [$code] $path"
done通用字典路径
| 字典 | 说明 |
|---|---|
/usr/share/wordlists/dirb/common.txt | 基础字典(约 4600 条) |
/usr/share/wordlists/dirb/big.txt | 大字典(约 20000 条) |
| CTFHub 附件字典 | 部分 CTFHub 题目提供配套字典 |
| 自编字典 | 根据题目线索手写(如 admin、flag、secret、api) |
字典目录爆破的核心心法
先猜后爆:拿到 Web 题 → 先手动试几个常见路径(robots.txt、flag、admin、index.php、备份)→ 再上工具跑。因为 CTF 题的隐藏路径往往是手工能猜到的那几个,用工具跑大字典反而浪费时间。