SagarBiswas-MultiHAT/attack-surface-toolkit

GitHub: SagarBiswas-MultiHAT/attack-surface-toolkit

一款模块化的被动攻击面侦察工具包,通过OSINT和非侵入式技术对Web域名进行全面的外部暴露分析,并生成多格式评估报告和交互式攻击面图谱。

Stars: 0 | Forks: 0

# attack-surface-toolkit
![Python 3.11](https://img.shields.io/badge/Python-3.11-blue)   ![MIT License](https://img.shields.io/badge/License-MIT-green)   ![CI Status](https://static.pigsec.cn/wp-content/uploads/repos/2026/03/cf36896851140532.svg)   ![Tests](https://img.shields.io/github/actions/workflow/status/SagarBiswas-MultiHAT/attack-surface-toolkit/ci.yml?branch=main&label=tests)  
一个用于授权 Web 安全评估的被动攻击面 mapping 和侦察工具包。 ### 实时输出示例: - [google.com | attack_surface_graph.html](https://sagarbiswas-multihat.github.io/attack-surface-toolkit/output/google.com_2026-03-20_05-47-56/attack_surface_graph.html) - [google.com | report.html](https://sagarbiswas-multihat.github.io/attack-surface-toolkit/output/google.com_2026-03-20_05-47-56/report.html) - [reservebd.com | attack_surface_graph.html](https://sagarbiswas-multihat.github.io/attack-surface-toolkit/output/reservexbd.com_2026-03-20_05-41-31/attack_surface_graph.html) - [reservebd.com | report.html](https://sagarbiswas-multihat.github.io/attack-surface-toolkit/output/reservexbd.com_2026-03-20_05-41-31/report.html) - [sagarbiswas-multihat.github.io | attack_surface_graph.html](https://sagarbiswas-multihat.github.io/attack-surface-toolkit/output/sagarbiswas-multihat.github.io_2026-03-20_05-52-31/attack_surface_graph.html) - [sagarbiswas-multihat.github.io | report.html](https://sagarbiswas-multihat.github.io/attack-surface-toolkit/output/sagarbiswas-multihat.github.io_2026-03-20_05-52-31/report.html) ## 项目简介 本项目利用被动 OSINT 和非破坏性元数据收集技术,mapping Web 目标的外部暴露面。其构建初衷是生成安全顾问可以直接交给客户的输出:清晰的证据、切实的发现以及优先级明确的 remediation 指导。 工作流程侧重于从公共基础设施和历史归档中发现已可见的内容。它不执行利用、暴力破解、payload 注入或激进扫描。其目的是在开始任何侵入性测试之前,为团队提供其外部攻击面的可靠 baseline。 它也被设计为 Fiverr 作品集 deliverable:不仅具备技术功能,而且可直接用于展示。报告结构模拟真实的咨询 artifacts,包含面向非技术利益相关者的 executive summary 视图和面向工程师的详细附录。 ## 功能特性 该工具包运行基于模块的侦察,并将结果整合为一份评分评估。 - 通过 crt.sh、AlienVault OTX、HackerTarget、RapidDNS 和 archive 情报进行子域名枚举。 - DNS 分析涵盖 A、AAAA、MX、NS、TXT、CNAME、SOA、PTR 记录以及 SPF/DMARC/DKIM 姿态检查。 - WHOIS 和 ASN 丰富化,获取 registrar、域名生命周期、IP 所有权和托管背景信息。 - SSL/TLS 检查,验证 certificate 有效性、颁发者、SAN 暴露、protocol 姿态和信任指标。 - 通过 response headers、HTML indicators、cookies、scripts 和 favicon 指纹进行技术检测。 - 安全 header 审计,涵盖 CSP、HSTS、X-Frame-Options、X-Content-Type-Options、Referrer-Policy 及相关 controls。 - 攻击面 mapping,包括 links、forms、JavaScript assets、API-like routes 和常见 admin paths。 - Wayback Machine 历史 URL 分析,用于发现遗留 endpoints 和暴露的 artifact 模式。 - 加权暴露评分 engine,提供 0-100 分和严重性标签。 - 四种输出 deliverables:HTML 报告、JSON 报告、Markdown 报告和交互式攻击面 graph。 ## 报告输出 每次运行都会在 output 下创建一个带时间戳的文件夹,包含四项交付物。 - report.html → 深色主题客户报告,带固定侧边栏导航、动画评分仪表、可排序表格和适于打印的 CSS。 - report.json → 完整的机器可读数据集,适用于 automation pipelines、API ingestion 或 SOC workflows。 - report.md → 简洁的叙述性摘要,包含结构化发现和 emoji 风险标签,便于快速分享。 - attack_surface_graph.html → 域名关系和 discovered assets 的交互式 graph,按 node type 和 risk context 着色。 ## 架构 ``` attack-surface-toolkit/ ├── core/ → config, logging, rate limiting, models ├── modules/ → all recon modules ├── reporting/ → HTML, JSON, Markdown generators ├── graph/ → attack surface graph ├── tests/ → pytest test suite └── output/ → generated reports (per domain + timestamp) ``` `core` 定义 runtime contracts 和可靠性 controls,`modules` 收集证据,`reporting` 将发现转化为面向不同受众的内容,`graph` 提供交互式拓扑背景。 ## 安装 ### 方法 A — 标准方式 (venv) ``` git clone https://github.com/SagarBiswas-MultiHAT/attack-surface-toolkit.git cd attack-surface-toolkit python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate pip install -r requirements.txt ``` ### 方法 B — Docker ``` docker build -t attack-surface-toolkit . docker run -v $(pwd)/output:/app/output attack-surface-toolkit \ --domain example.com ``` ### 方法 C — Docker Compose 在 docker-compose.yml 中编辑域名,然后运行: ``` docker-compose up ``` ## 使用方法 ``` # 基础扫描 — 所有模块,所有输出 python main.py --domain example.com ``` 用于完整的 baseline 侦察和生成所有 deliverables。 ``` # 仅指定模块 python main.py --domain example.com --modules dns,ssl,headers ``` 当您需要对选定的 controls 进行针对性验证时使用。 ``` # 跳过 Wayback(扫描更快) python main.py --domain example.com --skip-wayback ``` 当历史暴露不在范围内,需要更快的运行速度时使用。 ``` # 无攻击图 python main.py --domain example.com --no-graph ``` 在受限环境中使用,不需要交互式 graph 输出时。 ``` # 选择输出格式 python main.py --domain example.com --output html,json ``` 当您只需要面向客户的 HTML 和机器可读的 JSON 时使用。 ``` # 自定义配置文件 python main.py --domain example.com --config custom_config.yaml ``` 用于团队特定设置、keys 和模块开关。 ## 配置 以下是完整的 config.yaml 演示,包含内联注释。 ``` general: output_dir: ./output # Base directory for timestamped run folders log_level: INFO # Logging verbosity: DEBUG, INFO, WARNING, ERROR request_timeout: 10 # Default request timeout (seconds) for modules max_concurrent_requests: 5 # Global async concurrency cap for outbound requests api_keys: securitytrails: "" # Optional API key for enhanced subdomain enrichment shodan: "" # Reserved optional key for future integrations virustotal: "" # Reserved optional key for future integrations modules: subdomain_enum: true # Passive subdomain discovery from OSINT sources dns_analysis: true # DNS records + misconfiguration checks whois_asn: true # WHOIS + ASN + hosting context enrichment ssl_tls: true # Certificate and TLS posture inspection tech_detection: true # Technology fingerprinting from headers/HTML/cookies header_audit: true # Security headers validation and findings surface_mapper: true # Depth-1 route/link/form/script extraction wayback: true # Historical URL intelligence via archive CDX attack_graph: true # Interactive graph generation output rate_limits: crtsh_delay: 1.0 # Delay between crt.sh requests (seconds) wayback_delay: 0.5 # Delay before Wayback calls (seconds) dns_concurrent: 10 # DNS query concurrency limit ``` ## 示例报告发现 | ID | 类别 | 风险 | 发现 | 建议 | |---|---|---|---|---| | HDR-001 | Security Headers | HIGH | 缺少 Content-Security-Policy header | 定义严格的 CSP,并首先通过 report-only 模式逐步实施。 | | SSL-EXP-001 | SSL/TLS | MEDIUM | Certificate 将在 21 天后过期 | 自动化更新并添加 certificate 过期告警。 | | DNS-DMARC-001 | DNS | MEDIUM | DMARC 记录缺失或无效 | 发布 DMARC policy 并监控聚合报告。 | | WB-001 | Wayback | HIGH | 历史 URL 表明存在暴露的 backup artifact | 验证移除情况,轮换 secrets,并阻止公共访问模式。 | ## 运行测试 ``` python -m pytest tests/ -v ``` 测试套件涵盖 config 验证、使用 mock 的 DNS 分析行为、子域名规范化/去重、暴露评分计算、SSL certificate 解析以及 JSON 报告 schema 预期。 ## 道德使用声明 请仅在您拥有的域名和基础设施上,或在您拥有明确书面授权进行评估的地方使用此工具包。它专为被动侦察和非破坏性评估 workflows 设计,而非利用。作者对滥用不承担任何责任。 ## 许可证 MIT License。 ## 作者 / 作品集说明 作为展示被动 OSINT、攻击面 mapping 和安全报告技能的作品集项目构建。作为 Fiverr 服务提供,用于授权安全评估。
标签:ASM, C++17, DNS分析, ESC4, ESC8, GitHub, HTTP头分析, OSINT, Python, SSL证书分析, Wayback Machine, WHOIS查询, 代码生成, 协议探测, 反取证, 反汇编, 后端开发, 安全工具库, 安全规则引擎, 安全评估, 实时处理, 技术栈识别, 文件查看, 无后门, 渗透测试工具, 社会工程学, 结构化查询, 网络安全, 自动化安全, 被动侦察, 请求拦截, 隐私保护