OctagonIntel/scopehound

GitHub: OctagonIntel/scopehound

面向已授权 Web 渗透测试的范围感知型侦查自动化工具,将多阶段侦查串联为流水线并强制范围校验以防越界扫描。

Stars: 0 | Forks: 0

# scopehound [![CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/1c8dc4f2c3214240.svg)](https://github.com/OctagonIntel/scopehound/actions/workflows/ci.yml) [![Python](https://img.shields.io/badge/python-3.10%2B-blue)](https://www.python.org/) [![License: MIT](https://img.shields.io/badge/license-MIT-green)](LICENSE) **面向已授权 Web 渗透测试项目的范围感知型侦查自动化工具。** scopehound 将标准的侦查阶段串联成一个可重复的 pipeline — 子域名枚举 → 端口扫描 → 服务指纹识别 → HTTP 探测 → 屏幕截图捕获 — 并输出结构化数据 (`results.json`) 以及 人类可读的 `report.md`。每个阶段都会自动将结果传递给下一阶段,但任何 阶段也都可以独立运行。 其核心特性是**强制范围校验**:在执行任何主动操作*之前*,每个 主机都会根据明确的范围内/范围外策略进行校验。范围外规则 始终优先,因此您可以授权一个广泛的范围并从中排除特定部分。 ## 工作原理 ``` ┌─────────────┐ target ──▶│ scope gate │◀── scope.yaml (in/out of scope) └──────┬──────┘ ▼ subdomains ─▶ portscan ─▶ fingerprint ─▶ httpprobe ─▶ screenshots (subfinder) (nmap) (nmap -sV) (httpx) (Playwright) │ ▼ results.json + report.md (+ raw/ tool output, screenshots/) ``` | 阶段 | 工具 | 功能描述 | | --- | --- | --- | | `subdomains` | subfinder (+ 可选 amass) | 被动子域名枚举,并进行范围过滤 | | `portscan` | nmap | 将主机解析为 IP,重新校验范围,扫描常用端口 | | `fingerprint` | nmap `-sV` | 仅对开放端口进行版本检测 | | `httpprobe` | ProjectDiscovery **httpx** | 查找存活的 HTTP(S) 服务、标题、技术和状态 | | `screenshots` | Playwright (Chromium) | 为每个存活主机捕获屏幕截图 | ## 安装 scopehound 是基于 Python (3.10+) 的工具。侦查工具的二进制文件是外部的,通过 subprocess 封装调用 — 请安装您需要的阶段工具;如果缺少某个工具,该阶段会被 **跳过**,而不会导致程序失败。 ``` # 1. Python package python -m venv .venv .venv\Scripts\activate # Windows # source .venv/bin/activate # macOS/Linux pip install -e . # 2. Screenshot engine (Playwright Chromium) playwright install chromium # 3. External recon 工具(选择您平台的方法) # subfinder, httpx: https://github.com/projectdiscovery # nmap: https://nmap.org/download # amass(可选):https://github.com/owasp-amass/amass ``` 检查哪些工具已就绪: ``` scopehound doctor ``` ## 用法 ``` # 针对单个 target 的完整 pipeline(target 及其范围内的 subdomains) scopehound run example.com # 使用显式的 engagement scope 文件(推荐) scopehound run example.com --scope scope.yaml -o ./engagement-output # 仅运行特定阶段(仍按顺序逐步 feed forward) scopehound run example.com -p subdomains -p portscan # 包含 amass passive enumeration scopehound run example.com --amass ``` ### Scope 文件 请参阅 [`scope.example.yaml`](scope.example.yaml)。范围外的优先级始终高于 范围内: ``` in_scope: domains: - example.com - "*.example.com" ips: - 192.0.2.0/24 out_scope: domains: - admin.example.com ips: - 192.0.2.1 ``` 如果您省略 `--scope`,scopehound 会默认将目标及其子域名作为范围,并 告知您这一操作 — 它绝对不会在没有范围校验机制的情况下进行扫描。 ## 输出 ``` output/example.com-20260620-101500/ ├── results.json # full structured run state (source of truth) ├── report.md # human-readable summary with embedded screenshots ├── raw/ # raw tool output (subfinder.txt, nmap XML, httpx.jsonl) └── screenshots/ # one PNG per live host ``` ### 运行示例 ``` $ scopehound run example.com --scope scope.yaml ╭───────────────────────────────────────────────╮ │ scopehound v0.1.0 - authorized-recon use only │ ╰───────────────────────────────────────────────╯ Output: output/example.com-20260620-124832 > subdomains: Passive subdomain enumeration (subfinder, optional amass) ok - 14 in-scope subdomains (2 out-of-scope dropped) > portscan: Resolve hosts and scan top ports with nmap ok - 23 open ports across 6 host(s) > fingerprint: Service/version detection on open ports (nmap -sV) ok - fingerprinted 23 service(s) > httpprobe: Probe live HTTP(S) services with httpx ok - 9 live HTTP service(s) from 18 candidate URL(s) > screenshots: Capture screenshots of live hosts (Playwright/Chromium) ok - captured 9 screenshot(s), 0 failed ``` `results.json` 将包含完整的结构化运行状态: ``` { "manifest": { "tool": "scopehound", "version": "0.1.0", "target": "example.com", "summary": { "subdomains": 14, "hosts": 6, "open_ports": 23, "http_services": 9, "screenshots": 9 } }, "hosts": [ { "ip": "192.0.2.10", "hostnames": ["www.example.com"], "ports": [ { "number": 443, "service": "https", "product": "nginx", "version": "1.25.3" } ] } ] } ``` ## 配置(可选) 使用 `--config settings.yaml` 覆盖二进制文件路径、超时时间和端口: ``` tools: httpx: /opt/pd/httpx # disambiguate from the Python httpx CLI timeouts: nmap: 3600 nmap_top_ports: 2000 web_ports: [80, 443, 8080, 8443] use_amass: true screenshot_timeout_ms: 20000 ``` ## 开发 ``` pip install -e ".[dev]" pytest # logic tests (scope/config/report) need no external tools ruff check . ``` 架构被特意设计为模块化:每个阶段都是 [`src/scopehound/phases/`](src/scopehound/phases) 中的一个 `Phase` 子类,负责读取和写入 共享的 `RunContext`。添加一个新阶段的步骤为:继承 `Phase` 类,实现 `execute()` 方法,然后在 `phases/__init__.py` 中注册它。 ## 许可证 MIT — 详见 [LICENSE](LICENSE)。
标签:Python, 侦察自动化, 子域名枚举, 安全, 实时处理, 密码管理, 数据统计, 无后门, 特征检测, 端口扫描, 系统安全, 超时处理, 运行时操纵, 逆向工具