faizaanmir/ioc-enrichment-tool
GitHub: faizaanmir/ioc-enrichment-tool
一款 Python 命令行工具,通过 VirusTotal 和 AbuseIPDB API 对 IP、域名、URL 和文件哈希等妥协指标进行批量富化查询并导出结果。
Stars: 0 | Forks: 0
# IOC 富化工具
一款 Python 命令行工具,用于通过威胁情报 API 对妥协指标(IOC)进行批量富化。支持 IP 地址、域名、URL 和文件哈希。
专为 SOC 分析师设计,帮助其在事件响应和威胁狩猎期间快速进行分诊并为 IOC 补充上下文背景。
## 演示
```
$ python enrich.py --file iocs.txt
[*] Enriching 4 IOC(s) via: virustotal, abuseipdb
[1/4] 185.220.101.45 (ip) ... DONE
[2/4] malware-c2.xyz (domain) ... DONE
[3/4] 44d88612fea8a8f36de82e1278abb02f (md5) ... DONE
[4/4] https://evil-phish.ru/login (url) ... DONE
------------------------------------------------------------------------------------------
IOC | Type | VT Detections | Abuse Score | Country | ASN/ISP | Tags
------------------------------------------------------------------------------------------
185.220.101.45 | ip | 18/94 | 100% | DE | AS205100 F3 Netze e.V. | TOR, Scanner, Proxy
malware-c2.xyz | domain | 41/94 | N/A | RU | AS49505 Selectel | Malware, C2, Phishing
44d88612fea8a8f36... | md5 | 68/72 | N/A | N/A | N/A | Trojan, Ransomware
https://evil-phish.ru/.. | url | 55/94 | N/A | RU | N/A | Phishing
------------------------------------------------------------------------------------------
$ python enrich.py --file iocs.txt --output results.csv
[+] Results saved to: results.csv
```
## 支持的 API
| API | IOC 类型 | 免费套餐 |
|---|---|---|
| [VirusTotal](https://www.virustotal.com) | IP, 域名, URL, 哈希 | 500 次请求/天 |
| [AbuseIPDB](https://www.abuseipdb.com) | IP | 1,000 次请求/天 |
## 设置
### 1. 克隆仓库
```
git clone https://github.com/faizaanmir/ioc-enrichment-tool.git
cd ioc-enrichment-tool
```
### 2. 安装依赖
```
pip install -r requirements.txt
```
### 3. 配置 API 密钥
```
cp config.example.ini config.ini
```
编辑 `config.ini`:
```
[virustotal]
api_key = YOUR_VT_API_KEY_HERE
[abuseipdb]
api_key = YOUR_ABUSEIPDB_API_KEY_HERE
```
在以下地址获取免费的 API 密钥:
- VirusTotal: https://www.virustotal.com/gui/join-us
- AbuseIPDB: https://www.abuseipdb.com/register
## 用法
### 单个 IOC
```
python enrich.py --ioc 8.8.8.8
python enrich.py --ioc malicious-domain.com
python enrich.py --ioc 44d88612fea8a8f36de82e1278abb02f
```
### 从文件批量查询(每行一个 IOC)
```
python enrich.py --file iocs.txt
```
### 输出至 CSV
```
python enrich.py --file iocs.txt --output results.csv
```
### 指定要查询的 API
```
python enrich.py --ioc 1.2.3.4 --apis virustotal abuseipdb
```
## IOC 文件格式
纯文本,每行一个 IOC。注释和空行将被忽略:
```
# 来自威胁情报报告的已知 C2 IP
185.220.101.45
malware-c2.xyz
44d88612fea8a8f36de82e1278abb02f
# Phishing URL
https://evil-phish.ru/login
```
该工具会自动检测 IOC 类型(IP、域名、URL、MD5、SHA1、SHA256)——无需手动标记。
## 项目结构
```
ioc-enrichment-tool/
├── enrich.py # Main entry point
├── enrichers/
│ ├── virustotal.py # VT API v3 handler
│ └── abuseipdb.py # AbuseIPDB API v2 handler
├── utils/
│ ├── ioc_parser.py # IOC type detection
│ └── output.py # Terminal table + CSV formatter
├── config.example.ini # Config template
├── requirements.txt
└── README.md
```
## 环境要求
- Python 3.8+
- `requests` 库(参见 `requirements.txt`)
## 免责声明
仅供授权的安全操作使用。未经授权,请勿将客户或敏感的 IOC 提交至公开的威胁情报 API。
*作者:Faizaan Sajjad — 安全专家,Orange Cyber Defense*
标签:Python, 威胁情报, 安全运营, 库, 应急响应, 开发者工具, 扫描框架, 无后门, 逆向工具