dirsearch安装和使用[通俗易懂]

dirsearch安装和使用[通俗易懂]目录dirsearch介绍下载及安装如何使用简单用法递归扫描线程前缀/后缀黑名单筛选器原始请求Wordlist格式排除扩展扫描子目录代理报告其他命令小贴士选项选项强制性字典设置一般设置请求设置连接设置配置dirsearch介绍dirsearch是一个基于python3的命令行工具,常用于暴力扫描页面结构,包括网页中的目录和文件。相比其他扫描工具disearch的特点是:支持HTTP……

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE稳定放心使用

目录

dirsearch介绍

下载及安装

如何使用

简单用法

递归扫描

线程

前缀/后缀

黑名单

筛选器

原始请求

Wordlist格式

排除扩展

扫描子目录

代理

报告

其他命令

小贴士

选项

选项

强制性

字典设置

一般设置

请求设置

连接设置

配置

dirsearch介绍

        dirsearch是一个基于python3的命令行工具,常用于暴力扫描页面结构,包括网页中的目录和文件。相比其他扫描工具disearch的特点是:

  • 支持HTTP代理
  • 多线程
  • 支持多种形式的网页(asp,php)
  • 生成报告(纯文本,JSON)
  • 启发式检测无效的网页
  • 递归扫描
  • 用户代理随机化
  • 批量处理
  • 扫描器与字典(注:字典必须是文本文件)

下载及安装

        要求:python 3.7或更高版本 

        其中,db文件夹为自带字典文件夹;reports为扫描日志文件夹;dirsearch.py为主程序文件 

使用Git安装

git clone https://github.com/maurosoria/dirsearch.git

使用ZIP文件安装

https://github.com/maurosoria/dirsearch/archive/master.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代理功能,请安装带有**Requirements.txt**的包:

pip3 install -r requirements.txt

一起安装:

git clone https://github.com/maurosoria/dirsearch.git
cd dirsearch
pip3 install -r requirements.txt

如何使用

演示视频:https://asciinema.org/a/380112.svg

地址:https://asciinema.org/a/380112

简单用法

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

递归扫描

-通过使用**-r–recursive**参数,dirsearch将强制递归所有目录。

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

可以用**–recursion-depth**设置最大递归深度,用**–recursion-status**设置递归状态代码

python3 dirsearch.py -e php,html,js -u https://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 https://target -t 20

前缀/后缀

–prefixes:为所有条目添加自定义前缀

python3 dirsearch.py -e php -u https://target --prefixes .,admin,_

基础路径:

        tools

加上前缀后:

         .tools
          admintools
        _tools

–suffixes:为所有条目添加自定义后缀

python3 dirsearch.py -e php -u https://target --suffixes ~

基础路径:

        index.php
        internal

加上后缀后:

         index.php~
        internal~

黑名单

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

