Dirsearch的下载、安装和使用(全)

目录

介绍

安装与使用

单词列表(重要)

选项

基本参数

进阶参数

报告参数

其他参数

如何使用

简单使用

暂停进度

递归

线程

前缀/后缀

黑名单

过滤器

原始请求

单词列表格式

排除扩展

扫描子目录

代理

报告

更多示例命令

支持 Docker

安装 Docker Linux

构建映像目录搜索

使用 dirsearch


免责声明

本文所提供的文字和信息仅供学习和研究使用,请读者自觉遵守法律法规,不得利用本文所提供的信息从事任何违法活动。本文不对读者的任何违法行为承担任何责任。工具来自网络,安全性自测,如有侵权请联系删除。

注意:Dirsearch 这样的工具在合法的安全测试和研究环境之外的使用可能是非法的和不道德的。在实际应用中,应该在授权和合法的情况下使用它来帮助发现和修复系统中的安全漏洞,以提高系统的安全性。

介绍

dirsearch 是一个python开发的目录扫描工具。和御剑之类的工具类似,用于扫描网站的敏感文件和目录从而找到突破口。dirsearch可以在Windows上安装使用,也可以在kali直接安装使用。

安装与使用

要求:python 3.7 或更高版本(点击此处查看如何安装Python

选择以下安装选项之一:

使用 git 安装:

git clone https://github.com/maurosoria/dirsearch.git --depth 1

使用 Docker 安装:(更多信息可以在这里找到)

docker build -t "dirsearch:v0.4.3" 

使用 PyPi 安装:

pip3 install dirsearch
或
pip install dirsearch

使用 Kali Linux 安装:

sudo apt-get install dirsearch

使用 ZIP 文件安装:在此处下载

将dirsearch-master.zip下载到桌面解压即可,将解压的zip文件放入python文件目录下或者在D盘新建一个dirsearch文件夹都可

在dirsearch-master目录下打开命令行(单击箭头指的地方输入cmd)

在命令行中输入如下命令+回车即可完成dirsearch的安装

python setup.py install

验证安装,输入 pyhton dirsearch.py -h 出现帮助信息就安装成功了

在Linux使用,输入 dirsearch 参数 即可

单词列表(重要)

总结:

  • Wordlist 是一个文本文件,每一行都是一个路径。
  • 关于扩展,与其他工具不同,dirsearch 仅将关键字替换为 -e 标志中的扩展。%EXT%
  • 对于没有(如 SecLists)的单词列表,需要 -f | --force-extensions 开关才能将扩展名附加到 wordlist 中的每个单词,以及 .%EXT%/
  • 要将扩展名应用于已有扩展名的单词列表条目,请使用 -O |--overwrite-extensions(注意:某些扩展被排除在覆盖之外,例如 .log.json.xml、...或媒体扩展,如 .jpg.png)
  • 要使用多个单词表,您可以用逗号分隔单词表。例:。wordlist1.txt,wordlist2.txt

例子:

  • 普通扩展
index.%EXT%

aspaspx 作为扩展传递将生成以下字典:

index
index.asp
index.aspx
  • 力扩展
admin

使用 -f/--force-extensions 标志将 phphtml 作为扩展传递将生成以下字典:

admin
admin.php
admin.html
admin/
  • 覆盖扩展:
login.html

使用 -O/--overwrite-extensions 标志将 jspjspa 作为扩展传递将生成以下字典:

login.html
login.jsp
login.jspa

选项

基本参数

mandatory 必选参数
-u URL, --url=URL                        指定目标URL。
-e EXTENSIONS, --extensions=EXTENSIONS   指定网站语言,一般用-e*即所有语言
-i	  保留响应状态码(不同状态码用逗号分隔,可指定范围,如-i 200,300-400)
-x	  排除响应状态码(不同状态码用逗号分隔,可指定范围,如-x 400,400-500)

Dictionary Settings 字典设置
-w WORDLIST, --wordlist=WORDLIST         自定义字典文件路径。
-f, --force-extensions                   在每个单词表条目后添加扩展名。
-O, --overwrite-extensions               使用特定扩展名覆盖字典中的其他扩展名。
--exclude-extensions=EXTENSIONS          排除特定扩展名。

General Settings 常规设置
-t THREADS, --threads=THREADS            线程数。
-r, --recursive                          递归爆破。
-R DEPTH, --max-recursion-depth=DEPTH    最大递归深度。
--subdirs=SUBDIRS                        扫描子目录。
--exclude-subdirs=SUBDIRS                排除特定子目录。

Request Settings 请求设置
-m METHOD, --http-method=METHOD          HTTP方法(默认: GET)。
-d DATA, --data=DATA                     HTTP请求数据。
-H HEADERS, --header=HEADERS             HTTP请求头。
-F, --follow-redirects                   跟随HTTP重定向。

Connection Settings  连接设置
--timeout=TIMEOUT                        连接超时。
--proxy=PROXY, --http-proxy=PROXY        代理服务器地址。

Output Settings 输出设置
-o OUTPUT_FILE, --output=OUTPUT_FILE     输出文件。
--format=FORMAT                          报告格式。

进阶参数

--delay=DELAY  							请求之间的延迟。
--exclude-status=EXCLUDE_STATUS_CODES   排除特定状态码。
--exclude-sizes=SIZES                   按大小排除响应。
--exclude-text=TEXTS                    排除特定文本响应。
--exclude-regex=REGEXPS                 按正则表达式排除响应。

报告参数

--simple-report=SIMPLE_OUTPUT_FILE          只输出发现的路径。
--plain-text-report=PLAIN_TEXT_OUTPUT_FILE  输出带有状态代码的路径。
--json-report=JSON_OUTPUT_FILE              输出JSON格式的报告。

其他参数

--version  显示程序版本号并退出。
--help     显示帮助信息并退出。

如何使用

如何使用 dirsearch 的一些示例 - 这些是最常见的参数。如果您需要所有参数,只需使用 -h 参数即可。

简单使用

python3 dirsearch.py -u https://target
python3 dirsearch.py -e php,html,js -u https://target
python3 dirsearch.py -e php,html,js -u https://target -w /path/to/wordlist

暂停进度

dirsearch 允许您使用 CTRL+C 暂停扫描进度,从这里可以保存进度(稍后继续)、跳过当前目标或跳过当前子目录。

递归

递归暴力破解是在找到的目录之后连续进行暴力破解。例如,如果 dirsearch 找到 ,它将暴力破解( 是它暴力破解的地方)。要启用此功能,请使用 -r(或 --recursive)标志admin/admin/**

python3 dirsearch.py -e php,html,js -u https://target -r

您可以使用 --max-recursion-depth 设置最大递归深度,并使用 --recursion-status 设置递归状态代码

python3 dirsearch.py -e php,html,js -u https://target -r --max-recursion-depth 3 --recursion-status 200-399

还有 2 个选项:--force-recursive--deep-recursive

  • 力递归:暴力递归地找到所有找到的路径,而不仅仅是以/
  • 深度递归:递归暴力破解路径的所有深度 ( => add ,a/b/ca/a/b/)

如果存在不想以递归方式暴力破解的子目录,请使用 --exclude-subdirs

python3 dirsearch.py -e php,html,js -u https://target -r --exclude-subdirs image/,media/,css/

线程

线程数 (-t | --threads) 反映了分离的暴力进程的数量。因此,线程数越大,dirsearch 的运行速度就越快。默认情况下,线程数为 25 个,但如果您想加快进度,可以增加它。

尽管如此,速度仍然很大程度上取决于服务器的响应时间。作为警告,我们建议您保持线程数不要太大,因为它可能会导致 DoS(拒绝服务)。

python3 dirsearch.py -e php,htm,js,bak,zip,tgz,txt -u https://target -t 20

前缀/后缀

  • --prefixes:为所有条目添加自定义前缀
python3 dirsearch.py -e php -u https://target --prefixes .,admin,_

词汇表:

tools

使用前缀生成:

tools
.tools
admintools
_tools
  • --suffixes:为所有条目添加自定义后缀
python3 dirsearch.py -e php -u https://target --suffixes ~

词汇表:

index.php
internal

使用后缀生成:

index.php
internal
index.php~
internal~

黑名单

在文件夹中,有几个“黑名单文件”。如果这些文件中的路径具有与文件名中提到的相同状态,则将从扫描结果中筛选出这些路径。db/

示例:如果添加 ,则每当执行返回 403 的扫描时,都会从结果中筛选出该结果。admin.phpdb/403_blacklist.txtadmin.php

过滤器

使用 -i | --include-status-x | --exclude-status 选择允许和不允许的响应状态代码

对于更高级的过滤器:--exclude-sizes--exclude-texts--exclude-regexps--exclude-redirects--exclude-response

python3 dirsearch.py -e php,html,js -u https://target --exclude-sizes 1B,243KB
python3 dirsearch.py -e php,html,js -u https://target --exclude-texts "403 Forbidden"
python3 dirsearch.py -e php,html,js -u https://target --exclude-regexps "^Error$"
python3 dirsearch.py -e php,html,js -u https://target --exclude-redirects "https://(.*).okta.com/*"
python3 dirsearch.py -e php,html,js -u https://target --exclude-response /error.html

原始请求

dirsearch 允许您从文件导入原始请求。内容如下所示:

GET /admin HTTP/1.1
Host: admin.example.com
Cache-Control: max-age=0
Accept: */*

由于 dirsearch 无法知道 URI 方案是什么,因此需要使用标志进行设置。默认情况下,dirsearch 会自动检测该方案。--scheme

单词列表格式

支持的单词列表格式:大写、小写、大写

小写:

admin
index.html

大写:

ADMIN
INDEX.HTML

资本:

Admin
Index.html

排除扩展

-X | --exclude-extensions 与扩展名列表一起使用将删除包含给定扩展名的 wordlist 中的所有路径

python3 dirsearch.py -u https://target -X jsp

词库:

admin.php
test.jsp

后:

admin.php

扫描子目录

  • 从 URL 中,您可以使用 --subdirs 扫描子目录列表。
python3 dirsearch.py -e php,html,js -u https://target --subdirs /,admin/,folder/

代理

dirsearch 支持 SOCKS 和 HTTP 代理,有两个选项:代理服务器或代理服务器列表。

python3 dirsearch.py -e php,html,js -u https://target --proxy 127.0.0.1:8080
python3 dirsearch.py -e php,html,js -u https://target --proxy socks5://10.10.0.1:8080
python3 dirsearch.py -e php,html,js -u https://target --proxylist proxyservers.txt

报告

支持的报告格式:简单纯、jsonxmlmdcsvhtmlsqlite

python3 dirsearch.py -e php -l URLs.txt --format plain -o report.txt
python3 dirsearch.py -e php -u https://target --format html -o target.json

更多示例命令

cat urls.txt | python3 dirsearch.py --stdin
python3 dirsearch.py -u https://target --max-time 360
python3 dirsearch.py -u https://target --auth admin:pass --auth-type basic
python3 dirsearch.py -u https://target --header-list rate-limit-bypasses.txt

还有更多等着你去发现,试试吧!

支持 Docker

安装 Docker Linux

安装 Docker

curl -fsSL https://get.docker.com | bash

要使用 docker,您需要超级用户权限

构建映像目录搜索

创建映像

docker build -t "dirsearch:v0.4.3" .

dirsearch 是镜像的名称,v0.4.3 是版本

使用 dirsearch

对于使用

docker run -it --rm "dirsearch:v0.4.3" -u target -e php,html,js,zip


 

  • 43
    点赞
  • 40
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
下载安装dirsearch,你可以按照以下步骤进行操作: 1. 在Windows上安装dirsearch: - 首先,你需要在你的计算机上安装Python。你可以从官方网站https://www.python.org/downloads/下载安装最新版本的Python。 - 接下来,你需要下载dirsearch的压缩包。你可以从dirsearch的GitHub页面https://github.com/maurosoria/dirsearch下载压缩包。 - 解压缩下载的压缩包,并将其中的文件保存到你的计算机上的任意位置。 - 在Windows上,你可以在命令行界面中使用dirsearch。打开命令提示符,导航到dirsearch的目录,并运行dirsearch.py脚本。 2. 在Kali中安装dirsearch: - 在Kali Linux中,默认已经安装了Python。所以你不需要再次安装Python。 - 打开终端,并使用以下命令克隆dirsearch的GitHub仓库: ``` git clone https://github.com/maurosoria/dirsearch.git ``` - 进入克隆的目录: ``` cd dirsearch ``` - 现在,你可以在Kali Linux中使用dirsearch。在终端中运行dirsearch.py脚本。 请注意,无论你在Windows还是Kali Linux上安装dirsearch,你都需要确保已经安装了Python,并且正确地设置了Python的环境变量。这样你才能在命令行或终端中直接运行dirsearch。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [dirsearch安装(非常详细)和使用](https://blog.csdn.net/m0_73185293/article/details/131239309)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值