rohanndhiman/GhostTrace-X

GitHub: rohanndhiman/GhostTrace-X

GhostTrace-X 是一个用于自动化侦察和开源情报收集的Python框架,支持道德安全测试和CTF工作流中的信息收集任务。

Stars: 0 | Forks: 0

# GHOSTTRACE-X 🕶 ## 基于 Python 的侦察与开源情报框架,适用于道德安全测试、CTF 工作流及研究自动化。 ## 🎯 概述 GHOSTTRACE-X 是一款生产级质量、模块化且可扩展的侦察工具,专为以下场景设计: - 道德黑客与渗透测试 - CTF (夺旗赛) 竞赛 - 安全分析与审计 它对网站、文件和 API 执行**深度情报收集**,然后将发现结果关联为可操作的见解。 ## 🚀 快速开始 ### 1. 安装依赖项 ``` pip install -r requirements.txt ``` ### 2. 扫描网站 ``` python ghosttrace.py scan web example.com ``` ### 3. 分析文件 ``` python ghosttrace.py scan file document.pdf python ghosttrace.py scan file photo.jpg python ghosttrace.py scan file archive.zip ``` ### 4. 扫描文件夹 ``` python ghosttrace.py scan folder /path/to/ctf/files ``` ### 5. 启动网络仪表板 ``` python ghosttrace.py dashboard # 打开 http://127.0.0.1:5000 ``` ## 🏗️ 架构 ``` ghosttrace_x/ ├── engine.py # Core orchestrator ├── models.py # Finding, ScanReport dataclasses ├── config.py # Config loader (config.yaml) ├── logger.py # Rich-based logging + banner │ ├── modules/ │ ├── base.py # AbstractBaseModule interface │ ├── web_recon.py # Subdomain, ports, SSL, headers, fingerprint │ ├── discovery.py # Dir brute-force, endpoints, JS parsing │ ├── file_intelligence.py # PDF, DOCX, Image EXIF, ZIP, Binary │ ├── content_scanner.py # 18+ secret/key patterns │ ├── correlation.py # 8 cross-module correlation rules │ ├── intelligence.py # Risk scoring, attack surface │ └── recommendations.py # Actionable remediation advice │ ├── reporters/ │ ├── html_reporter.py # Dark-themed self-contained HTML report │ └── json_reporter.py # Structured JSON output │ └── web/ ├── app.py # Flask app factory ├── routes.py # API routes └── templates/ └── dashboard.html # Dark cyberpunk dashboard UI ``` ## ⚙️ CLI 参考 ``` # 获取帮助 python ghosttrace.py --help python ghosttrace.py scan --help # Web 侦察 python ghosttrace.py scan web python ghosttrace.py scan web --output html python ghosttrace.py scan web --output json python ghosttrace.py scan web --output both # default python ghosttrace.py scan web --no-discovery # skip dir brute-force python ghosttrace.py scan web --no-ports # skip port scanning # CTF 模式(快速扫描) python ghosttrace.py --ctf scan web # 文件分析 python ghosttrace.py scan file python ghosttrace.py scan file python ghosttrace.py scan file python ghosttrace.py scan file # 电子邮件地址 OSINT python ghosttrace.py scan email # 文件夹扫描 python ghosttrace.py scan folder ./extracted_ctf # 自动检测 python ghosttrace.py scan auto # Web 仪表板 python ghosttrace.py dashboard python ghosttrace.py dashboard --port 8080 ``` ## 📊 输出格式 报告默认保存到 `reports/` 目录。 | 格式 | 描述 | |--------|-------------| | HTML | 自包含的深色主题报告,包含严重性图表 | | JSON | 用于程序化处理的结构化数据 | ### 发现项模式 ``` { "id": "FIND-0001", "type": "Open Port", "severity": "High", "description": "Open port 3389/RDP on target", "source": "Web Recon / Port Scan", "target": "example.com", "recommendation": "RDP exposed — use VPN or restrict access.", "metadata": { "port": 3389, "service": "RDP" }, "timestamp": "2026-01-01T12:00:00" } ``` ## 🔹 模块 ### 1. 网络侦察模块 - **子域名枚举**:通过内置字典(134个条目)进行 DNS 解析 - **端口扫描**:基于异步套接字的扫描(20个常见端口) - **服务检测**: Banner 标识 - **技术栈指纹识别**:检测 WordPress、Django、React、Next.js、Express、Nginx、Cloudflare 等 15 种以上技术 - **HTTP 头部分析**:检查 7 个安全头(CSP、HSTS、X-Frame-Options 等) - **SSL/TLS 分析**:证书过期、协议版本(检测已弃用的 TLS 1.0/1.1) - **管理面板检测**:10 个常见管理路径 ### 2. 发现模块 - **目录暴力破解**:161 个路径,包括 `.env`、`.git`、`backup`、管理面板 - **端点发现**:从页面响应中爬取链接 - **JavaScript 解析**:从 JS 文件中提取 API 端点、路由和密钥 - **参数发现**:表单字段提取 ### 3. 文件情报模块 | 文件类型 | 提取内容 | |-----------|---------| | PDF | 作者、时间戳、嵌入的 URL、文本内容 | | DOCX | 作者、修改者、修订次数、超链接 | | JPG/PNG | EXIF 数据、GPS 坐标(含谷歌地图链接)、设备信息 | | ZIP/TAR | 文件列表、内容的递归子扫描 | | 二进制文件 | 可打印字符串、敏感关键字检测 | ### 4. 邮箱情报模块 - **一次性邮箱检查**:标记 10+ 个已知的一次性/临时邮箱提供商。 - **SPF 分析**:检查域名 TXT 记录中的邮箱防欺诈保护。 - **DMARC 分析**:评估 `_dmarc` 策略的严格性。 - **可送达性验证**:验证 MX 记录。 ### 5. 深度内容扫描器 使用 18+ 个正则表达式模式检测: - AWS Access Keys (AKIA...) - AWS Secret Keys - JWT 令牌 - GitHub 个人访问令牌 - Slack 令牌 - Stripe 密钥 - Google API 密钥 - 通用 API 密钥 / Bearer 令牌 - 私钥 (PEM) - 数据库连接字符串 - 硬编码的密码/密钥 - 内部 IP 地址 - 邮箱地址 ### 6. 关联引擎 (8 条规则) 1. **凭据 + 管理面板** → 关键攻击路径 2. **邮箱身份关联** → 跨渠道开源情报 3. **高风险端口 + 端点** → 广泛的攻击面 4. **GPS 位置 + 邮箱** → 物理/数字身份关联 5. **缺失安全头** → 配置错误集群 6. **暴露的敏感文件** → 关键数据泄露 7. **技术风险** → 特定技术的漏洞映射 8. **临界质量** → 综合风险升级 ### 7. 情报引擎 - 基于 CVSS 的风险评分(0-100) - 攻击面组装(开放端口、子域名、端点、邮箱、技术栈) - 执行摘要生成 ### 8. 建议引擎 - 将发现项类型映射到优先级(关键/高/中/低)修复步骤 - 具备上下文感知能力(例如,SSL 过期 → 使用 Let's Encrypt + Certbot 续订) - 具备关联感知能力的风险升级 ## 🔌 插件系统 通过扩展 `BaseModule` 创建自定义模块: ``` # 插件/my_plugin.py from ghosttrace_x.modules.base import BaseModule, ScanContext from ghosttrace_x.models import Finding, FindingType, Severity class MyPlugin(BaseModule): def __init__(self): super().__init__("My Plugin", "Description") async def run(self, context: ScanContext) -> list[Finding]: # Your scan logic here return [ Finding( type=FindingType.GENERAL, severity=Severity.INFO, description="Custom finding", source="My Plugin", target=context.target, ) ] ``` ## 🏁 CTF 模式 CTF 模式可加速扫描以用于竞赛: ``` # 通过 CLI 标志 python ghosttrace.py --ctf scan web target.ctf # 通过 config.yaml ctf_mode: enabled: true skip_modules: [port_scan] max_subdomains: 20 max_directories: 50 timeout: 5 ``` ## ⚙️ 配置 编辑 `config.yaml` 以自定义行为: ``` scan: timeout: 10 max_concurrent: 50 web_recon: max_subdomains: 100 check_ssl: true output: format: both # html, json, or both directory: reports/ ``` ## 📦 依赖项 | 包 | 用途 | |---------|---------| | `click` | CLI 框架 | | `httpx` | 异步 HTTP 客户端 | | `dnspython` | 用于子域名枚举的 DNS 解析 | | `rich` | 美观的终端输出 | | `flask` | 网络仪表板 | | `PyMuPDF` | PDF 分析 | | `python-docx` | DOCX 分析 | | `Pillow` + `piexif` | 图像 EXIF 提取 | | `PyYAML` | 配置文件解析 | ## 📁 项目结构 ``` foc_project/ ├── ghosttrace.py # CLI entry point ├── config.yaml # Configuration ├── requirements.txt # Dependencies ├── ghosttrace_x/ # Main package │ ├── engine.py │ ├── models.py │ ├── config.py │ ├── logger.py │ ├── modules/ │ ├── reporters/ │ └── web/ ├── wordlists/ │ ├── subdomains.txt # 134 common subdomains │ └── directories.txt # 161 common paths ├── plugins/ # Custom plugins ├── reports/ # Generated reports (auto-created) └── ghosttrace.log # Scan log file (auto-created) ``` ## 🔒 道德使用声明 本工具专为以下场景设计: - 经书面授权的渗透测试 - CTF 竞赛 - 在受控环境中的学习和安全研究 - 对您自身基础设施的安全审计 **切勿对您不拥有或未经明确书面授权测试的系统使用此工具。** *GHOSTTRACE-X v1.0.0 — 为安全专业人员和 CTF 玩家打造。*
标签:恶意代码分类, 逆向工具