siddhant3-cpu/AI-Threat-Hunting-Platform
GitHub: siddhant3-cpu/AI-Threat-Hunting-Platform
ASATL 是一个模拟真实 SOC 控制台的 AI 驱动威胁狩猎与检测平台,覆盖从日志摄取、Sigma 规则匹配、告警关联到威胁情报富化的完整安全运营工作流。
Stars: 0 | Forks: 0
# ASATL - AI 驱动的威胁狩猎与检测平台
ASATL(AI 驱动的威胁狩猎与检测平台)是一个高级的、达到招聘标准水平的网络安全作品集项目,它模拟了真实的**安全运营中心 (SOC)** 控制台。它具有自动化的模拟日志摄取、轻量级的 **Sigma 规则检测引擎**、将遥测数据分组为事件的**实时告警关联引擎**、交互式的 **MITRE ATT&CK 战术映射**,以及通过威胁情报源自动进行指示器富化。
## 🏛️ 架构与数据流
以下是展示模拟攻击遥测数据如何被摄取、分析、关联和富化的端到端数据管道:
```
graph TD
subgraph Client Panel (React Frontend)
UI[ASATL Dashboard / Incident Manager / Sim Lab]
end
subgraph Simulation Telemetry
MIMI[Mimikatz execution]
BRUTE[SSH Brute Force]
REV[Reverse Shell script]
end
subgraph SOC SIEM Backend (FastAPI)
API[FastAPI Router /api]
SE[Sigma Engine]
CE[Correlation Engine]
TI[Threat Intel enrichment]
AI[AI Analyst helper]
end
subgraph Data Store (SQLite)
DB_RAW[(RawEvents Table)]
DB_ALERTS[(Alerts Table)]
DB_INC[(Incidents Table)]
end
%% Telemetry Ingestion Flow
MIMI & BRUTE & REV -->|Trigger Attack Payload| API
API -->|Ingest Raw Logs| DB_RAW
%% Detection Engine Flow
DB_RAW -->|Stream Logs| SE
SE -->|Compile & Match Rules| DB_ALERTS
%% Correlation Flow
DB_ALERTS -->|Window-based Aggregation| CE
CE -->|Compound Risk Calculation| DB_INC
%% Enrichment Flow
DB_INC -->|Enrich IPs/Domains| TI
DB_INC -->|Prompt Generation| AI
%% Frontend Sync
DB_RAW & DB_ALERTS & DB_INC -->|Serve REST APIs| API
API -->|Feed Dashboard Metrics| UI
```
## ✨ 功能
- **自动化 SIEM 日志摄取:** 实时捕获结构化的 Sysmon (Windows) 和 Auditd (Linux) 日志遥测数据。
- **自定义 Sigma 规则引擎:** 根据标准化的 Sigma YAML 规则配置评估日志。支持**不区分大小写的匹配**,以及 Windows 混合大小写的 `EventID` 属性与关系型列表结构之间的自动映射。
- **动态关联与分组:** 评估各个主机端点上警报的时间集群,在统一的事件 ID 下链接相关的异常,并动态计算严重程度和风险评分。
- **MITRE ATT&CK 可视化工具:** 渲染与 MITRE 战术框架(凭证访问、持久化、执行等)对齐的活动安全警报交互矩阵。
- **威胁情报富化:** 自动检查情报源中的指示器(IP、域名、哈希值)(针对攻击向量带有模拟的备用记录)。
- **Docker-Compose 就绪:** 对评审者友好的容器编排,只需一条命令即可启动整个前端/后端技术栈。
## 🛠️ 技术栈
- **前端:**
- React 19 (TypeScript)
- Vite (构建编译器)
- 原生 CSS / Tailwind (美学设计,霓虹暗黑模式毛玻璃效果)
- Lucide React (矢量图标)
- Recharts (事件指标和折线图)
- **后端:**
- FastAPI (REST API 路由)
- Python 3.11+
- SQLAlchemy ORM (SQLite 数据库引擎)
- PyYAML (Sigma 规则解析)
- reportlab (PDF SOC 报告生成)
- PyJWT (基于 Token 的分析师会话身份验证)
- **测试:**
- Pytest (全面的单元/集成测试)
- HTTPX & FastAPI TestClient (REST 路由模拟)
## 📂 文件夹结构
```
project/
├── docker-compose.yml # Multi-container orchestration
├── README.md # Documentation index
│
├── backend/ # SOC FastAPI Python Backend
│ ├── Dockerfile # Backend build recipe
│ ├── run.py # Uvicorn boot script
│ ├── requirements.txt # Python dependencies
│ ├── threat_hunting.db # Persistent Sqlite SQLite DB
│ │
│ ├── app/
│ │ ├── main.py # FastAPI application bootstrapper
│ │ ├── config.py # Global Pydantic environment configurations
│ │ ├── database.py # SQLAlchemy Session connection
│ │ ├── models.py # Database schemas (RawEvent, Alert, Incident, User)
│ │ ├── schemas.py # Pydantic serializer models
│ │ │
│ │ ├── routers/ # FastAPI endpoint handlers
│ │ │ ├── auth.py # Login, registers & sessions
│ │ │ ├── rules.py # Sigma Rule query and creation
│ │ │ ├── simulator.py # Threat vector dispatch trigger
│ │ │ └── incidents.py # Incident details and analyst comments
│ │ │
│ │ ├── detection/ # Core Sigma Rules parser
│ │ │ ├── engine.py # Log parser and matching engine
│ │ │ └── rules/ # Active detection rule repository (.yml files)
│ │ │
│ │ ├── correlation/
│ │ │ └── engine.py # Temporal aggregation and risk scoring engine
│ │ │
│ │ └── enrichment/
│ │ └── threat_intel.py # IP, Domain and Hash intelligence checks
│ │
│ └── tests/ # Automated test coverage
│ ├── test_api.py # FastAPI REST endpoints verification
│ ├── test_detection.py # Rule and correlation verification
│ └── test_utils.py # JWT, encryption, and casing utility tests
│
└── frontend/ # Interactive Vite React Frontend
├── Dockerfile # Multi-stage production Nginx compiler
├── nginx.conf # Nginx server config supporting React SPA routing
├── package.json # Frontend package dependencies
├── index.html # Core HTML structure
│
└── src/
├── App.tsx # Core App layout & navigation
├── index.css # Premium design token system styles
├── components/ # Reusable UI component modules
│ ├── Dashboard.tsx # Live status graphs & MITRE ATT&CK Matrix
│ ├── Incidents.tsx # Incident workflow & comments
│ ├── Hunting.tsx # Raw SIEM telemetry viewer
│ ├── Rules.tsx # Sigma rule editor & verifier
│ └── Simulator.tsx # Simulation Lab threat dispatcher
└── services/
└── api.ts # Fetch backend client wrapper
```
## ⚡ 快速开始:容器化设置(推荐)
要在 Docker 容器内自动构建并启动整个 ASATL 技术栈(前端和后端):
1. 克隆或复制项目工作区。
2. 在根目录(即 `docker-compose.yml` 所在位置)下,执行:
docker compose up --build -d
3. 打开浏览器并访问:
- **ASATL 管理控制台(前端)**:[http://localhost](http://localhost) (运行在 Nginx HTTP 端口 80)
- **交互式 API 文档(后端)**:[http://localhost:8000/docs](http://localhost:8000/docs) (Uvicorn 后端端口 8000)
*注意:SQLite 数据库文件 (`threat_hunting.db`) 被映射为卷。所有事件、规则和遥测记录都将持久保存在宿主机上的 `./backend/threat_hunting.db` 中。*
## ⚙️ 手动开发者设置
如果您更喜欢在宿主机上本地运行前端和后端:
### 1. 后端配置
1. 打开终端并导航至 backend 文件夹:
cd backend
2. 创建并激活 Python 虚拟环境:
# Windows
python -m venv venv
.\venv\Scripts\activate
# Linux/macOS
python3 -m venv venv
source venv/bin/activate
3. 安装依赖项:
pip install -r requirements.txt
4. 启动 FastAPI 服务器:
python run.py
*后端将在 [http://localhost:8000](http://localhost:8000) 上启动。*
### 2. 前端配置
1. 打开一个新终端并导航至 frontend 文件夹:
cd frontend
2. 安装 npm 包:
npm install
3. 启动 Vite React 开发服务器:
npm run dev
*前端将在 [http://localhost:5173](http://localhost:5173) 上启动。*
## 🧪 运行自动化测试
`backend/tests/` 中提供了使用 Pytest 的全面测试套件。
要执行所有测试(API、检测引擎和安全工具):
1. 导航至 `backend/` 文件夹并激活虚拟环境。
2. 执行 pytest 模块:
python -m pytest
## 📖 用户与模拟指南
1. **仪表盘概览:**
打开 Web 应用程序界面。您将看到一个深色主题的毛玻璃控制台,显示实时日志摄取速率、汇总的事件列表以及实时更新的 **MITRE ATT&CK 矩阵**。
2. **启动模拟(模拟实验室):**
转到 **Simulation Lab** 选项卡并触发一个威胁向量:
- **Mimikatz 执行:** 模拟 LSASS 进程转储,写入进程事件(Sysmon ID 1)、注册表修改(Sysmon ID 13)和文件创建(Sysmon ID 11)。
- **暴力破解活动:** 摄取 15 次失败登录和 1 次成功登录。根据身份验证规则评估日志,随着风险指标累积升级事件。
- **反向 Shell:** 分发 Auditd 执行遥测数据。
3. **调查(事件管理器):**
检查 **Incident Manager** 以查看触发的事件。点击任何事件以阅读完整的攻击详情、查看嵌套的警报,并撰写分析师评论以更新工单状态。
4. **威胁情报检查:**
在 **Threat Hunting** 下,查看原始日志流并查找特定指示器(例如 IP),以查看实时的信誉评分表。
标签:AMSI绕过, AV绕过, FastAPI, React, Syscalls, 威胁检测, 安全运营, 扫描框架, 请求拦截, 逆向工具