mk017-hk/ReconX
GitHub: mk017-hk/ReconX
ReconX 是一款基于 Python asyncio 的一体化侦察框架,整合端口扫描、子域名枚举、技术指纹识别、SSL 分析等信息收集模块,支持生成带严重性评级的结构化报告。
Stars: 2 | Forks: 0
# ReconX
```
██████╗ ███████╗ ██████╗ ██████╗ ███╗ ██╗██╗ ██╗
██╔══██╗██╔════╝██╔════╝██╔═══██╗████╗ ██║╚██╗██╔╝
██████╔╝█████╗ ██║ ██║ ██║██╔██╗ ██║ ╚███╔╝
██╔══██╗██╔══╝ ██║ ██║ ██║██║╚██╗██║ ██╔██╗
██║ ██║███████╗╚██████╗╚██████╔╝██║ ╚████║██╔╝ ██╗
╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝
```
**用于授权安全评估的一体化侦察与渗透测试工具包**
[](https://github.com/mk017-hk/ReconX/actions/workflows/ci.yml)
[](https://www.python.org/)
[](LICENSE)
[](CHANGELOG.md)
## 概述
ReconX 是一个为安全专业人士构建的现代 Python 侦察框架。
它将多种 OSINT 和主动枚举技术结合到一个连贯的工具包中,
生成带有严重性评级和独立 HTML 报告的结构化发现结果。
关键设计原则:
- **Async-first(异步优先)** — 完全基于 `asyncio` 的核心,用于高吞吐量并发扫描
- **模块化** — 每个功能都是独立的模块;仅启用您需要的功能
- **结构化输出** — 全程使用类型化 dataclass;无非结构化文本块
- **严重性感知** — 发现结果按 CRITICAL → INFO 分类并显示在报告中
- **生产质量** — 类型提示、日志记录、优雅的错误处理、测试覆盖
## 功能
| 模块 | 功能说明 |
|---|---|
| **TCP 端口扫描器** | 异步端口扫描(top100/top1000/全端口/自定义);协议感知的 Banner 抓取;识别 SSH, FTP, SMTP, HTTP, Redis, MySQL, PostgreSQL, MongoDB 等的产品和版本 |
| **UDP 扫描器** | 针对 DNS, NTP, SNMP, IKE/IPSec, DHCP, TFTP, SSDP, mDNS 的特定协议探测 |
| **DNS 枚举** | A/AAAA/MX/NS/TXT/SOA/CAA/SRV 记录;区域传送尝试;SPF/DMARC 分析;NS 冗余检查 |
| **子域名枚举** | 使用 5,000 条词条的字典进行 DNS 暴力破解;证书透明度;HackerTarget 被动 DNS |
| **HTTP 探测** | 技术指纹识别(30+ 签名:server/CMS/WAF/CDN/framework/JS 库);安全头分析;敏感路径发现(管理面板、git 仓库、env 文件、API 文档) |
| **SSL/TLS 分析** | 证书有效性、过期时间、SANs、颁发者;已弃用协议检测(SSLv3, TLS 1.0/1.1);弱加密套件识别;HSTS 检查 |
| **WHOIS 查询** | 注册商、创建/过期日期、注册人国家、名称服务器、DNSSEC |
| **Web 爬虫** | 带有深度/页面限制的 BFS 爬取;表单提取;JavaScript 文件发现;静态 JS 分析,用于查找硬编码的 API 路由、fetch/axios 调用、GraphQL 引用 |
| **IP & ASN 情报** | IP 解析;PTR 反向 DNS;通过 RDAP + BGPView 进行 ASN 查询;通过 ip-api.com 进行地理定位;云服务商检测(AWS, Azure, GCP, Cloudflare 等) |
| **被动来源** | 证书透明度(crt.sh, 免费);AlienVault OTX(免费);Shodan, Censys, SecurityTrails, VirusTotal, AbuseIPDB(需要 API key,缺失时自动跳过) |
| **严重性评分** | 所有发现结果分类为 CRITICAL/HIGH/MEDIUM/LOW/INFO,并带有模块类别标签(network, dns, web, tls, infrastructure, passive_intel) |
| **HTML 报告** | 独立的单文件报告:摘要卡片、严重性条形图、可折叠部分、严重性着色的发现行、服务分布图表 |
| **JSON 导出** | 用于流水线集成的机器可读结构化输出 |
| **扫描配置** | 内置预设:`quick`, `standard`, `web`, `external`, `full`;可使用 CLI 标志或 YAML/TOML 配置文件覆盖任何设置 |
| **批量模式** | 从文件扫描多个目标;使用 `--resume` 恢复中断的批量扫描 |
| **速率限制** | `--delay`, `--jitter`, `--rate-limit` 用于低噪声/授权评估模式 |
## 安装
### 标准安装(可编辑模式)
```
git clone https://github.com/mk017-hk/ReconX.git
cd ReconX
pip install -e .
```
### 带可选 YAML 配置支持
```
pip install -e ".[config]"
```
### 开发模式(包含 pytest, coverage)
```
pip install -e ".[dev]"
```
### Docker
```
docker build -t reconx .
# 运行扫描
docker run --rm reconx scan example.com --profile standard
# 保存报告到主机文件系统
docker run --rm -v $(pwd)/reports:/reports \
reconx scan example.com --all --report example --output-dir /reports
```
## 快速开始
### 运行标准扫描
```
reconx scan example.com
```
### 使用所有模块进行完整扫描
```
reconx scan example.com --all --report example_recon
```
### 使用扫描配置
```
reconx scan example.com --profile standard --report output
reconx scan example.com --profile full --report full_recon
```
### 低噪声模式(授权评估)
```
reconx scan example.com --delay 0.5 --jitter 0.2 --report safe_scan
```
### 从文件进行批量扫描
```
# targets.txt — 每行一个域名或 IP,# 用于注释
reconx scan placeholder --targets-file targets.txt --all --report batch_recon
# 恢复中断的批处理
reconx scan placeholder --targets-file targets.txt --resume --report batch_recon
```
## 扫描配置
配置文件为常见评估场景提供了合理的默认值。
任何配置设置都可以使用单独的 CLI 标志覆盖。
| 配置 | 端口 | Banner 抓取 | DNS | HTTP | SSL | WHOIS | 子域名 | UDP | 爬虫 | IP 情报 | 被动 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| `quick` | top100 | ✗ | ✓ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ |
| `standard` | top1000 | ✓ | ✓ | ✓ | ✓ | ✓ | ✗ | ✗ | ✗ | ✗ | ✗ |
| `web` | web ports | ✓ | ✓ | ✓ | ✓ | ✗ | ✗ | ✗ | ✓ | ✗ | ✗ |
| `external` | top1000 | ✓ | ✓ | ✓ | ✓ | ✓ | ✗ | ✗ | ✗ | ✓ | ✓ |
| `full` | top1000 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
## 独立命令
每个模块都可以独立调用:
```
# 仅 TCP 端口扫描
reconx portscan 192.168.1.1 --ports 22,80,443,3306,5432
# UDP 扫描
reconx udpscan example.com --ports 53,161,500
# DNS 枚举
reconx dnsenum example.com
# 子域名枚举
reconx subdomains example.com --wordlist /path/to/wordlist.txt
# SSL/TLS 分析
reconx sslcheck example.com --port 443
# WHOIS
reconx whoislookup example.com
# HTTP 探测与技术指纹识别
reconx httpprobe example.com --ports 80,443,8080
# Web 爬取
reconx crawl example.com --depth 3 --max-pages 100
# IP / ASN 情报
reconx ipintel example.com
```
## 配置
### 生成示例配置文件
```
reconx init-config --output reconx.yml
```
### 示例 `reconx.yml`
```
# 扫描配置基础 (quick | standard | web | external | full)
# preset: standard
# 端口扫描
ports: top1000
concurrency: 300
timeout: 1.5
grab_banners: true
# UDP 扫描
udp: false
udp_ports: "53,67,69,123,161,500"
# 模块开关
dns: true
subdomains: false
http: true
ssl: true
whois: true
ip_intel: false
crawl: false
passive_sources: false
# HTTP 选项
http_ports: "80,443,8080,8443"
path_probe: true
# 爬取选项
crawl_depth: 2
crawl_max_pages: 50
# 速率限制 (安全 / 低噪模式)
delay: 0.0 # fixed seconds between probes
jitter: 0.0 # max random additional delay
rate_limit: 0 # max requests/sec (0 = unlimited)
# 报告
output_dir: reports
report_formats:
- json
- html
# API 密钥 — 优先使用环境变量而非配置文件
# shodan_key: ""
# censys_id: ""
# censys_secret: ""
# securitytrails_key: ""
# virustotal_key: ""
# abuseipdb_key: ""
```
### 使用配置文件
```
reconx scan example.com --config reconx.yml
```
## 被动来源集成
被动来源在不进行主动扫描的情况下丰富结果。
免费提供商会自动运行;付费提供商会在其 API key 设置后激活。
| 提供商 | 功能 | 需要 Key |
|---|---|---|
| **crt.sh** | 证书透明度子域名发现 | 否 |
| **AlienVault OTX** | 被动 DNS 威胁情报 | 否 |
| **Shodan** | 主机/端口历史,子域名枚举 | `SHODAN_API_KEY` |
| **Censys** | 服务记录,反向 DNS | `CENSYS_API_ID` + `CENSYS_API_SECRET` |
| **SecurityTrails** | 子域名枚举,WHOIS 历史,电子邮件地址 | `SECURITYTRAILS_API_KEY` |
| **VirusTotal** | 恶意判定,子域名列表 | `VIRUSTOTAL_API_KEY` |
| **AbuseIPDB** | IP 滥用置信度分数 | `ABUSEIPDB_API_KEY` |
### 设置 API keys
推荐使用环境变量 — 切勿将 keys 提交到版本控制:
```
export SHODAN_API_KEY="your_key_here"
export VIRUSTOTAL_API_KEY="your_key_here"
export CENSYS_API_ID="your_id_here"
export CENSYS_API_SECRET="your_secret_here"
```
或者在 `reconx.yml` 中设置 `shodan_key`, `virustotal_key` 等。
## CLI 参考
```
Usage: reconx scan [OPTIONS] TARGET
Run a full or selective reconnaissance scan against TARGET.
Options:
-P, --profile TEXT Preset: quick | standard | web | external | full
--config TEXT Path to YAML/TOML config file
-p, --ports TEXT Port spec: top100, top1000, all, 1-1024, 22,80,443
-c, --concurrency INT Max concurrent TCP connections [default: 300]
-t, --timeout FLOAT Per-port timeout (seconds) [default: 1.5]
--no-banners Skip banner grabbing (faster scan)
--delay FLOAT Fixed delay between probes (seconds)
--jitter FLOAT Max random jitter added to delay (seconds)
--rate-limit INT Max requests per second (0 = unlimited)
--udp / --no-udp Run UDP scan on common ports
--udp-ports TEXT UDP ports to probe [default: 53,67,69,123,161,500]
--dns / --no-dns DNS enumeration [default: on]
--subdomains Enable subdomain enumeration [default: off]
-w, --wordlist PATH Custom subdomain wordlist path
--no-passive Disable passive subdomain sources
--http / --no-http HTTP probing and tech fingerprinting [default: on]
--http-ports TEXT HTTP ports to probe [default: 80,443,8080,8443]
--no-path-probe Skip interesting path discovery
--ssl / --no-ssl SSL/TLS certificate analysis [default: on]
--ssl-port INT Port for SSL analysis [default: 443]
--whois / --no-whois WHOIS lookup [default: on]
--ip-intel / --no-ip-intel ASN, cloud provider, geolocation lookup
--crawl / --no-crawl Web crawl and JS endpoint discovery
--crawl-depth INT Max crawl depth [default: 2]
--crawl-pages INT Max pages to crawl [default: 50]
--passive / --no-passive-sources Passive source integrations
-a, --all Enable all modules
--insecure Disable TLS certificate verification for target scanning
(use for internal targets or self-signed certificates;
passive intelligence APIs always use verified TLS)
-r, --report TEXT Report base name (saves JSON + HTML)
-o, --output-dir TEXT Report output directory [default: reports]
-q, --quiet Suppress banner and progress output
-T, --targets-file PATH File of newline-separated targets (batch mode)
--resume Resume a previous interrupted batch scan
--help Show this message and exit.
```
## 示例输出
```
→ Target: example.com
→ Started: 2026-03-15 12:00:00 UTC
──────────────── 🔍 Port Scan ────────────────
Scanning example.com ━━━━━━━━━━━━━━━━━━━━ 100% 3 open
Port Service Product Version Banner
22 SSH OpenSSH 8.9p1 SSH-2.0-OpenSSH_8.9p1 Ubuntu
80 HTTP Apache 2.4.58 Apache/2.4.58 (Ubuntu)
443 HTTPS nginx 1.24.0 nginx/1.24.0
Scanned 1000 ports · Found 3 open
──────────────── 📡 DNS Enumeration ────────────────
Type Value
A 93.184.216.34
MX 0 .
NS a.iana-servers.net.
TXT v=spf1 -all
Security Findings:
⚠ No DMARC record found — phishing protection absent
──────────────── ⚠️ Findings Summary ────────────────
MEDIUM 2
INFO 3
MEDIUM [dns] No DMARC record found — phishing protection absent
MEDIUM [http] CSP missing — XSS protection absent
INFO [ports] SSH open on TCP/22
```
## 项目结构
```
ReconX/
├── pyproject.toml # PEP 517/518 packaging, dependencies, tool config
├── Dockerfile # Multi-stage Docker image
├── CHANGELOG.md
├── CONTRIBUTING.md
├── reconx/
│ ├── __init__.py # Version string
│ ├── cli.py # Click CLI — all commands and options
│ ├── config.py # Scan profiles, YAML/TOML config loader
│ ├── core/
│ │ ├── scanner.py # Async TCP port scanner + service fingerprinting
│ │ ├── udp_scanner.py # UDP scanner with protocol-specific probes
│ │ ├── dns_enum.py # DNS record enumeration + zone transfer detection
│ │ ├── subdomain.py # Subdomain brute-force + passive sources
│ │ ├── http_probe.py # HTTP probing + technology fingerprinting
│ │ ├── ssl_analyzer.py # SSL/TLS certificate and protocol analysis
│ │ ├── whois_lookup.py # WHOIS lookup
│ │ ├── web_crawler.py # BFS web crawler + JavaScript endpoint extraction
│ │ ├── ip_intel.py # ASN, geolocation, cloud provider detection
│ │ ├── passive_sources.py # crt.sh, OTX, Shodan, Censys, VT, AbuseIPDB
│ │ └── severity.py # Finding classification and severity scoring
│ ├── utils/
│ │ ├── display.py # Rich terminal output
│ │ ├── report.py # JSON + HTML report generation
│ │ └── state.py # Scan state persistence (resume support)
│ └── wordlists/
│ └── subdomains.txt # 5 000-entry built-in subdomain wordlist
└── tests/ # pytest test suite
```
## 架构
ReconX 建立在一小组精心选择的依赖项之上:
| 库 | 作用 |
|---|---|
| `asyncio` | 完全异步的核心,用于并发扫描 |
| `aiohttp` | 异步 HTTP 客户端,用于探测和被动 API 调用 |
| `dnspython` | DNS 解析和区域传送尝试 |
| `rich` | 终端输出:进度条、表格、颜色 |
| `click` | CLI 框架,支持子命令和 shell 补全 |
| `cryptography` | TLS 证书解析 |
| `python-whois` | WHOIS 数据检索 |
| `pyyaml` | YAML 配置文件支持 |
## 开发
```
# 安装开发依赖
pip install -e ".[dev]"
# 运行测试套件
python -m pytest tests/ -v
# 运行覆盖率测试
python -m pytest tests/ --cov=reconx --cov-report=term-missing
```
### Shell 补全
```
reconx install-completion bash # or zsh / fish
```
## 合法使用
此工具仅用于**授权的安全测试和研究**。
- 在扫描任何系统之前,务必获得明确的书面许可。
- 请勿对您不拥有或未获准测试的系统使用此工具。
- 作者不对本软件的滥用承担任何责任。
- 请遵守您所在司法管辖区的所有适用法律和法规。
标签:AES-256, Asyncio, C2日志可视化, ESC4, GitHub, Groq, OSINT, Python, Python 3.10, 反取证, 子域名枚举, 安全报告生成, 安全评估, 密码管理, 对称加密, 异步编程, 指纹识别, 插件系统, 数据展示, 数据统计, 无后门, 模块化设计, 漏洞评估, 端口扫描, 系统安全, 红队, 网络安全, 自动化修复, 自动化审计, 计算机取证, 请求拦截, 逆向工具, 隐私保护