threatcraft-co/theory

GitHub: threatcraft-co/theory

自动化威胁行为体情报聚合工具,从多源公开情报生成结构化档案,支持 STIX 导出和 LLM 情报综合。

Stars: 0 | Forks: 1

![Theory Logo](https://static.pigsec.cn/wp-content/uploads/repos/2026/04/60ff43c2b5013747.png) **面向所有人的多源威胁行为体情报。** THEORY 是企业威胁情报平台的开源替代方案。它通过聚合来自 MITRE ATT&CK、Malpedia、AlienVault OTX、SigmaHQ、ThreatFox、CISA 和供应商研究博客的数据,生成分析员级的威胁行为体档案 —— 然后可选择使用您选择的 LLM 来综合最近的情报文章。 专为威胁情报分析师、检测工程师、安全研究人员和学生打造,他们坚信优质的情报不应需要六位数的订阅费用。 ``` python theory.py --actor APT28 --sources mitre,malpedia,otx,sigma,threatfox,vendor ``` ## THEORY 生成的内容 对于任何受支持的威胁行为体,THEORY 会生成: - **TTP 表** — 每项已知技术及其战术、置信度评分和检测指导 - **检测机会** — 直接映射到行为体 TTP 的 Sigma 规则 - **恶意软件清单** — 所有相关的家族、描述及别名 - **IOC 表** — 来自 OTX 和 ThreatFox 的去重指标,包含置信度评分和恶意软件家族归属 - **近期情报** — 由 LLM 综合整理的近期供应商研究文章摘要,附带来源归属和链接 - **目标行业** 和 **攻击活动** 输出格式:终端档案、markdown、JSON、STIX 2.1(用于 MISP/OpenCTI/Sentinel)以及 IOC CSV。 ## 快速开始 ``` # Clone 仓库 git clone https://github.com/threatcraft-co/theory cd theory # 创建虚拟环境并安装依赖 python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate pip install -r requirements.txt # 下载 ATT&CK bundle (MITRE source 必需) mkdir -p .cache curl -L https://github.com/mitre-attack/attack-stix-data/raw/master/enterprise-attack/enterprise-attack.json \ -o .cache/enterprise-attack.json # 配置你的 API keys cp .env.example .env # 编辑 .env 并添加你的 OTX_API_KEY (免费获取地址 otx.alienvault.com) # 运行你的第一个 dossier python theory.py --actor APT28 ``` 就是这样。您的第一份档案将在终端中呈现,并保存到 `output/dossiers/apt28.md`。 ## 来源 | Key | Source | 需要认证 | 缓存 | |---|---|---|---| | `mitre` | MITRE ATT&CK (local bundle) | None | 7 days | | `cisa` | CISA Advisories + KEV | None | Per request | | `malpedia` | Malpedia malware database | None | Per request | | `otx` | AlienVault OTX | `OTX_API_KEY` | Per request | | `sigma` | SigmaHQ detection rules | `GITHUB_TOKEN` (optional) | 7 days | | `threatfox` | ThreatFox IOCs | None | 24 hours | | `vendor` | Vendor intel synthesis (LLM) | LLM API key | 7 days | ``` # 使用 --list-sources 查看实时状态 python theory.py --list-sources ``` ## 用法 ### 基础档案 ``` python theory.py --actor APT28 python theory.py --actor "Fancy Bear" # alias resolution python theory.py --actor "Forest Blizzard" # same actor, different name ``` ### 选择来源 ``` # 默认 (快速,无 sigma) python theory.py --actor APT28 --sources mitre,malpedia,otx # 完整 enrichment python theory.py --actor APT28 --sources mitre,malpedia,otx,sigma,threatfox # 包含 vendor intelligence synthesis (需要在 .env 中配置 LLM key) python theory.py --actor APT28 --sources mitre,malpedia,otx,sigma,threatfox,vendor ``` ### 输出格式 ``` # 终端 + markdown 文件 (默认) python theory.py --actor APT28 # 原始 JSON profile python theory.py --actor APT28 --output json # STIX 2.1 bundle (导入到 MISP, OpenCTI, Sentinel) python theory.py --actor APT28 --output stix # 仅 IOC CSV (用于 SIEM lookup tables) python theory.py --actor APT28 --sources mitre,otx,threatfox --output csv # 一次性生成所有格式 python theory.py --actor APT28 --output all # 仅打印 — 不写入文件 python theory.py --actor APT28 --no-save ``` ### 浏览可用内容 ``` python theory.py --list-actors # 50+ supported actors with aliases python theory.py --list-sources # all sources with auth and cache info ``` ### 维护 ``` # 刷新 ATT&CK bundle + 清除 Sigma/ThreatFox caches python theory.py --update-bundles ``` ### 详细模式 ``` python theory.py --actor APT28 --sources mitre,otx --verbose ``` ## 别名解析 THEORY 能通过所有名称识别 50 多个行为体。任何别名都会解析到同一个档案: ``` python theory.py --actor "Cozy Bear" # → APT29 python theory.py --actor "Midnight Blizzard" # → APT29 python theory.py --actor "Nobelium" # → APT29 python theory.py --actor "NOBELIUM" # → APT29 (case-insensitive) ``` ``` python theory.py --list-actors # see all actors and their aliases ``` ## 供应商情报综合 当您在来源中添加 `vendor` 时,THEORY 会从 35 个以上的威胁研究博客(Mandiant、Google TAG、Unit 42、Secureworks、Recorded Future、Okta、CrowdStrike、Kaspersky GReAT 等)获取最新文章,并使用 LLM 来综合每篇文章中关于您所查询行为体的具体披露内容。 ``` # 1. 在 .env 中设置你的首选 provider 和 API key THEORY_LLM_PROVIDER=vendor # or claude, openai, ollama LLM_API_KEY=your_key # get yours at vendor.agnostic.com # 2. 使用 synthesis 运行 python theory.py --actor "Lazarus Group" --sources mitre,malpedia,otx,vendor ``` 档案将包含一个 **近期情报** 部分: ``` ● Recorded Future 2026-01-07 HIGH relevance GRU-Linked BlueDelta Evolves Credential Harvesting APT28 evolved credential-harvesting campaigns targeting government, energy, and research organizations across Europe and Eurasia as of early 2026, reflecting a shift toward intensified collection against critical infrastructure. Context: This reflects an ongoing shift toward persistent, low-detection-risk credential harvesting as a precursor to targeted destructive operations. https://recordedfuture.com/research/... ``` 综合结果会缓存 7 天 —— 后续运行将是即时的。 ## 添加自定义订阅源 将您自己的 RSS 订阅源添加到 `config/feeds.yaml`: ``` custom: - name: My Internal TI Feed url: https://internal.company.com/threat-intel rss: https://internal.company.com/threat-intel/rss type: rss tier: 2 apt_focus: true tags: [internal, custom] enabled: true ``` 对于付费墙来源,将会话 cookie 添加到 `.env`: ``` FEED_COOKIE_RECORDED_FUTURE=your_session_cookie_here ``` ## STIX 2.1 导出 THEORY 生成有效的 STIX 2.1 包,可导入至: - **MISP** — 通过 `Events → Import → STIX 2.x` 导入 - **OpenCTI** — 通过 STIX connector 导入 - **Splunk Enterprise Security** — 通过 TAXII connector 导入 - **Microsoft Sentinel** — 通过 Threat Intelligence data connector 导入 ``` python theory.py --actor APT28 --sources mitre,malpedia,otx --output stix # 写入: output/dossiers/apt28.stix.json ``` 该包包含:identity、intrusion-set、attack-pattern、malware、indicator 对象(含 STIX patterns)、relationship 对象以及一个 report 包装器。 ## 架构 ``` theory.py ← CLI entry point and pipeline orchestrator collectors/ mitre_attack.py ← MITRE ATT&CK (local STIX bundle) cisa_advisories.py ← CISA advisories + KEV + alias table malpedia.py ← Malpedia malware database alienvault_otx.py ← AlienVault OTX pulses and IOCs sigma_rules.py ← SigmaHQ GitHub search (enrichment) threatfox.py ← ThreatFox IOC database (enrichment) vendor_intel.py ← RSS feed fetcher + relevance scorer intelligence_synthesizer.py ← LLM provider abstraction + synthesis processors/ normalizer.py ← Scaffold normalizer deduplicator.py ← Cross-source deduplication mappers/ mitre.py ← MITRE ATT&CK mapper cisa.py ← CISA mapper reporters/ dossier.py ← Rich terminal + markdown output json_reporter.py ← JSON profile export stix_reporter.py ← STIX 2.1 bundle export csv_reporter.py ← IOC-only CSV export config/ feeds.yaml ← Vendor intelligence feed registry tests/ ← 296 passing tests across 9 phases ``` ## 运行测试 ``` pytest tests/ -v # all 296 tests pytest tests/test_stix_reporter.py -v # STIX only pytest tests/test_phase9_vendor_intel.py -v # vendor intel only ``` 所有测试完全离线运行 —— 测试套件不需要 API 密钥。 ## 系统要求 - Python 3.11+ - 依赖项位于 `requirements.txt` (Rich, requests, python-dotenv) - ATT&CK bundle(由快速开始步骤 3 下载) - API keys:使用 OTX source 需要 OTX 密钥,其他为可选 ## 贡献 THEORY 是开源的,欢迎社区贡献。 **添加新行为体** — 编辑 `collectors/cisa_advisories.py` 并在 `ALIAS_TABLE` 中添加条目: ``` "Actor Name": frozenset({ "actor name", "alias one", "alias two", "mitre-id", }), ``` **添加新来源** — 请参阅 `CONTRIBUTING.md` 获取关于实施 collector、mapper 和测试套件的完整指南。 **添加供应商订阅源** — 编辑 `config/feeds.yaml` 并添加到 `sources` 列表。 **报告问题** — 在 `github.com/threatcraft-co/theory/issues` 提交 issue。 ## 法律声明 THEORY 汇总公开的第三方数据。请参阅 `DISCLAIMER.md` 和 `LEGAL.md` 了解完整条款,包括 GDPR 条款和授权安全研究使用指南。 ## 许可证 MIT License — 详情请参阅 `LICENSE`。 *由 [Threatcraft](https://github.com/threatcraft-co) 构建 —— 面向安全社区的开源威胁情报。*
标签:APT 分析, C2, DAST, ESC4, IOC 提取, IP 地址批量处理, LLM 应用, OpenCTI, OSINT, Python, Sigma 规则, STIX, TTP 提取, 域名分析, 威胁分析, 威胁情报, 威胁搜寻, 密码管理, 开发者工具, 恶意软件分析, 情报聚合, 攻击者画像, 无后门, 无线安全, 网络安全, 网络安全审计, 自动化侦查工具, 自动化报告, 逆向工具, 隐私保护