Shadowinfinitywarrior/PHANTOM

GitHub: Shadowinfinitywarrior/PHANTOM

PHANTOM 是一个基于 Python 的模块化渗透测试与安全评估框架,通过 37 个内置审计模块覆盖 Web 应用、API、网络及云基础设施的全面安全检测与合规报告生成。

Stars: 0 | Forks: 0

# PHANTOM v6.0 **P**enetration **H**euristic **A**ssessment & **N**etwork **T**hreat **H**unting **O**ffensive **M**odule PHANTOM 是一个使用 Python 编写的高级工程化模块安全评估框架。它具有 **37 个独立的审计模块**、可定制的模拟浏览器隐身引擎、在 WAL 模式下运行的本地 SQLite 数据仓库、cron 驱动的任务调度、动态插件加载器 pipeline,以及直接映射到合规标准的自动化报告系统。 ## 目录 1. [核心功能](#core-features) 2. [目录结构](#directory-structure) 3. [全部 37 个模块](#all-37-modules) 4. [快速开始与安装](#quick-start--installation) 5. [配置设置](#configuration-settings) 6. [SQLite 数据库 Schema](#sqlite-database-schema) 7. [调度器配置](#scheduler-configuration) 8. [插件开发](#plugin-development) 9. [作者与仓库详情](#author--repository-details) 10. [许可证](#license) ## 核心功能 * **37 个生产级模块:** 全面的安全测试,涵盖侦察、应用攻击向量、协议层、身份验证协议、移动/API 网关、云基础设施以及后渗透。 * **独立于浏览器的隐身引擎:** 通过 `curl-cffi` 轮换安全的 TLS 指纹,以绕过 WAF、CDN 和威胁情报过滤。 * **配置驱动的评分:** 基于动态的、量身定制的严重性评分权重(严重、高、中、低),提供客户就绪的风险分级。 * **多格式合规报告:** 生成交互式 HTML 格式、Markdown 文档和标准化 JSON 日志的客户报告,并映射到 MITRE ATT&CK 技术、OWASP Top 10、PCI-DSS 和 NIST。 * **Cron 调度系统:** 实时 cron 调度器,支持后台周期性评估扫描。 * **线程安全的数据记录器:** 所有扫描活动都以线程安全的方式记录到 SQLite 数据库和 `reports/findings.json` 中。 ## 目录结构 ``` PHANTOM/ ├── config.py # Configuration manager & default settings ├── main.py # CLI interface & interactive shell menu ├── requirements.txt # Dependency definitions ├── .env # Environment variable overrides ├── core/ # Core framework subsystems │ ├── database.py # SQLite database connection & models │ ├── engine.py # Stealth request engine (curl_cffi) │ ├── logger.py # Thread-safe logging & console formatting │ ├── plugin_manager.py # Dynamically loads custom security modules │ ├── reporter.py # Standard jinja2 reporter │ └── scheduler.py # Cron-based scanning daemon ├── modules/ # Framework security modules (37 total) │ ├── fingerprint.py │ ├── subdomain.py │ ├── ssl_audit.py │ ├── fuzzer.py │ ├── c2_framework.py │ └── ... (remaining modules) ├── plugins/ # Directory for custom user-created modules ├── logs/ # Standard application logging folder └── reports/ # Output reports (HTML, JSON, MD, findings.json) ``` ## 全部 37 个模块 PHANTOM 分为不同的安全支柱。每个模块都实现了标准的执行接口,可以单独运行,也可以作为完整评估的一部分运行。 ### 1. 侦察 | ID | 模块名称 | 核心审计与检查 | |:---|:---|:---| | **1** | **Fingerprint** | 识别 WAF、CDN、服务器标头、安全 cookie 标志和 HSTS。 | | **2** | **Subdomain** | DNS 暴力破解、crt.sh 证书透明度抓取、Wayback Machine endpoint 和在线检查。 | | **3** | **SSL Audit** | 评估证书有效性/链,检查协议(SSLv2 到 TLS 1.3)、加密强度和 HSTS 标头。 | | **13** | **DNS Security** | 探测区域传送 (AXFR)、DNSSEC 记录、SPF/DKIM/DMARC 配置和通配符对齐。 | | **16** | **Network Analysis** | 快速异步端口扫描器、OS 指纹识别(ICMP/TCP payload)、banner 抓取和子网发现。 | | **28** | **Social Engineering** | 收集企业电子邮件,验证目录暴露模式,并映射员工身份。 | ### 2. 应用程序审计 | ID | 模块名称 | 核心审计与检查 | |:---|:---|:---| | **4** | **Metadata** | 扫描 50 多个常见 API 目录和暴露的系统目录,查找泄露向量。 | | **5** | **Chat / IDOR** | 测试聊天会话接口和数字顺序 ID,以验证跨用户数据授权。 | | **6** | **Fuzzer** | 基于错误和差异时间的 SQLi、反射型 XSS、路径遍历/LFI、SSRF 云元数据和命令注入。 | | **10** | **GraphQL** | Schema 内省泄露、字段建议暴力破解、嵌套 DoS 查询和 mutation 身份验证绕过。 | | **14** | **API Key Hunter** | 在 JS bundle、`.env` 文件和 `.git` 仓库中基于正则表达式搜索 50 多种密钥(AWS、GCP、SaaS)。 | | **21** | **File Upload** | 扩展名绕过检查、mime-type 欺骗、竞态条件和远程代码执行 (RCE)。 | | **22** | **Business Logic** | 价格篡改漏洞、交易逻辑绕过和竞态条件。 | | **33** | **Breach Hunter** | 将泄露与外部来源(HIBP、paste 站点、公开泄露列表)相关联。 | | **34** | **HTTP Smuggling** | 探测 HTTP/1.1 CL.TE、TE.CL、TE.TE 和 HTTP/2 不同步向量。 | | **35** | **Prototype Pollution** | 扫描 JSON 原型污染、查询字符串覆盖和 AST 注入点。 | | **36** | **CORS Advanced** | 探测反射源、null 源和子域中的通配符。 | | **37** | **Dependency Scanner** | 将 JS 库与 CVE 列表进行交叉引用,检查子资源完整性 (SRI)。 | ### 3. 身份验证与会话 | ID | 模块名称 | 核心审计与检查 | |:---|:---|:---| | **7** | **JWT Analysis** | 验证 JWT 'none' 算法绕过、密钥暴力破解、签名验证和 payload 元数据。 | | **8** | **Session Hijack** | 检查 token 熵、CSRF 防御、会话固定以及注销后的 token 重用。 | | **9** | **OAuth / OIDC** | 探测 OpenID 配置、重定向 URI 开放重定向、JWKS 密钥和 PKCE 参数。 | | **20** | **Password Auditor** | 测试常见默认设置、暴力破解抵抗力以及速率限制账户锁定策略。 | ### 4. 协议与移动网关 | ID | 模块名称 | 核心审计与检查 | |:---|:---|:---| | **11** | **WebSocket** | 跨站 WebSocket 劫持 (CSWSH)、WebSocket 帧、速率限制泛洪和 payload 验证。 | | **17** | **Mobile API** | iOS/Android 深度链接分析、证书绑定检查、客户端缓存和速率审计。 | ### 5. 新兴技术 | ID | 模块名称 | 核心审计与检查 | |:---|:---|:---| | **24** | **LLM / AI Security** | 测试 prompt 注入抵抗力、越狱模板和数据提取边界。 | | **25** | **Web3 / Blockchain** | 审计 RPC endpoint、智能合约定义和去中心化金融 闪电贷向量。 | ### 6. 基础设施与 Active Directory | ID | 模块名称 | 核心审计与检查 | |:---|:---|:---| | **12** | **Rate Limit** | 自动突发测试(50+ 请求)和绕过检查(例如 X-Forwarded-For 欺骗)。 | | **15** | **Cloud Misconfig** | AWS S3、GCS、Azure Blob 暴露;扫描 K8s API、Docker socket、Host 注入和 CDN 缓存中毒。 | | **18** | **CI/CD Security** | 暴露的 pipeline 配置(GitHub Actions、GitLab CI)、Spring Boot 执行器和 pipeline 构建密钥泄露。 | | **19** | **Exploit Suggester** | 使用异步 NVD 数据库查询将发现的服务版本与已知 CVE 相关联。 | | **29** | **Active Directory** | 审计 LDAP 配置、SMB 签名策略、NTLM 中继风险和 Kerberoasing 攻击面。 | ### 7. 进攻性操作模拟 | ID | 模块名称 | 核心审计与检查 | |:---|:---|:---| | **27** | **C2 Framework** | 生成 XOR 加密的 beacon 代理;限制为安全侦察命令的交互式 shell 控制台。 | | **30** | **Evasion Engine** | 测试 payload payload 绕过技术、WAF 编码模式和分块传输规避。 | | **31** | **Post-Exploitation** | 模拟本地权限提升路径、横向移动端口(RDP、SSH、SMB)和数据外发通道。 | ### 8. 情报与报告 | ID | 模块名称 | 核心审计与检查 | |:---|:---|:---| | **23** | **Threat Intel** | 执行 IP 黑名单检查,并将当前扫描结果映射到 MITRE ATT&CK 框架。 | | **26** | **Advanced Report** | 生成详细的 HTML 合规面板、Markdown 摘要和 JSON 导出。 | | **32** | **Live Dashboard** | 实时 CLI 面板,渲染扫描进度、服务器指标和活动漏洞类型。 | ## 快速开始与安装 ### 前置条件 * Python 3.10+ * 基于 Unix 的 OS(Linux/macOS) ### 设置 1. **克隆仓库:** git clone https://github.com/Shadowinfinitywarrior/PHANTOM.git cd PHANTOM 2. **安装依赖项:** pip install -r requirements.txt 3. **验证设置:** 查看或修改 `config.py` 中的设置,或者在根目录的 `.env` 文件中设置配置变量。 4. **启动 PHANTOM:** python3 main.py ## 配置设置 您可以在 `config.py` 中自定义扫描参数,或者在 `.env` 文件中指定它们: ``` # Target 配置 TARGET_URL=https://example.com # 时间与延迟 DELAY_MIN=1.2 DELAY_MAX=3.8 # Proxy Pool 设置 USE_PROXY=false PROXY_LIST=http://127.0.0.1:8080,http://127.0.0.1:8081 # SSL / TLS 设置 VERIFY_SSL=true # 可自定义的 Severity 评分权重 DEDUCT_CRITICAL=15 DEDUCT_HIGH=8 DEDUCT_MEDIUM=4 DEDUCT_LOW=1 ``` ## SQLite 数据库 Schema PHANTOM 将扫描元数据本地存储在 `phantom.db` 中。主要结构包括: ``` -- Track target metadata CREATE TABLE IF NOT EXISTS targets ( id INTEGER PRIMARY KEY AUTOINCREMENT, url TEXT UNIQUE NOT NULL, added_at TEXT NOT NULL, last_scanned TEXT, scan_count INTEGER DEFAULT 0 ); -- Track scans and overall grade outputs CREATE TABLE IF NOT EXISTS scans ( id INTEGER PRIMARY KEY AUTOINCREMENT, target TEXT NOT NULL, started_at TEXT NOT NULL, ended_at TEXT, status TEXT DEFAULT 'running', score INTEGER DEFAULT 0, grade TEXT DEFAULT 'F' ); -- Thread-safe scan findings mapping CREATE TABLE IF NOT EXISTS findings ( id INTEGER PRIMARY KEY AUTOINCREMENT, scan_id INTEGER REFERENCES scans(id), type TEXT NOT NULL, severity TEXT NOT NULL, endpoint TEXT, detail TEXT, timestamp TEXT NOT NULL ); ``` ## 调度器配置 可以使用调度面板中的标准 cron 表达式来配置周期性自动扫描: ``` # PHANTOM CLI 中的 scheduler 注册格式示例: Target: https://my-target-domain.test Modules: 1,2,3,13,19 Cron: @daily # (supported formats: @hourly, @daily, @weekly, or custom cron expressions like "*/30 * * * *") ``` ## 插件开发 可以通过将自定义扫描模块添加到 `/plugins` 目录来动态加载它们: 1. **创建插件结构:** plugins/ └── my_custom_plugin/ ├── plugin.json # 元数据描述符 └── module.py # 可执行的审计逻辑 2. **plugin.json:** { "name": "Custom CORS Auditor", "version": "1.0", "author": "Nithish K", "description": "Custom CORS validation routines." } 3. **module.py:** from core.logger import Logger class PluginModule: def run(self): Logger.info("Running Custom CORS validation module...") # Write audit logic here ## 作者与仓库详情 * **作者:** Nithish K * **主要联系方式:** [infonity404@gmail.com](mailto:infonity404@gmail.com) * **次要联系方式:** [nithishkathiravan123@gmail.com](mailto:nithishkathiravan123@gmail.com) * **作者 GitHub:** [Shadowinfinitywarrior](https://github.com/Shadowinfinitywarrior) * **仓库链接:** [https://github.com/Shadowinfinitywarrior/PHANTOM.git](https://github.com/Shadowinfinitywarrior/PHANTOM.git) ## 许可证 该项目基于 **MIT License** 授权。 ``` MIT License Copyright (c) 2026 Nithish K Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ```
标签:API安全, CISA项目, JSON输出, Python, Web安全审计, 安全评估框架, 密码管理, 无后门, 逆向工具