sanaullahcode/ai-threat-hunting-agent

GitHub: sanaullahcode/ai-threat-hunting-agent

一个自主运行的 AI 威胁狩猎智能体,自动从 NVD 获取最新 CVE 并按真实风险分级,为 SOC 团队生成每日优先级威胁报告。

Stars: 1 | Forks: 0

# AI 威胁狩猎与威胁情报 Agent **一个自主运行的智能体,能够狩猎最新发布的 CVE,根据真实世界风险进行分类,并在您的 SOC 团队登录之前编写好每日威胁报告。** 由 **Sana Ullah** 开发 [![Python](https://img.shields.io/badge/Python-3.10%2B-3776AB?logo=python&logoColor=white)](https://www.python.org/) [![NVD API](https://img.shields.io/badge/Data%20Source-NVD%20API%20v2.0-1F6FEB)](https://nvd.nist.gov/developers) [![Claude API](https://img.shields.io/badge/LLM-Claude%20API-D97757)](https://www.anthropic.com/) [![License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
## 为什么开发此项目 每周都有数百个 CVE 发布,没有任何分析师能够完整阅读每一份公告。这个 Agent 会自动执行第一遍筛选:它提取最新的内容,根据实际的严重程度和利用信号对其进行排名,并返回一份简短的报告,准确告诉 SOC 团队今天需要关注什么,而不是提供一份原始、未排名的数据流。 ## 工作原理 ``` NVD API v2.0 │ fetch CVEs published in the last N days ▼ ┌────────────────┐ │ nvd_client.py │ └───────┬────────┘ │ raw CVE list ▼ ┌────────────────┐ CVSS score + exploitation keywords │ cve_scorer.py │ ─────────────────────────────────────▶ Critical / High / Medium / Low └───────┬────────┘ │ top priority CVEs ▼ ┌────────────────┐ │ threat_agent.py│ ───▶ Claude API ───▶ daily threat report (terminal + JSON) └────────────────┘ ``` ## 核心功能 | 功能 | 详情 | |---|---| | 数据收集 | 直接从 NVD 提取最新发布的 CVE,无需爬取 | | 分类 | 由 CVSS 基础分数驱动的优先级划分 | | 利用信号 | 标记描述中提及主动利用或公开 PoC 的内容 | | 报告生成 | Claude 编写执行摘要、检测指南和缓解步骤 | | 记录保存 | 每次运行都会保存为带有时间戳的 JSON 报告 | ## 向它提问 ``` What are today's most dangerous vulnerabilities? ``` ## 示例输出 ``` $ python src/threat_agent.py ┌──────────────┬──────┬──────────┬─────────────────────────────┐ │ CVE ID │ CVSS │ Priority │ Exploitation Signal │ ├──────────────┼──────┼──────────┼─────────────────────────────┤ │ CVE-2026-XXXX│ 9.8 │ Critical │ Likely high risk (keyword) │ │ CVE-2026-XXXX│ 7.5 │ High │ No strong exploitation signal│ └──────────────┴──────┴──────────┴─────────────────────────────┘ Daily Threat Report Two critical vulnerabilities were published in the last 24 hours affecting remote authentication services. Both show indicators consistent with early exploitation attempts... ``` ## 项目结构 ``` ai-threat-hunting-agent/ ├── src/ │ ├── threat_agent.py # CLI entry point │ ├── nvd_client.py # NVD API client │ └── cve_scorer.py # priority banding and exploitation heuristic ├── reports/ # generated daily threat reports ├── tests/ │ └── test_cve_scorer.py ├── requirements.txt └── .env.example ``` ## 安装说明 ``` git clone https://github.com/sanaullahcode/ai-threat-hunting-agent.git cd ai-threat-hunting-agent pip install -r requirements.txt cp .env.example .env ``` 在 `.env` 中添加你的密钥: ``` ANTHROPIC_API_KEY=your_key_here NVD_API_KEY=optional_but_removes_strict_rate_limiting ``` ## 使用说明 运行标准的每日狩猎: ``` python src/threat_agent.py ``` 查看更早的历史记录并提取更多结果: ``` python src/threat_agent.py --days 3 --limit 15 ``` ## 测试 ``` pytest tests/ ``` ## 设计决策 **CVSS 分数决定优先级,关键词仅作为附加信号。** 划分逻辑以标准化的 CVSS 基础分数为基准,以确保结果保持一致且经得起推敲,而利用关键词检查被视为辅助标志,而非主要的排名因素。 **默认提供离线回退方案。** 如果未设置 Claude API 密钥,Agent 依然会生成可用的基于规则的摘要,而不是直接报错失败,从而确保分类表本身保持实用性。 ## 路线图 - [ ] 集成 MISP feed 以获取社区威胁情报 - [ ] 集成 Shodan 以检查易受攻击服务的互联网暴露情况 - [ ] 支持每日定时运行,并通过 Slack 或电子邮件发送报告 - [ ] 支持跨已保存 JSON 报告的历史趋势查看 ## 许可证 基于 [MIT 许可证](LICENSE) 发布。 ## 作者 **Sana Ullah** 软件工程学士,FUUAST Islamabad 专注领域:网络安全、AI/ML、软件工程 GitHub: [sanaullahcode](https://github.com/sanaullahcode)
标签:Python, 威胁情报, 安全规则引擎, 安全运营, 开发者工具, 扫描框架, 无后门, 漏洞预警, 自动化分析, 跨站脚本, 逆向工具