一、dirsearch 是什么?
dirsearch 是一款用 Python 编写的 Web 目录/文件扫描工具,常用于安全测试中发现:
- 隐藏目录(
/admin/、/backup/)
- 敏感文件(
.git/、.env、config.php)
- 备份、接口、历史文件等
👉 本质:暴力枚举 Web 路径
二、dirsearch 获取方式(安装)
方式 1:GitHub 官方(推荐)
git clone https://github.com/maurosoria/dirsearch.git cd dirsearch
|
方式 2:直接用 pip(部分系统)
方式 3:Kali Linux(自带)
三、运行前准备
Python 版本
安装依赖(如果报错)
pip3 install -r requirements.txt
|
四、最基本使用方式
1️⃣ 扫描一个网站
python3 dirsearch.py -u http://example.com
|
2️⃣ 扫描 HTTPS
python3 dirsearch.py -u https://example.com
|
五、常用参数(重点)
🔹 指定扩展名(非常重要)
-e php,asp,aspx,jsp,html,js,zip
|
示例:
python3 dirsearch.py -u http://example.com -e php,html,js
|
🔹 指定字典
示例:
python3 dirsearch.py -u http://example.com -w db/dicc.txt
|
dirsearch 自带字典位置:
🔹 多线程(加快速度)
示例:
python3 dirsearch.py -u http://example.com -t 50
|
🔹 排除状态码
🔹 排除指定长度(过滤假 200)
--exclude-sizes 1234,5678
|
🔹 保存结果
六、常见实战组合(推荐直接用)
🔥 常规扫描
python3 dirsearch.py -u http://example.com -e php,html,js -t 50
|
🔥 后台/接口扫描
python3 dirsearch.py -u http://example.com -e php,asp,aspx -w db/admin.txt
|
🔥 扫描备份文件
python3 dirsearch.py -u http://example.com -e zip,rar,tar,gz,bak,old
|
🔥 API 扫描
python3 dirsearch.py -u http://example.com/api -e json -w db/api.txt
|
七、结果怎么看?
示例输出:
[200] /admin/ [403] /config/ [200] /backup.zip
|
含义:
- 200:可访问(重点)
- 403:存在但禁止访问(有价值)
- 301/302:重定向(可能是后台)
- 404:不存在(忽略)
八、常见坑 & 建议
⚠️ 注意事项
- 不要盲目 200 = 真目录(注意假 200)
- 搭配浏览器 / Burp 复查
- 多换字典,效果差距很大
✅ 提升命中率技巧
- 指定扩展名
- 自定义字典(结合目标语言)
- 先扫
/admin、/api、/test