InfoSecJay/threat-detection-explorer
GitHub: InfoSecJay/threat-detection-explorer
一个用于聚合、标准化与对比多厂商安全检测规则的可视化探索平台。
Stars: 0 | Forks: 0
# 检测探索器




**在一个地方探索、比较和跟踪多个安全厂商的开源检测规则。**
🌐 **在线站点: [detectionexplorer.io](https://detectionexplorer.io)**

检测探索器摄入并标准化来自 6 个主要开源安全内容仓库的检测规则,形成统一的模式,实现跨厂商比较、MITRE ATT&CK 覆盖分析以及覆盖缺口识别。
### 为什么要这样做?
检测工程师每天使用多种规则格式工作——Sigma YAML、Elastic TOML、Splunk YAML——每种格式都有不同的模式、严重级别和元数据结构。检测探索器将所有规则规范化为统一的搜索界面,使您可以:
- **搜索与过滤**:对 6 个厂商进行全文搜索,按严重性、状态以及 MITRE 战术/技术进行过滤
- **比较覆盖范围**:针对任意 MITRE 技术或关键词比较各厂商的覆盖情况
- **识别缺口**:找出某个厂商覆盖而另一个厂商缺失的技术
- **保持最新**:同步并重新摄入以拉取每个仓库的最新规则
- **导出结果**:将过滤结果导出为 JSON 或 CSV 用于后续使用
### 支持的来源
| 仓库 | 格式 | 规则 |
|---|---|---|
| [SigmaHQ](https://github.com/SigmaHQ/sigma) | YAML | |
| [Elastic Detection Rules](https://github.com/elastic/detection-rules) | TOML | |
| [Splunk Security Content](https://github.com/splunk/security_content) | YAML | |
| [Sublime Rules](https://github.com/sublime-security/sublime-rules) | YAML | |
| [Elastic Protections](https://github.com/elastic/protections-artifacts) | TOML | |
| [LOLRMM](https://github.com/magicsword-io/LOLRMM) | YAML | |
## 开发
### 快速开始
```
# 克隆仓库
git clone git@github.com:InfoSecJay/threat-detection-explorer.git
cd threat-detection-explorer
# 后端设置
cd backend
python -m venv venv
venv\Scripts\activate # Windows
# source venv/bin/activate # macOS/Linux
pip install -r requirements.txt
# 前端设置(在新终端中)
cd frontend
npm install
# 运行(在独立终端中)
# 终端 1 - 后端:
cd backend && python run.py
# 终端 2 - 前端:
cd frontend && npm run dev
```
前端将在 `http://localhost:5173` 提供,API 将在 `http://localhost:8000` 提供。
### 先决条件
- Python 3.11+
- Node.js 18+
- Git
### 架构
```
threat_detection_explorer/
├── backend/ # FastAPI Python backend
│ ├── app/
│ │ ├── api/ # REST API routes
│ │ ├── models/ # SQLAlchemy database models
│ │ ├── parsers/ # Vendor-specific rule parsers
│ │ ├── normalizers/ # Rule normalization logic
│ │ └── services/ # Business logic services
│ └── tests/ # Pytest test suite
├── frontend/ # React TypeScript frontend
│ └── src/
│ ├── components/
│ ├── pages/
│ ├── hooks/
│ └── services/
└── data/ # Runtime data (git-ignored)
├── repos/ # Cloned repositories
└── threat_detection.db # SQLite database
```
### 用法
#### 1. 同步仓库
首次使用时,同步检测规则仓库:
1. 进入仪表板
2. 点击每个仓库(SigmaHQ、Elastic、Splunk 等)的“同步”按钮
3. 等待克隆/拉取完成
#### 2. 摄入规则
同步后,将规则摄入数据库:
1. 点击每个已同步仓库的“摄入”按钮
2. 等待解析和标准化完成
#### 3. 探索检测
- **浏览**:进入“检测”页面搜索和过滤规则
- **比较**:使用“比较”页面查看各厂商的覆盖情况
- **导出**:将过滤结果下载为 JSON 或 CSV
### API 端点
#### 健康检查
- `GET /api/health` - 健康检查
#### 仓库
- `GET /api/repositories` - 列出所有仓库
- `POST /api/repositories/{name}/sync` - 同步仓库
- `POST /api/repositories/{name}/ingest` - 从仓库摄入规则
#### 检测
- `GET /api/detections` - 列出检测(支持过滤)
- `GET /api/detections/{id}` - 获取检测详情
- `GET /api/detections/statistics` - 获取统计信息
#### 比较
- `GET /api/compare?technique=T1059` - 按 MITRE 技术比较
- `GET /api/compare?keyword=powershell` - 按关键词比较
- `GET /api/compare/coverage-gap?base_source=sigma&compare_source=elastic` - 查找覆盖缺口
#### 导出
- `POST /api/export` - 将检测导出为 JSON 或 CSV
### 标准化模式
每个检测都会标准化为:
```
{
"id": "uuid",
"source": "sigma | elastic | splunk | sublime | elastic_protections | lolrmm",
"title": "Detection title",
"description": "Detection description",
"author": "Author name",
"status": "stable | experimental | deprecated | unknown",
"severity": "low | medium | high | critical | unknown",
"log_sources": ["windows", "linux", ...],
"data_sources": ["sysmon", "security_event", ...],
"mitre_tactics": ["TA0002", ...],
"mitre_techniques": ["T1059", "T1059.001", ...],
"detection_logic": "Human-readable detection logic",
"tags": ["tag1", "tag2", ...],
"false_positives": ["Known false positive scenarios", ...],
"references": ["https://...", ...],
"source_file": "path/to/rule.yml",
"source_repo_url": "https://github.com/...",
"rule_created_date": "2024-01-15",
"rule_modified_date": "2024-06-20"
}
```
### 运行测试
```
cd backend
pytest tests/ -v
```
### 配置
环境变量(可在 `.env` 中设置):
- `DEBUG` - 启用调试模式(默认:false)
- `DATABASE_URL` - SQLite 数据库 URL(默认:sqlite+aiosqlite:///./data/threat_detection.db)
- `CORS_ORIGINS` - 允许的 CORS 来源(默认:http://localhost:5173,http://localhost:3000)
## 许可证
MIT
标签:Cloudflare, Elastic规则, LOLRMM, MITRE ATT&CK, Python, React, Sigma规则, Splunk规则, Sublime规则, Syscalls, TOML, TypeScript, Vercel部署, YAML, 严重等级过滤, 全文搜索, 前端, 后端, 安全内容仓库, 安全库, 安全插件, 安全检测规则, 实时同步, 导出CSV, 导出JSON, 技术栈, 无后门, 检测引擎, 状态过滤, 目标导入, 覆盖缺口, 规则探索, 规则比较, 规则覆盖分析, 过滤与筛选, 逆向工具