IsaacInCyber/sentinel-siem-enrichment
GitHub: IsaacInCyber/sentinel-siem-enrichment
这是一个Python脚本,用于通过外部威胁情报和上下文数据自动丰富Microsoft Sentinel SIEM数据,以提升安全事件分类效率。
Stars: 0 | Forks: 0
# Sentinel SIEM 数据丰富化
用于通过威胁情报、地理位置和上下文数据丰富 Microsoft Sentinel SIEM 数据的 Python 脚本。
## 概述
此工具可自动使用外部威胁情报和上下文数据丰富安全事件,从而加快分类速度并做出更明智的事件响应决策。
## 功能
- **IP 地址丰富化**:通过 AbuseIPDB 获取地理位置数据、ISP 信息和威胁信誉评分
- **域名丰富化**:可疑顶级域名检测、域名特征分析
- **文件哈希丰富化**:集成 VirusTotal 以进行恶意软件检测和分类
- **用户上下文丰富化**:与 Active Directory/Azure AD 数据的集成点
- **风险评分计算**:基于聚合的丰富化信号进行自动评分
## 前置条件
- Python 3.8+
- Microsoft Sentinel 工作区 (Log Analytics Workspace ID 和 Key)
- API 密钥 (可选但推荐):
- [AbuseIPDB](https://www.abuseipdb.com/) - IP 信誉检查
- [VirusTotal](https://www.virustotal.com/) - 文件哈希分析
## 安装
```
git clone https://github.com/IsaacInCyber/sentinel-siem-enrichment.git
cd sentinel-siem-enrichment
pip install requests
```
## 配置
在 `enrichment.py` 中更新 `CONFIG` 字典,填入您的凭据:
```
CONFIG = {
"workspace_id": "YOUR_WORKSPACE_ID",
"shared_key": "YOUR_SHARED_KEY",
"abuseipdb_key": "YOUR_ABUSEIPDB_KEY",
"virustotal_key": "YOUR_VIRUSTOTAL_KEY"
}
```
## 使用方法
### 单个事件丰富化
```
from enrichment import enrich_event
event = {
"event_type": "suspicious_login",
"source_ip": "185.220.101.1",
"username": "john.doe",
"domain": "suspicious-site.tk"
}
enriched = enrich_event(event)
print(f"Risk Score: {enriched['risk_score']}")
```
### 批量处理
```
from enrichment import process_events
events = [event1, event2, event3]
enriched_events = process_events(events)
```
### 独立丰富化函数
```
from enrichment import enrich_ip, enrich_domain, enrich_file_hash
# IP 富化与威胁情报
ip_data = enrich_ip("8.8.8.8", api_key="YOUR_ABUSEIPDB_KEY")
# Domain 分析
domain_data = enrich_domain("example.tk")
# File hash 查询
hash_data = enrich_file_hash("e3b0c44298fc1c14...", api_key="YOUR_VT_KEY")
```
## 输出格式
丰富的事件包含一个 `enrichments` 对象和一个计算出的 `risk_score`:
```
{
"event_type": "suspicious_login",
"source_ip": "185.220.101.1",
"enrichments": {
"source_ip": {
"country": "Germany",
"isp": "Example ISP",
"is_suspicious": true,
"abuse_confidence_score": 85,
"threat_level": "high"
}
},
"risk_score": 50
}
```
## 集成选项
- **Azure Functions**:部署为无服务器函数以实现实时丰富化
- **逻辑应用**:在 Sentinel 剧本中用作连接器
- **计划任务**:作为 cron 作业运行以进行批量处理
- **Sentinel 监视列表**:将高风险指标导出到监视列表
## 扩展脚本
按照以下模式创建函数来添加新的丰富化数据源:
```
def enrich_custom_source(indicator: str, api_key: str = None) -> Dict:
enrichment = {
"indicator": indicator,
"enrichment_time": datetime.utcnow().isoformat()
}
# Add your enrichment logic here
return enrichment
```
## 许可证
MIT
## 作者
Isaac Amoussou-Kpakpa - [IsaacInCyber](https://github.com/IsaacInCyber)
标签:AbuseIPDB集成, Active Directory集成, AMSI绕过, Azure AD集成, IP信誉, Microsoft Sentinel, SIEM增强, Sigma 规则, VirusTotal集成, 上下文数据, 地理定位, 域名分析, 威胁情报, 威胁检测, 安全信息与事件管理, 开发者工具, 批量数据处理, 搜索引擎爬取, 数据增强, 文件哈希分析, 网络安全, 自动化威胁检测, 逆向工具, 隐私保护, 风险评分