Qwortie/ioc-enricher
GitHub: Qwortie/ioc-enricher
一款命令行 IOC 情报补充工具,可并发查询三大威胁情报源并自动给出风险判定,帮助 SOC 分析师快速完成告警分流。
Stars: 0 | Forks: 0
# IOC 情报补充工具
一款命令行分流工具,可针对三个威胁情报源同时对 IP 地址、文件哈希和域名进行情报补充,返回结构化判定结果,并可选择生成适用于 SOC 调查的 Markdown 报告。
旨在自动化执行在告警分流期间所进行的手动情报补充步骤——这与我在[钓鱼工单记录](https://github.com/Qwortie/Phishing-tickets)中记录的工作流程相同。
## 功能
- 自动检测 IOC 类型(IPv4、MD5、SHA1、SHA256、域名)
- 通过 ThreadPoolExecutor 并发查询 AbuseIPDB、VirusTotal 和 Shodan
- 返回评分判定结果:CLEAN / SUSPICIOUS / MALICIOUS
- 导出结构化 JSON,以便接入 TheHive 或 SOAR pipeline
- 生成 Markdown 分流报告,并预填建议操作
- 批处理模式,支持从文本文件处理 IOC 列表
## 支持的 IOC 类型
| 类型 | 查询的来源 |
|------|----------------|
| IPv4 | AbuseIPDB · VirusTotal · Shodan |
| MD5 / SHA1 / SHA256 | VirusTotal |
| 域名 | VirusTotal |
## 设置
**环境要求:** Python 3.8+
```
git clone https://github.com/Qwortie/ioc-enricher
cd ioc-enricher
python -m venv venv
venv\Scripts\activate # Windows
source venv/bin/activate # Linux/Mac
pip install -r requirements.txt
```
将 `.env.example` 复制到 `.env` 并添加您的 API 密钥:
ABUSEIPDB_KEY=your_key_here
VIRUSTOTAL_KEY=your_key_here
SHODAN_KEY=your_key_here
这三个 API 均提供免费层级,足以满足分流使用的需求。
## 用法
**单个 IOC:**
```
python enricher.py 193.32.162.157
python enricher.py 44d88612fea8a8f36de82e1278abb02f
python enricher.py malware-domain.com
```
**JSON 导出:**
```
python enricher.py 193.32.162.157 --json
```
**Markdown 分流报告:**
```
python enricher.py 193.32.162.157 --report
```
**批处理模式:**
```
python enricher.py --batch iocs.txt
python enricher.py --batch iocs.txt --report
```
## 输出示例
```
Detected IOC type: ip
Querying IOC: 193.32.162.157
Verdict: MALICIOUS
[AbuseIPDB]
Abuse Score: 23%
Total Reports: 15
Country: RO
ISP: UNMANAGED LTD
Tor Node: False
[VirusTotal]
Detections: 9/91 vendors
Suspicious: 2
ASN Owner: Unmanaged Ltd
ASN: 47890
[Shodan]
No data found for this IP
```
## 判定评分逻辑
| 条件 | 判定结果 |
|-----------|---------|
| AbuseIPDB 评分 ≥ 75% 或 VirusTotal 检出数 ≥ 5 | MALICIOUS |
| AbuseIPDB 评分 ≥ 25% 或 VirusTotal 检出数 ≥ 1 | SUSPICIOUS |
| 均未达到阈值 | CLEAN |
## MITRE ATT&CK 背景
此工具补充的 IOC 通常关联以下技术:
| 技术 | ID |
|-----------|-----|
| Command and Control — Web Protocols | T1071.001 |
| Ingress Tool Transfer | T1105 |
| Phishing — Spearphishing Attachment | T1566.001 |
| Exfiltration Over C2 Channel | T1041 |
## 项目结构
```
ioc-enricher/
├── enricher.py # Main entry point and all query/output logic
├── .env.example # API key template
├── requirements.txt
└── README.md
```
## 依赖要求
requests
python-dotenv
标签:Python, 威胁情报, 库, 应急响应, 开发者工具, 无后门, 逆向工具