目录
dirsearch介绍
下载及安装
如何使用
简单用法
递归扫描
线程
前缀/后缀
黑名单
筛选器
原始请求
Wordlist格式
排除扩展
扫描子目录
代理
报告
其他命令
小贴士
选项
选项
强制性
字典设置
一般设置
请求设置
连接设置
配置
dirsearch是一个基于python3的命令行工具,常用于暴力扫描页面结构,包括网页中的目录和文件。相比其他扫描工具disearch的特点是:
要求:python 3.7或更高版本
其中,db文件夹为自带字典文件夹;reports为扫描日志文件夹;dirsearch.py为主程序文件
使用Git安装
git clone .git
使用ZIP文件安装
.zip
使用Docker安装
详细信息:GitHub - maurosoria/dirsearch: Web path scanner
Docker build-t“dirsearch:v0.4.1
使用Kali Linux安装
sudo apt-get Install dirsearch
使用PYPI安装
PIP3 Install DirSearch
注意:*若要使用SOCKS代理功能,请安装带有****的包:
pip3 install -
一起安装:
git clone .git
cd dirsearch
pip3 install -
演示视频:.svg
地址:
python3 dirsearch.py -u targetpython3 dirsearch.py -e php,html,js -u targetpython3 dirsearch.py -e php,html,js -u target -w /path/to/wordlist
-通过使用**-r--recursive**参数,dirsearch将强制递归所有目录。
python3 dirsearch.py -e php,html,js -u target -r
可以用**--recursion-depth**设置最大递归深度,用**--recursion-status**设置递归状态代码
python3 dirsearch.py -e php,html,js -u target -r --recursion-depth 3 --recursion-status 200-399
还有2个选项:**--force-recursive**和**--deep-recursive**
force-recursive(强制递归):强力递归所有找到的路径,而不仅仅是以`/`结尾的路径
deep-recursive(深度递归):递归强力路径的所有深度(`a/b/c`=>add`a/`,`a/b/`)
线程数(**-t | --threads**)反映了分离的强力进程的数量。因此,线程数越大,dirsearch运行得越快。默认情况下,线程数为30,但如果想加快进度,可以增加。
尽管如此,速度仍然在很大程度上取决于服务器的响应时间。作为警告,建议保持线程数不要太大,因为这可能导致DOS。
python3 dirsearch.py -e php,htm,js,bak,zip,tgz,txt -u target -t 20
--prefixes:为所有条目添加自定义前缀
python3 dirsearch.py -e php -u target --prefixes .,admin,_
基础路径:
tools
加上前缀后:
.tools
admintools
_tools
--suffixes:为所有条目添加自定义后缀
python3 dirsearch.py -e php -u target --suffixes ~
基础路径:
index.php
internal
加上后缀后:
index.php~
internal~
在'db/'文件夹内,有几个“黑名单文件”。如果这些文件中的路径与文件名中提到的状态相同,则将从扫描结果中筛选这些文件中的路径。
示例:如果将`admin.php`添加到`db/`中,那么每当进行扫描时,`admin.php`返回403,就会从结果中筛选出来。
使用**-i-include-status**和**-x-exclude-status**选择允许和不允许响应状态代码
更高级的过滤器:**--exclude-sizes**、**--exclude-texts**、**--exclude-regexps**、**--exclude-redirects**和**--exclude-content**
python3 dirsearch.py -e php,html,js -u target --exclude-sizes 1B,243KBpython3 dirsearch.py -e php,html,js -u target --exclude-texts "403 Forbidden"python3 dirsearch.py -e php,html,js -u target --exclude-regexps "^Error$"python3 dirsearch.py -e php,html,js -u target --exclude-redirects "(.*).okta/*"python3 dirsearch.py -e php,html,js -u target --exclude-content /error.html
dirsearch允许您从文件中导入原始请求。内容如下所示:
GET /admin HTTP/1.1
Host: ample
Cache-Control: max-age=0
Accept: */*
因为dirsearch无法知道URI方案是什么,所以需要使用'--scheme'标志来设置它。默认情况下,该方案是'HTTP',这会导致大量的假阴性。
支持的wordlist格式:uppercase, lowercase, capitalization
Lowercase
admin
index.html
Uppercase:
ADMIN
INDEX.HTML
Capital
Admin
Index.html
使用**-x--exclude-extensions**扩展列表将删除wordlist中包含给定扩展的所有路径
python3 dirsearch.py -u target -X jsp
基础路径:
admin.php
test.jsp
排除扩展后:
admin.php
-如果要排除所有扩展名,除了在'-e'标志中选择的扩展名之外,请使用**--only-selected**
python3 dirsearch.py -e html -u target --only-selected
基础路径:
index.html
admin.php
排除扩展后:
index.html
-从URL中,你可以用**--subdirs**扫描子目录列表。
python3 dirsearch.py -e php,html,js -u target --subdirs admin/,folder/,/
-反向版本是**--exclude-subdirs**,它阻止dirsearch递归扫描给定的子目录。
python3 dirsearch.py -e php,html,js -u target --recursive --exclude-subdirs image/,css/
dirsearch支持SOCKS和HTTP代理,有两个选项:代理服务器或代理服务器列表。
python3 dirsearch.py -e php,html,js -u target --proxy 127.0.0.1:8080python3 dirsearch.py -e php,html,js -u target --proxy socks5://10.10.0.1:8080python3 dirsearch.py -e php,html,js -u target --
支持的报表格式:**Simple**、**Plain**、**JSON**、**XML**、**MD**、**CSV**、**HTML**
python3 dirsearch.py -e php - --format plain -python3 dirsearch.py -e php -u target --format html -o target.json
有更多的功能,你需要自己去发现
python3 dirsearch.py -u target -t 100 -m POST --data "username=admin"python3 dirsearch.py -u target --random-agent --cookie "isAdmin=1" -Fpython3 dirsearch.py -u target --format json -o target.jsonpython3 dirsearch.py -u target --auth admin:pass --auth-type basicpython3 dirsearch.py -u target --python3 dirsearch.py -u target -q --stop-on-error --max-time 360python3 dirsearch.py -u target --full-url --max-rate 100python3 dirsearch.py -u target --remove-extensions
-服务器有请求限制?这很糟糕,但是可以通过使用'--proxy-list'随机化proxy来绕过它
-想找出配置文件或备份吗?尝试`--suffixes ~`和`--prefixes .`
-只想查找文件夹/目录?为什么不结合'--remove-extensions'和'--suffixes/`!
- The mix of `--cidr`, `-F`, `-q` and will reduce most of noises + false negatives when brute-forcing with a CIDR
-扫描一个网址列表,但不想看到一个429 flood?`--Skip-on-Status 429`将帮助您在返回429时跳过目标
-服务器包含会减慢扫描速度的大文件?您可能希望使用`head`HTTP方法而不是`get`
-Brute-forcing CIDR慢?可能您忘了减少请求超时和请求重试。建议:`--timeout 3 --retries 1`
用法:dirsearch.py [-u|--url] target [-e|--extensions] extensions [options]
--version 显示程序的版本号和退出-h, --help 显示此帮助消息并退出
-u URL, --url=URL 目标URL-l FILE, --url-list=FILE目标URL列表文件--stdin 来自STDIN的目标URL列表--cidr=CIDR CIDR目标--raw=FILE 文件从文件加载原始HTTP请求(使用`--Scheme`标志设置方案)-e EXTENSIONS, --extensions=EXTENSIONS用逗号分隔的扩展列表(例如:php、asp)-X EXTENSIONS, --exclude-extensions=EXTENSIONS排除用逗号分隔的扩展名列表(例如:asp、jsp)-f, --force-extensions为每个wordlist条目添加扩展名。默认情况下dirsearch仅将%ext%关键字替换为扩展
-w WORDLIST, --wordlists=WORDLIST自定义Wordlist(用逗号分隔)--prefixes=PREFIXES为所有wordlist条目添加自定义前缀(分开按逗号)--suffixes=SUFFIXES将自定义后缀添加到所有wordlist条目,忽略目录(用逗号分隔)--only-selected 移除路径的扩展名与选定的不同通过`-e`的(保留条目没有扩展名)--remove-extensions删除所有路径中的扩展(例如: admin.php -> admin)-U, --uppercase Uppercase wordlist-L, --lowercase Lowercase wordlist-C, --capital Capital wordlist
-t THREADS, --threads=THREADS线程数-r, --recursive 蛮力递归--deep-recursive 对每个目录深度执行递归扫描(例如: api/users -> api/)--force-recursive 每个找到的路径做递归蛮力,而不是只有路径以斜杠结尾--recursion-depth=DEPTH最大递归深度--recursion-status=CODES执行递归扫描的有效状态代码,支持范围(用逗号分隔)--subdirs=SUBDIRS 扫描给定URL[s]的子目录(由逗号)--exclude-subdirs=SUBDIRS在递归过程中排除以下子目录扫描(用逗号分隔)-i CODES, --include-status=CODES包括状态代码,以逗号分隔,支持范围(例如:200,300-399)-x CODES, --exclude-status=CODES排除状态代码,用逗号分隔,支持范围(例如:301,500-599)--exclude-sizes=SIZES按大小排除响应,用逗号分隔(例如:123B,4KB)--exclude-texts=TEXTS按文本排除答复,用逗号分隔(例如:'not found'、'error')--exclude-regexps=REGEXPS用逗号分隔的正则表达式排除响应(例如:“not foun[a-z]{1}”,“^error$”)--exclude-redirects=REGEXPS通过重定向正则表达式或文本排除响应,用逗号分隔(例如:'/*')--exclude-content=PATH按此路径的响应内容排除响应--skip-on-status=CODES只要击中其中一个状态代码,就跳过目标,用逗号分隔,支持ranges--minimal=LENGTH 最小响应长度--maximal=LENGTH 最大响应长度--max-time=SECONDS 扫描的最大运行时间-q, --quiet-mode 安静模式--full-url 输出中的完整URL(在安静模式)--no-color 无彩色无彩色输出
-m METHOD, --http-method=METHODHTTP方法(默认值:GET)-d DATA, --data=DATAHTTP请求数据-H HEADERS, --header=HEADERSHTTP请求头,支持多个标志(例如:-H 'Referer: example')--header-list=FILE 文件包含HTTP请求头-F, --follow-redirects遵循HTTP重定向--random-agent 为每个请求选择一个随机用户代理--auth-type=TYPE 身份验证类型 (basic, digest, bearer, ntlm)--auth=CREDENTIAL 身份验证凭证 (user:password or bearer token)--user-agent=USERAGENT--cookie=COOKIE
--timeout=TIMEOUT 超时连接超时-s DELAY, --delay=DELAY请求之间的延迟--proxy=PROXY 代理URL,支持HTTP和SOCKS代理(例如:localhost:8080,socks5://localhost:8088)--proxy-list=FILE 文件包含代理服务器--replay-proxy=PROXY使用找到的路径重播的代理--scheme=SCHEME 默认方案(对于原始请求或如果没有URL中的方案)--max-rate=RATE 每秒最大请求数--retries=RETRIES 重试失败请求的重试次数-b, --request-by-hostname默认情况下,dirsearch按IP请求速度。这个将强制dirsearch按主机名请求--ip=IP 每当发生错误就退出报告:-o FILE, --output=FILE输出文件--format=FORMAT format报表格式(可用:simple、plain、json、xml,md,csv,html)
可以在配置文件中编辑dirsearch标志的默认值:f`
# 如果要编辑dirsearch默认配置,可以编辑此文件中的值。'#'后面的一切都是注释并且不会被应用[mandatory]
default-extensions = php,aspx,jsp,html,js
force-extensions = False
# exclude-extensions = old,log[general]
threads = 30
recursive = False
deep-recursive = False
force-recursive = False
recursion-depth = 0
exclude-subdirs = %%ff/
random-user-agents = False
max-time = 0
full-url = False
quiet-mode = False
color = True
recursion-status = 200-399,401,403
# include-status = 200-299,401
# exclude-status = 400,500-999
# exclude-sizes = 0b,123gb
# exclude-texts = "Not found"
# exclude-regexps = "403 [a-z]{1,25}"
# exclude-content = 404.html
# skip-on-status = 429,999[reports]
report-format = plain
autosave-report = True
# report-output-folder = /home/user
# logs-location = /tmp
## Supported: plain, simple, json, xml, md, csv, html[dictionary]
lowercase = False
uppercase = False
capitalization = False
# prefixes = .,admin
# suffixes = ~,.bak
# wordlist = [request]
httpmethod = get
## Lowercase only
follow-redirects = False
# headers-file =
# user-agent = MyUserAgent
# cookie = SESSIONID=123[connection]
timeout = 5
delay = 0
scheme = http
maxrate = 0
retries = 2
request-by-hostname = False
exit-on-error = False
# proxy = localhost:8080
# proxy-list =
# replay-proxy = localhost:8000
文章内容出处:dirsearch安装包中的README.md文件,是英文版的,我用翻译工具翻译整理的,有任何问题和错误的地方欢迎指正,谢谢。
本文发布于:2024-01-31 22:07:40,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170671006131692.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |