gtfo5150/recon-agent

GitHub: gtfo5150/recon-agent

一款道德黑客侦察 CLI 工具,整合端口扫描、子域名枚举与 OSINT 收集,用于授权目标的前期信息收集。

Stars: 0 | Forks: 0

# Recon Agent 道德黑客侦察 CLI 工具。对已授权的目标执行端口扫描、子域名枚举和 OSINT 收集。 ## 功能 - **端口扫描** — 具有 banner grabbing 功能的多线程 TCP connect 扫描;可选集成 nmap 进行服务/版本检测 - **子域名枚举** — 证书透明度日志 (crt.sh) + DNS 暴力破解,包含 100 多个常用前缀 - **OSINT 收集** — WHOIS 注册数据、DNS 记录 (A/AAAA/MX/NS/TXT/CNAME/SOA)、HTTP 标头分析以及技术栈指纹识别(WordPress、React、Cloudflare 等) - **报告** — Rich 格式化的终端输出 + 带时间戳的 JSON 报告导出 ## 环境要求 - Python 3.8+ - macOS、Linux 或 Windows - (可选)[nmap](https://nmap.org/) 用于高级端口扫描 ## 安装 ### 从源码安装 ``` git clone https://github.com/gtfo5150/recon-agent.git cd recon-agent pip3 install -e . ``` 这将在全局安装 `recon-agent` 命令。如果它不在你的 PATH 中,请添加 pip scripts 目录: ``` # macOS (system Python) export PATH="$HOME/Library/Python/3.9/bin:$PATH" # 或者使用 virtual environment(推荐) python3 -m venv venv source venv/bin/activate pip install -e . ``` ### 可选:安装 nmap ``` # macOS brew install nmap # Debian/Ubuntu sudo apt install nmap # Fedora/RHEL sudo dnf install nmap ``` 如果没有 nmap,该工具将使用内置的、基于 socket 的扫描,可直接开箱即用。 ## 快速开始 ``` # 完整 recon 扫描 (OSINT → Subdomains → Ports → JSON report) recon-agent scan example.com # 仅 Port 扫描 recon-agent portscan example.com # 仅 Subdomain 枚举 recon-agent subdomains example.com # 仅 OSINT recon-agent osint example.com ``` ## 用法 ### 命令 | 命令 | 描述 | |---------|-------------| | `scan` | 完整侦察扫描(所有阶段) | | `portscan` | 仅端口扫描 | | `subdomains` | 仅子域名枚举 | | `osint` | 仅 OSINT 收集(WHOIS、DNS、HTTP) | ### `scan` — 全面侦察 按顺序运行所有三个阶段:OSINT → 子域名枚举 → 端口扫描,然后导出 JSON 报告。 ``` recon-agent scan [OPTIONS] ``` **选项:** ``` -p, --ports TEXT Comma-separated ports to scan (default: common ports) -t, --threads INT Number of threads (default: 50) --timeout FLOAT Socket timeout in seconds (default: 1.5) --nmap Use nmap instead of socket scanning --nmap-args TEXT Arguments for nmap (default: "-sV -sC") --no-ports Skip port scanning phase --no-subdomains Skip subdomain enumeration phase --no-osint Skip OSINT gathering phase --no-crtsh Skip crt.sh certificate transparency lookup --no-bruteforce Skip DNS brute-force enumeration --no-whois Skip WHOIS lookup --no-dns Skip DNS record queries --no-http Skip HTTP header probe --no-report Skip JSON report generation -o, --output PATH Output file path for JSON report ``` **示例:** ``` # 基础完整扫描 recon-agent scan example.com # 在特定端口上使用 nmap 扫描 recon-agent scan example.com --nmap --ports 80,443,8080,8443 # 仅 OSINT + subdomains(跳过 port 扫描) recon-agent scan example.com --no-ports # 快速扫描:仅 crt.sh + ports,无 brute-force 或 WHOIS recon-agent scan example.com --no-bruteforce --no-whois # 将报告保存到特定文件 recon-agent scan example.com -o ~/reports/target_report.json # 使用更多 threads 的高性能扫描 recon-agent scan example.com --threads 100 --timeout 2.0 ``` ### `portscan` — 端口扫描 ``` recon-agent portscan [OPTIONS] ``` ``` # 使用内置 socket scanner 扫描常见 ports recon-agent portscan example.com # 扫描特定 ports recon-agent portscan example.com --ports 22,80,443,3306,5432 # 使用 nmap 进行 service 版本检测 recon-agent portscan example.com --nmap ``` ### `subdomains` — 子域名枚举 ``` recon-agent subdomains [OPTIONS] ``` ``` # 完整枚举 (crt.sh + DNS brute-force) recon-agent subdomains example.com # 仅 Certificate transparency(更快) recon-agent subdomains example.com --no-bruteforce # 仅 DNS brute-force recon-agent subdomains example.com --no-crtsh ``` ### `osint` — OSINT 收集 ``` recon-agent osint [OPTIONS] ``` ``` # 完整 OSINT (WHOIS + DNS + HTTP) recon-agent osint example.com # 仅 DNS records recon-agent osint example.com --no-whois --no-http # 仅 HTTP technology fingerprinting recon-agent osint example.com --no-whois --no-dns ``` ## 输出 ### 终端 结果显示为 Rich 格式化的表格,并带有颜色区分的输出: - 开放端口及其服务名称和 banner - 子域名及其解析的 IP 和发现来源 - 面板中的 WHOIS 注册详细信息 - 表格中的 DNS 记录 - HTTP 标头及检测到的技术栈 ### JSON 报告 默认情况下,`scan` 会导出带有时间戳的 JSON 报告: ``` recon_example_com_20260524_160000.json ``` 报告结构: ``` { "target": "example.com", "timestamp": "2026-05-24T16:00:00+00:00", "results": { "osint": { "whois_info": { "domain_name": "...", "registrar": "..." }, "dns_records": [{ "record_type": "A", "values": ["..."] }], "http_info": { "server": "...", "technologies": ["..."] } }, "subdomains": { "domain": "example.com", "total_found": 42, "subdomains": [{ "subdomain": "www.example.com", "ip": "..." }] }, "port_scan": { "target": "example.com", "ip": "93.184.216.34", "ports": [{ "port": 80, "state": "open", "service": "HTTP" }] } } } ``` ## 项目结构 ``` recon-agent/ ├── README.md ├── setup.py ├── requirements.txt ├── .gitignore ├── recon_agent/ │ ├── __init__.py │ ├── cli.py # Click CLI entry point │ ├── agent.py # Main orchestrator │ ├── modules/ │ │ ├── port_scanner.py # TCP/nmap port scanning │ │ ├── subdomain_enum.py # crt.sh + DNS brute-force │ │ └── osint.py # WHOIS, DNS, HTTP, tech detection │ └── reporting/ │ └── reporter.py # Rich display + JSON export └── tests/ ├── test_port_scanner.py ├── test_subdomain_enum.py ├── test_osint.py └── test_reporter.py ``` ## 测试 所有网络调用均已被 mock,因此测试可完全离线运行。 ``` pip install pytest python3 -m pytest tests -v ``` ``` 57 passed in 0.14s ``` ## 许可证 MIT
标签:GitHub, Python, 子域名枚举, 实时处理, 插件系统, 数据统计, 无后门, 端口扫描, 系统安全, 资产测绘, 逆向工具