目录爆破 — 工具配置

Web 题开放了端口但页面是空的?先试试目录爆破——flag 可能藏在某个隐藏目录里。

核心工具

工具语言特点
dirsearchPython最常用、速度快、结果美观
gobusterGo极快、并发强、无依赖
ffufGo速度最快、FUZZ 全场景
dirbC经典老牌

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.txt

gobuster(极速扫描)

# 安装
# 安装 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,403

curl 手动探测常用隐藏路径

# 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 题目提供配套字典
自编字典根据题目线索手写(如 adminflagsecretapi

字典目录爆破的核心心法

先猜后爆:拿到 Web 题 → 先手动试几个常见路径(robots.txtflagadminindex.php备份)→ 再上工具跑。因为 CTF 题的隐藏路径往往是手工能猜到的那几个,用工具跑大字典反而浪费时间。

关联教程

此文件夹下有1条笔记。