示例:如果将`admin.php`添加到`db/403_blacklist.txt`中,那么每当进行扫描时,`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 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-content /error.html

原始请求

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

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

因为dirsearch无法知道URI方案是什么,所以需要使用’–scheme’标志来设置它。默认情况下,该方案是’HTTP’,这会导致大量的假阴性。

Wordlist格式

支持的wordlist格式:uppercase, lowercase, capitalization

Lowercase

        admin
        index.html

Uppercase:

        ADMIN
        INDEX.HTML

Capital

        Admin
        Index.html

排除扩展

使用**-x–exclude-extensions**扩展列表将删除wordlist中包含给定扩展的所有路径

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

基础路径:

        admin.php
        test.jsp

排除扩展后:

        admin.php

-如果要排除所有扩展名,除了在’-e’标志中选择的扩展名之外,请使用**–only-selected**

python3 dirsearch.py -e html -u https://target --only-selected

基础路径:

        index.html
        admin.php

排除扩展后:

        index.html

扫描子目录

-从URL中,你可以用**–subdirs**扫描子目录列表。

python3 dirsearch.py -e php,html,js -u https://target --subdirs admin/,folder/,/

-反向版本是**–exclude-subdirs**,它阻止dirsearch递归扫描给定的子目录。

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

代理

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

报告

支持的报表格式:**Simple**、**Plain**、**JSON**、**XML**、**MD**、**CSV**、**HTML**

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

其他命令

        有更多的功能,你需要自己去发现

python3 dirsearch.py -u https://target -t 100 -m POST --data "username=admin"

python3 dirsearch.py -u https://target --random-agent --cookie "isAdmin=1" -F

python3 dirsearch.py -u https://target --format json -o target.json

python3 dirsearch.py -u https://target --auth admin:pass --auth-type basic

python3 dirsearch.py -u https://target --header-list rate-limit-bypasses.txt

python3 dirsearch.py -u https://target -q --stop-on-error --max-time 360

python3 dirsearch.py -u https://target --full-url --max-rate 100

python3 dirsearch.py -u https://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
                        通过重定向正则表达式或文本排除响应,用逗号分隔(例如:'https://okta.com/*')
    --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=METHOD
                        HTTP方法(默认值:GET)
    -d DATA, --data=DATA
                        HTTP请求数据
    -H HEADERS, --header=HEADERS
                        HTTP请求头,支持多个标志(例如:-H 'Referer: example.com')
    --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标志的默认值:`Default.conf`

# 如果要编辑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 = db/dicc.txt

[request]
httpmethod = get
## Lowercase only
follow-redirects = False
# headers-file = headers.txt
# 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 = proxies.txt
# replay-proxy = localhost:8000

文章内容出处:dirsearch安装包中的README.md文件,是英文版的,我用翻译工具翻译整理的,有任何问题和错误的地方欢迎指正,谢谢。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/185438.html原文链接:https://javaforall.net

(0)
上一篇 2022年10月6日 上午8:16
下一篇 2022年10月6日 上午8:36


相关推荐

  • LTE TDD和FDD介绍

    LTE TDD和FDD介绍1 对于这个问题 首先明确什么是 LTE nbsp nbsp nbsp nbsp nbsp nbsp 随着移动通信技术的蓬勃发展 无线通信系统呈现出移动化 宽带化和 IP 化的趋势 移动通信市场的竞争也日趋激烈 为应对来自 WiMAX Wi Fi 等传统和新兴无线宽带接入技术的挑战 提高 3G 在宽带无线接入市场的竞争力 3GPP 开展 UTRA 长期演进 LongTermEvol LTE 技术的研究 以实现 3G 技术向 B3G 和 4

    2026年3月18日
    2
  • sqlserver数据库同步工具_sql server数据库安装

    sqlserver数据库同步工具_sql server数据库安装 一、确认数据库运行环境是否配置正确打开SQLServerManagementStudio,新建查询: select*fromsys.servers GO //这里可得到原来的计算机名称。然后将其记录下来(复制即可)  看这里的name是否和你的服务器的计算机名称一样,如果一样可以跳到文档(二),否则请按如下操作更改 新建查询:

    2022年10月10日
    8
  • DatabaseMetaData 接口

    DatabaseMetaData 接口  DatabaseMetaData接口DatabaseMetaData接口作为整体提供有关数据库的综合信息。其中某些方法采用“字符串”自变量作为目录和模式名称。DB2Everyplace忽略这些自变量。此处的某些方法以ResultSet对象的格式返回信息列表。可以使用正常ResultSet方法(如getString和getInt)来从这些Res

    2022年6月19日
    35
  • Midjourney绘画风格有哪些 Midjourney绘画风格指令整理

    Midjourney绘画风格有哪些 Midjourney绘画风格指令整理

    2026年3月15日
    2
  • 计算机怎么建立共享网络打印机共享,电脑如何连接局域网中的共享打印机—两种方法…

    计算机怎么建立共享网络打印机共享,电脑如何连接局域网中的共享打印机—两种方法…多台电脑而只有一台打印机的时候可以通过连接局域网的方式共享打印机 这样就不需要给每一台电脑都配上打印机了 下面是学习啦小编收集整理的电脑如何连接局域网中的共享打印机 两种方法 希望对大家有帮助 电脑连接局域网中的共享打印机 两种方法操作方法 01 在配备了打印机的电脑上进行打印机共享设置 点击开始菜单栏 02 点击 设备和打印机 03 找到该电脑所配备的打印机并右击 04 点击 打印机属性 05 点击

    2026年3月19日
    1
  • freopen无法读取问题

    freopen无法读取问题练习 PAT 时采用 freopen 编程输出文件内容不正确 nbsp nbsp freopen E Dev Cpp PAT basic 1032 1032in txt r stdin nbsp nbsp nbsp freopen E Dev Cpp PAT basic 1032 1032out txt w stdout 刚开始以为是代码问题 nbsp 手动终端输入输出无问题修了半天 bug 竟是文件

    2026年3月18日
    2

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号