hammadx05/SubStorm-Advanced-Subdomain-Enumeration-Tool

GitHub: hammadx05/SubStorm-Advanced-Subdomain-Enumeration-Tool

一款结合多层验证和CDN检测的专业级子域名枚举工具,帮助安全研究人员以低误报率快速发现并分析目标域名资产。

Stars: 0 | Forks: 0

# 🔍 SubStorm - 高级子域名枚举工具
![Python 版本](https://img.shields.io/badge/python-3.8+-blue.svg) ![Kali Linux](https://img.shields.io/badge/Kali%20Linux-Compatible-blueviolet) ![许可证](https://img.shields.io/badge/license-MIT-green) ![版本](https://img.shields.io/badge/version-2.0-red) **作者:Muhammad Hammad**
## 📌 概述 SubStorm 是一款 **专业级子域名枚举工具**,专为安全研究人员、渗透测试人员和漏洞赏金猎人设计。它结合了多种发现方法和智能验证机制,以极低的误报率提供准确的结果。 ### 为什么选择 SubStorm? - 🎯 **低误报率** - 在确认子域名存活前进行多层验证 - ⚡ **高性能** - 100+ 并发线程实现极速枚举 - 🔒 **安全加固** - 输入清理、速率限制和 API 密钥保护 - 🛡️ **CDN 检测** - 识别 IP 是否隐藏在 CloudFlare、AWS 等服务背后 - 📊 **综合报告** - 包含详细分析的 JSON 和 HTML 格式输出 - 💰 **额度优化** - 为免费用户优化 Shodan 查询次数 ## ✨ 功能特性 | 类别 | 特性 | |----------|----------| | **子域名发现** | • 字典爆破(5 种预设:100 到 20万+ 词)
• VirusTotal API 集成
• 常见前缀扫描 | | **有效性验证** | • 3 层存活性检查(DNS、HTTP、TCP)
• 通配符 DNS 检测
• 去重处理 | | **IP 分析** | • 公网/私网 IP 分类
• CDN/云服务商检测
• 源站 IP 评分 | | **漏洞情报** | • Shodan 集成用于开放端口查询
• CVE 漏洞检测
• 组织与操作系统指纹识别 | | **报告生成** | • 用于自动化的 JSON 格式
• 带视觉样式的 HTML 格式
• 控制台彩色输出 | ## 🚀 快速安装 ### Kali Linux / 基于 Debian 的系统 ``` # Clone repository git clone https://github.com/yourusername/substorm.git cd substorm # Make installer executable and run chmod +x setup.sh ./setup.sh # Or install manually pip3 install -r requirements.txt --break-system-packages chmod +x substorm.py ``` ### 手动安装 ``` # Install Python dependencies pip3 install requests dnspython colorama aiohttp python-dotenv cryptography tenacity # Download wordlists (optional) python3 download_wordlists.py # Create .env file for API keys (optional) cp .env.example .env ``` ## 🔑 API 配置(可选) 在根目录下创建一个 `.env` 文件: ``` # VirusTotal API Key (Free tier: 500 requests/day) # Get from: https://www.virustotal.com/gui/my-apikey VIRUSTOTAL_API_KEY=your_key_here # Shodan API Key (Free tier: 30 lookups/month) # Get from: https://account.shodan.io/ SHODAN_API_KEY=your_key_here ``` ## 📖 使用指南 ### 基本命令 ``` # Quick scan with tiny wordlist (100 subdomains) python3 substorm.py -d example.com -s tiny # Standard scan with 20,000 subdomains python3 substorm.py -d example.com -s medium # Deep scan with 100,000 subdomains python3 substorm.py -d example.com -s large # Limit results to 50 subdomains python3 substorm.py -d example.com -s medium -m 50 # Use custom wordlist python3 substorm.py -d example.com -w /path/to/wordlist.txt # Skip API enumeration (brute force only) python3 substorm.py -d example.com --no-api # Skip brute force (API only) python3 substorm.py -d example.com --no-brute ``` ### 字典预设 | 预设 | 大小 | 描述 | 适用场景 | |--------|------|-------------|----------| | `tiny` | 100 | 内置常见前缀 | 快速侦察 | | `small` | 5,000 | SecLists 前 5k | 标准扫描 | | `medium` | 20,000 | SecLists 前 20k | 扩展枚举 | | `large` | 100,000 | Bitquark 数据集 | 深度侦察 | | `full` | 200,000+ | Commonspeak2 | 全面审计 | ### 帮助菜单 ``` python3 substorm.py -h ``` ``` usage: substorm.py [-h] -d DOMAIN [-s {tiny,small,medium,large,full}] [-w WORDLIST] [-m MAX_SUBDOMAINS] [--no-brute] [--no-api] [--list-wordlists] SubStorm - Advanced Subdomain Enumeration Tool options: -h, --help Show this help message -d DOMAIN, --domain DOMAIN Target domain (example: example.com) -s {tiny,small,medium,large,full}, --size {tiny,small,medium,large,full} Wordlist size preset (default: small) -w WORDLIST, --wordlist WORDLIST Path to custom wordlist file -m MAX_SUBDOMAINS, --max-subdomains MAX_SUBDOMAINS Maximum number of subdomains to find --no-brute Skip brute force enumeration --no-api Skip API enumeration --list-wordlists List available wordlist presets Examples: substorm -d example.com -s tiny substorm -d example.com -s medium -m 50 substorm -d example.com --no-api ``` ## 🧠 技术深入解析 ### 子域名验证的工作原理 SubStorm 使用 **3 层验证系统** 来消除误报: ``` Layer 1: DNS Resolution ↓ Layer 2: HTTP/HTTPS Connectivity ↓ Layer 3: TCP Port Check (80/443) ↓ Result: Live (if ≥2 layers pass) ``` **为什么这很重要:** - **通配符 DNS** 会让不存在的子域名看起来也能解析 - **HTTP 检查** 验证真实的 Web 服务器是否正在响应 - **TCP 检查** 能捕获非标准端口上的服务 ### CDN 检测机制 该工具能识别 IP 是否隐藏在内容分发网络 (CDN) 背后: | 方法 | 检查内容 | |--------|----------------| | **反向 DNS** | 主机名包含 `cloudflare`、`fastly`、`akamai` 等 | | **HTTP 请求头** | 存在 `CF-Ray`、`X-Cache`、`X-Amz-Cf-Id` 等头部 | | **响应分析** | 指示 CDN 服务的 Server 头部 | **输出示例:** ``` [PUBLIC] www.example.com -> 104.18.32.12 [Behind CloudFlare (Confidence: 95%)] [PUBLIC] origin.example.com -> 192.0.2.1 [Likely origin IP (Confidence: 70%)] ``` ### Shodan 额度优化 针对免费用户(每月 30 次查询额度),SubStorm 会智能地节省额度: ``` Found: 20 subdomains → 13 live → 8 unique public IPs → 8 Shodan lookups ↓ (instead of 13, saving 5 credits) ``` **已应用的优化:** - ✅ 仅检查存活(LIVE)的子域名(排除无效域名) - ✅ IP 地址去重(同一 IP 上的多个子域名仅查询 1 次) - ✅ 可配置的最大查询次数(默认:30 次) ### 多线程架构 ``` ┌─────────────────────────────────────────────────────┐ │ Main Thread │ └─────────────────────────────────────────────────────┘ │ ┌────────────────┼────────────────┐ ▼ ▼ ▼ ┌─────────┐ ┌─────────┐ ┌─────────┐ │Thread 1 │ │Thread 2 │ │Thread N │ (MAX_WORKERS = 100) │DNS Check│ │DNS Check│ │DNS Check│ └─────────┘ └─────────┘ └─────────┘ │ │ │ └────────────────┼────────────────┘ ▼ Results aggregated in real-time ``` ## 📁 输出结构 ### 控制台输出(彩色) ``` [LIVE] www.example.com (Green - Active) [DEAD] old.example.com (Red - Inactive) [PUBLIC] api.example.com -> 1.2.3.4 (Cyan - Public IP) [PRIVATE] internal.example.com -> 10.0.0.1 (Magenta - Private IP) ``` ### JSON 报告 ``` { "target_domain": "example.com", "scan_summary": { "total_subdomains_found": 45, "live_subdomains": 23, "behind_cdn": 12, "origin_ips": 11 }, "ip_analysis": { "cdn_breakdown": { "behind_cdn": [...], "likely_origin": [...] } }, "shodan_results": [...] } ``` ### HTML 报告 - 可视化摘要卡片 - 彩色子域名表格 - CDN 检测徽章 - Shodan 发现结果部分 ## 🛠️ 目录结构 ``` substorm/ │ ├── substorm.py # Main entry point ├── setup.sh # Installation script ├── requirements.txt # Python dependencies ├── .env.example # API key template │ ├── config/ │ └── settings.py # Configuration management │ ├── core/ │ ├── banner.py # ASCII banner display │ ├── security.py # Input sanitization & injection prevention │ └── validator.py # Multi-layer validation logic │ ├── modules/ │ ├── subdomain/ │ │ ├── api_enumerator.py # VirusTotal integration │ │ └── brute_forcer.py # Wordlist brute force │ │ │ ├── live_checker/ │ │ └── health_check.py # DNS/HTTP/TCP verification │ │ │ ├── ip_analyzer/ │ │ ├── cdn_detector.py # CloudFlare/AWS/Fastly detection │ │ └── ip_extractor.py # Public/Private IP classification │ │ │ └── shodan/ │ └── shodan_client.py # Port & CVE lookup │ ├── utils/ │ ├── cache.py # Response caching (1 hour TTL) │ ├── ratelimiter.py # API rate limiting protection │ └── wordlist_manager.py # Automatic wordlist downloader │ └── reports/ └── report_generator.py # JSON & HTML report builder ``` ## 📊 性能基准测试 | 操作 | 线程数 | 耗时(以 example.com 为例) | |-----------|---------|--------------------| | 5,000 次 DNS 查询 | 100 | ~ 30 秒 | | 20,000 次 DNS 查询 | 100 | ~ 2 分钟 | | 存活检查(100 个子域名) | 100 | ~ 5 秒 | | IP 解析(50 个 IP) | 100 | ~ 2 秒 | ## ❓ 故障排除 | 问题 | 解决方案 | |-------|----------| | `externally-managed-environment` | 使用 `pip3 install --break-system-packages` 或 `--user` | | `ModuleNotFoundError` | 运行 `pip3 install -r requirements.txt` | | Shodan 401 错误 | API 密钥无效 - 检查 `.env` 文件 | | 未发现子域名 | 目标可能使用了通配符 DNS,请尝试使用更大的字典 | | 速率限制错误 | 免费 API 套餐有额度限制 - 请等待或升级套餐 | ## 📜 许可证 本项目采用 MIT 许可证授权 - 详情请参阅 [LICENSE](LICENSE) 文件。 ## 🙏 致谢 - [SecLists](https://github.com/danielmiessler/SecLists) 提供字典 - [VirusTotal](https://www.virustotal.com/) 提供 API - [Shodan](https://www.shodan.io/) 提供漏洞数据 - [dnspython](https://www.dnspython.org/) 提供 DNS 解析
**由 Muhammad Hammad 用 ❤️ 制作** [报告 Bug](https://github.com/yourusername/substorm/issues) · [请求功能](https://github.com/yourusername/substorm/issues)
标签:CDN检测, DNS解析, GitHub, Python, 子域名枚举, 开源安全工具, 开源项目, 无后门, 系统安全, 网络安全, 资产测绘, 逆向工具, 逆向工程平台, 野生域名检测, 隐私保护