payal2117/Closed-Loop-Cyber-Threat-Intelligence-System
GitHub: payal2117/Closed-Loop-Cyber-Threat-Intelligence-System
企业级闭环威胁情报平台,集成蜜罐欺骗、AI恶意软件分析和Windows终端防护,实现从威胁诱捕到端点响应的完整防御闭环。
Stars: 0 | Forks: 0
# 🛡️ 闭环网络威胁情报系统
一个 B2B 企业级威胁情报平台,集成了 **C++ 边缘代理**、**AI/ML 分类**、**蜜罐欺骗网络**和**实时分析仪表盘**。
## 🗺️ 各组件连接方式
```
[Attacker on Internet]
│
▼
┌─────────────────────────────┐
│ Honeynet Layer │ ← Cowrie (SSH) + Dionaea (FTP/SMB/HTTP)
└────────────┬────────────────┘
│ captured payloads & logs
▼
┌─────────────────────────────┐
│ Python AI Backend │ ← FastAPI (Port 8000)
│ log_shipper.py │ Reads honeypot logs → sends to MongoDB
│ sandbox_orchestrator.py │ Detonates binaries in Docker sandbox
│ ai_engine.py │ XGBoost + DBSCAN ML models
└────────────┬────────────────┘
│
┌───────┴───────┐
▼ ▼
MongoDB OpenSearch
(Port 27017) (Port 9200)
Honeynet events C++ Agent telemetry
│ │
└───────┬───────┘
▼
┌─────────────────────────────┐
│ React Dashboard (Port 5173)│
│ Overview tab ← MongoDB │
│ Enterprise Analytics tab │
│ ← OpenSearch│
└─────────────────────────────┘
─────────────────────────────────
[Deployed on each Windows Machine]
┌─────────────────────────────┐
│ C++ Enterprise Agent │
│ Monitors filesystem │
│ SHA256 + Entropy hashing │
│ ONNX AI model inference │
│ Quarantine via Win32 API │
│ Streams JSON → OpenSearch│
└─────────────────────────────┘
```
## ⚙️ 从零开始的分步设置
### 0. 一次性安装要求
**请先安装这些工具(如果尚未安装):**
| 工具 | 下载地址 | 用途 |
|---|---|---|
| Docker Desktop | https://www.docker.com/products/docker-desktop/ | 运行所有数据库和蜜罐 |
| Python 3.10+ | https://www.python.org/downloads/ | 运行 AI 后端 |
| Node.js 18+ | https://nodejs.org/ | 运行 React 仪表盘 |
| Git(可选) | https://git-scm.com/ | 用于克隆代码仓库 |
安装完成后,请验证每一个是否正常工作:
```
docker --version
python --version
node --version
npm --version
```
### 1. 配置环境变量
在项目的**根目录**下创建或验证 `.env` 文件:
```
# 查看其中的内容
cat .env
```
它应包含:
```
MONGO_URI=mongodb://admin:supersecretpassword@localhost:27017/?authSource=admin
OPENSEARCH_URL=http://localhost:9200
```
### 2. 启动数据库(终端 1 — 保持运行)
```
# 导航至项目根目录
cd "d:\VIT\Sem 6\Closed-Loop Cyber Threat Intelligence System"
# 通过 Docker 启动 MongoDB 和 OpenSearch
docker-compose up mongodb opensearch-node1 -d
# 验证它们是否正在运行
docker ps
```
等待约 30 秒让 OpenSearch 完全启动。您可以进行验证:
```
# 应返回 JSON 响应
curl http://localhost:9200
# 应无错误地连接
curl http://localhost:27017
```
### 3. 安装 Python 依赖(一次性操作)
```
cd "d:\VIT\Sem 6\Closed-Loop Cyber Threat Intelligence System\backend-api"
pip install -r requirements.txt
```
### 4. 启动 Python AI 后端(终端 2 — 保持运行)
```
cd "d:\VIT\Sem 6\Closed-Loop Cyber Threat Intelligence System\backend-api"
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
```
验证其是否已启动:
```
# 打开浏览器或运行:
curl http://localhost:8000
# 应返回:{"status": "active", "system": "Threat Intelligence Brain"}
```
### 5. 安装并启动 React 仪表盘(终端 3 — 保持运行)
```
cd "d:\VIT\Sem 6\Closed-Loop Cyber Threat Intelligence System\dashboard"
# 安装依赖(一次性)
npm install
# 启动开发服务器
npm run dev
```
在浏览器中打开:**http://localhost:5173**
### 6. 启动蜜网传感器(终端 4 — 可选,保持运行)
这将部署真实的 SSH 和 FTP/SMB 蜜罐,用于吸引并记录攻击者的活动:
```
cd "d:\VIT\Sem 6\Closed-Loop Cyber Threat Intelligence System\honeynet"
docker-compose up -d
# 验证两个 honeypot 容器是否正在运行
docker ps
```
Cowrie 将监听端口 `2222` (SSH)。Dionaea 将监听端口 `2121`、`4445` 等。
### 7. 启动日志传输器(终端 5 — 可选,与蜜罐一同运行)
它会监控蜜罐日志文件并将其传输到 MongoDB 中,以便**概览**仪表盘选项卡能显示真实数据:
```
cd "d:\VIT\Sem 6\Closed-Loop Cyber Threat Intelligence System\backend-api"
python -m app.services.log_shipper
```
### 8. 流式传输模拟代理遥测数据(终端 6 — 用于演示/测试)
```
cd "d:\VIT\Sem 6\Closed-Loop Cyber Threat Intelligence System\backend-api"
python opensearch_telemetry_gen.py
# 您将看到类似以下的输出:
# [+] Sent Event: WIN-ENTERPRISE-01 | Ransomware | MALICIOUS
# [+] Sent Event: WIN-SERVER-DB | Benign | ALLOW
# 按 Ctrl+C 停止
```
## 🖥️ 构建真实的 C++ Windows 终端代理(B2B 客户端部署)
### 一次性前置条件:
1. 安装 **Visual Studio 2022** 并勾选 "Desktop development with C++" 工作负载
2. 安装 **CMake**:https://cmake.org/download/ — 安装时将其添加到 PATH
3. 安装 **vcpkg**:
git clone https://github.com/microsoft/vcpkg
cd vcpkg
bootstrap-vcpkg.bat
4. 通过 vcpkg 安装 C++ 库:
vcpkg install openssl nlohmann-json curl onnxruntime --triplet x64-windows
vcpkg integrate install
### 构建代理:
```
cd "d:\VIT\Sem 6\Closed-Loop Cyber Threat Intelligence System\enterprise-agent"
mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE="[path-to-vcpkg]\scripts\buildsystems\vcpkg.cmake"
cmake --build . --config Release
```
### 导出 AI 模型(运行代理前必需):
```
cd "d:\VIT\Sem 6\Closed-Loop Cyber Threat Intelligence System\backend-api"
pip install onnxmltools onnxconverter-common
python export_onnx.py
# 这将创建:enterprise-agent/models/threat_classifier_v2.onnx
```
### 运行代理:
```
cd "d:\VIT\Sem 6\Closed-Loop Cyber Threat Intelligence System\enterprise-agent\build\Release"
.\EnterpriseAgent.exe
```
该代理默认监控 `C:\Users\Public`。要对其进行测试:
```
# 打开另一个终端并将文件放入监控文件夹:
copy C:\Windows\System32\calc.exe C:\Users\Public\calc.exe
# Agent 终端将打印:
# [***] Analysing File Event: C:\Users\Public\calc.exe
# [4] AI CORE -> Family classification: Benign (85% confidence)
```
## 📁 项目结构
| 目录 | 用途 |
|---|---|
| `enterprise-agent/` | 用于 Windows 客户端部署的 C++ 边缘传感器二进制文件 |
| `backend-api/` | Python FastAPI:AI 大脑、沙箱编排器、安全 API |
| `dashboard/` | React.js 实时分析前端 |
| `honeynet/` | Docker 蜜罐传感器(Cowrie SSH + Dionaea 多协议) |
| `sandbox/` | 短暂存在的 Docker 恶意软件引爆舱 |
| `docker-compose.yml` | 编排 MongoDB + OpenSearch + Backend + Dashboard |
## 🚦 完整系统运行时状态
| 终端 | 命令 | 状态指示 |
|---|---|---|
| Docker | `docker-compose up mongodb opensearch-node1 -d` | `docker ps` 显示 2 个容器 |
| Python 后端 | `uvicorn app.main:app --port 8000 --reload` | `localhost:8000` 有响应 |
| React 仪表盘 | `npm run dev` | `localhost:5173` 正常打开 |
| 蜜网(可选) | `cd honeynet && docker-compose up -d` | 端口 2222、2121 开放 |
| 日志传输器(可选) | `python -m app.services.log_shipper` | 控制台显示日志传输 |
| 遥测模拟 | `python opensearch_telemetry_gen.py` | 企业分析选项卡数据填充 |
| C++ 代理(可选) | `.\EnterpriseAgent.exe` | 监控 C:\Users\Public |
标签:AI/ML分类, Apex, AV绕过, B2B企业级安全, Bash脚本, CISA项目, CNCF毕业项目, C++边缘代理, DAST, DBSCAN, Dionaea, DNS 反向解析, Docker沙箱, FastAPI, FTP蜜罐, Go语言工具, MongoDB, Payload分析, PFX证书, Python后端, React, Shellcode执行, SMB蜜罐, SSH蜜罐, Syscalls, Windows终端安全, XGBoost, 互联网扫描, 可视化仪表盘, 威胁情报, 安全运营, 实时分析仪表盘, 开发者工具, 异常检测, 恶意软件分析, 扫描框架, 攻击检测, 无线安全, 日志传输, 机器学习, 沙箱 detonation, 沙箱编排, 端点安全, 网络安全, 自动防御, 自定义脚本, 蜜罐欺骗网络, 补丁管理, 请求拦截, 进程注入, 逆向工具, 遥测数据处理, 闭环威胁情报系统, 隐私保护