Arjun及dirsearch使用方式

Arjun

Arjun 是一款高效的 HTTP 参数发现工具,内置了庞大的参数字典,能够以极少的请求量快速找出 Web 应用中隐藏的查询参数。以下是 Arjun 的核心使用方法和常见场景:

1. 基础用法

  • 扫描单个 URL

    bash 复制代码
    arjun -u https://api.example.com/endpoint
  • 批量扫描(导入目标文件)
    支持从文本文件、Burp Suite 导出文件或原始请求文件中导入目标。

    bash 复制代码
    arjun -i targets.txt

2. 指定 HTTP 请求方法

默认情况下,Arjun 使用 GET 方法。您可以通过 -m 参数指定其他方法:

  • POST 请求arjun -u https://example.com/api -m POST
  • JSON 格式arjun -u https://example.com/api -m JSON
  • XML 格式arjun -u https://example.com/api -m XML

3. 性能与速率控制

  • 调整并发线程数 (默认为 2):

    bash 复制代码
    arjun -u https://example.com -t 10
  • 设置请求延迟 (秒):

    bash 复制代码
    arjun -u https://example.com -d 1.5
  • 启用稳定模式(防速率限制) :自动将线程设为 1,并在请求间引入 6-12 秒的随机延迟。

    bash 复制代码
    arjun -u https://example.com --stable
  • 控制单次发送的参数数量 (避免超出服务器 URL 长度限制,默认 500):

    bash 复制代码
    arjun -u https://example.com -c 250

4. 结果导出

您可以将扫描结果导出为不同格式,方便后续分析:

  • 导出为 JSONarjun -u https://example.com -oJ results.json
  • 导出为文本arjun -u https://example.com -oT results.txt
  • 导出到 Burp Suitearjun -u https://example.com -oB 127.0.0.1:8080

5. 高级场景

  • 携带自定义 HTTP 头(如 Token、Cookie)

    bash 复制代码
    arjun -u https://example.com/api --headers "Authorization: Bearer token\nCookie: session_id=abc"
  • 指定 JSON/XML 注入点

    bash 复制代码
    arjun -u https://example.com/api -m JSON --include='{"root":{"a":"b",$arjun$}}'
  • 被动收集历史参数 (从 Wayback Machine、Common Crawl 等外部源获取):

    bash 复制代码
    arjun -u https://example.com/api --passive example.com
  • 禁用重定向

    bash 复制代码
    arjun -u https://example.com/redirect_api --disable-redirects

💡 快速提示

安装完成后,您可以随时运行 arjun --help 来查看完整的参数列表和用法说明。

dirsearch

dirsearch 是一款基于 Python3 编写的开源命令行工具,主要用于暴力扫描 Web 服务器的目录结构和隐藏文件。它通过发送 HTTP 请求来尝试访问可能存在的路径,从而发现未列在网站目录页面上的敏感资源(如后台登录地址、备份文件、配置文件等)。

以下是 dirsearch 的详细介绍、核心参数及实战举例:

一、 安装方式

  1. Git 安装(推荐)

    bash 复制代码
    git clone https://github.com/maurosoria/dirsearch.git
    cd dirsearch
    pip3 install -r requirements.txt
  2. Kali Linux 直接安装

    bash 复制代码
    sudo apt-get install dirsearch

二、 核心常用参数

  • -u URL:指定要扫描的目标网址。
  • -e EXTENSIONS:指定要扫描的文件扩展名(如 php,html,js,zip,bak)。
  • -w WORDLIST:指定自定义的字典文件路径(如 -w db/dicc.txt)。
  • -t THREADS:设置并发线程数(默认为 30,不建议过大以免触发封禁)。
  • -r:开启递归扫描(找到目录后继续扫描其子目录)。
  • -R RECURSION_DEPTH:设置最大递归深度。
  • --proxy=PROXY:设置 HTTP/SOCKS 代理(如 http://127.0.0.1:8080)。
  • --random-agents:使用随机 User-Agent,防止被轻易识别为扫描器。
  • -x EXCLUDE_STATUS:排除特定的状态码(如 -x 404,403)。
  • --json-report=FILE:将扫描结果保存为 JSON 格式的报告。

三、 常见用法举例

1. 基础扫描

使用默认字典扫描目标网站,并指定文件后缀为 php:

bash 复制代码
python3 dirsearch.py -u https://target.com -e php
2. 指定字典与多后缀扫描

使用自定义字典,同时扫描 php、txt 和 zip 后缀的文件:

bash 复制代码
python3 dirsearch.py -u https://target.com -e php,txt,zip -w /path/to/wordlist.txt
3. 递归扫描子目录

开启递归扫描,并限制最大递归深度为 3 层:

bash 复制代码
python3 dirsearch.py -u https://target.com -e php,html -r -R 3
4. 性能与反检测配置

结合随机 User-Agent、调整线程数为 20,并排除 403 状态码的干扰:

bash 复制代码
python3 dirsearch.py -u https://target.com -e * --random-agents -t 20 -x 403
5. 使用代理与流量转发

将扫描流量转发到本地 Burp Suite 代理(端口 8080),方便实时抓包分析:

bash 复制代码
python3 dirsearch.py -u https://target.com -e php --proxy http://127.0.0.1:8080
6. 生成扫描报告

扫描结束后,将结果以纯文本或 JSON 格式保存到本地:

bash 复制代码
# 纯文本报告
python3 dirsearch.py -u https://target.com -e php --plain-text-report=reports/target.txt

# JSON 报告
python3 dirsearch.py -u https://target.com -e php --json-report=reports/target.json

四、 扫描结果解读

在扫描过程中,dirsearch 会实时输出结果,格式通常为:

[时间] 状态码 响应大小 路径 -> 重定向地址

例如:

  • [20:25:50] 301 0B /admin -> https://target.com/admin/:表示该目录存在,且发生了 301 重定向。
  • [20:24:12] 403 265B .git/config:表示文件存在,但服务器拒绝了访问(403 Forbidden),这通常是一个高价值的敏感信息泄露线索。
  • [20:23:29] 200 5KB /index.php:表示文件存在且可以正常访问。

⚠️ 安全与合规提示

dirsearch 属于渗透测试中的信息收集工具,会产生大量请求。请务必确保您仅对拥有合法授权的目标进行测试。未经授权对他人系统进行目录爆破属于违法行为。