dirsearch 目录扫描
大约 3 分钟
提示
因为dirsearch需要3.7或更高版本的python,所以需要先解决环境问题
Windows直接下载高版本的python安装即可,Centos7参考以下方法
源码安装python
一、安装开发者工具编译器和依赖
yum -y groupinstall "Development tools"
yum install -y bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel psmisc libffi-devel
二、安装SSL模块
下载最新版源码解压
https://www.openssl.org/source/openssl-1.1.1s.tar.gz
tar -zxf openssl-1.1.1s.tar.gz;cd openssl-1.1.1s
./config --prefix=/usr/local/openssl
make && make install
#替换掉旧版本的openssl
mv /usr/bin/openssl /usr/bin/openssl.old
mv /usr/lib64/openssl /usr/lib64/openssl.old
mv /usr/lib64/libssl.so /usr/lib64/libssl.so.old
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/openssl/include/openssl /usr/include/openssl
ln -s /usr/local/openssl/lib/libssl.so /usr/lib64/libssl.so
echo "/usr/local/openssl/lib" >> /etc/ld.so.conf
ldconfig -v
#查看openssl版本
openssl version
三、安装Python
下载python源码,然后上传到centos7服务器上
https://www.python.org/ftp/python/3.7.10/Python-3.7.10.tgz
tar -xzf Python-3.7.10.tgz
mkdir /usr/local/python3/
cd Python-3.7.10
make clean
./configure --with-openssl=/usr/local/openssl --prefix=/usr/local/python3
make && make install
三、替换旧版本设置
rm -f /usr/bin/python3
rm -f /usr/bin/pip
ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3.7 /usr/bin/pip
安装dirsearch
将dirsearch的压缩包上传到服务器解压
unzip dirsearch-0.4.3.zip;rm -rf dirsearch-0.4.3.zip
mv dirsearch-0.4.3/ dirsearch;cd dirsearch
pip install setuptools -i https://pypi.tuna.tsinghua.edu.cn/simple
python3 setup.py install
设置不用python前缀,在系统的任何目录都能直接使用
ln -s /hack/dirsearch/dirsearch.py /usr/bin/dirsearch
使用方法
简单扫描
dirsearch -u http://xxx.com/
dirsearch -u http://xxx.com/ -t 99 -x 404
常用选项
-u #指定目标URL
-l #指定目标URL列表文件,多个站点一起扫描
-w #指定字典文件,多个字典用逗号分隔
-e #指定扩展 -e php,jsp,asp,html,js
-t #设置线程 默认25
-m #HTTP请求方法,默认GET
-x #排除某种HTTP状态码
--delay=DELAY #每个请求之间延时
--proxy=PROXY #设置代理
--proxy-auth=xx #代理凭证
--retries=RETRIES#请求失败重试次数
--crawl #在响应中抓取新路径
-o PATH #输出文件路径
--format=FORMAT #报告格式,simple, plain, json, xml,md, csv, html, sqlite
使用代理(Clash)
因为目录扫描属于明显的攻击行为,经常会被WAF拦截封禁IP,所以代理是至关重要的。
这里介绍的是使用clash让系统全局代理
软件下载地址:https://github.com/Dreamacro/clash/releases
1)初始化安装
将下载压缩包解压(用7zip这个工具),把可执行的二进制PE文件上传到服务器
#给上传的文件添加可执行权限
chmod +x clash
#启动clash,同时会生成配置文件并自动下载Country.mmdb文件
./clash -d .
2)图形化管理页面
使用外部控制管理 http://clash.razord.top/#/proxies
#config.yaml
mode: Global
mixed-port: 7890 #混合代理端口 http和socks
external-controller: '0.0.0.0:9999' #外部管理监听
secret: 'xx1234' #外部管理监听的密钥
#具体的代理服务器也是在这里配置,参考Windows下的配置文件即可
3)开启Linux系统代理
让http和https的流量都经过代理转发
#这是临时的,只在当前终端管用
export proxy="http://127.0.0.1:7890"
export http_proxy=$proxy
export https_proxy=$proxy
export ftp_proxy=$proxy
export no_proxy="localhost, 127.0.0.1, ::1"
#取消代理
unset http_proxy
unset https_proxy
unset ftp_proxy
unset no_proxy
#验证代理可用否
curl cip.cc
4)Clash作为服务运行
cat > /etc/systemd/system/clash.service <<EOF
[Unit]
Description=Clash daemon.
After=network.target
[Service]
Type=simple
Restart=always
ExecStart=/root/Pentest_Tools/Clash/clash -d /root/Pentest_Tools/Clash
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable clash
systemctl start clash
目录字典
目录字典位置 db/dicc.txt
默认自带的字典已经很好了,也可以和其它字典进行组合去重后扩展字典范围。
#自带的字典有9000多行
[root@VM-4-5-centos db]# wc -l dicc.txt
9482 dicc.txt