Ki1shan/CyberThreat-Intelligence

GitHub: Ki1shan/CyberThreat-Intelligence

一个基于 Flask 和 MongoDB 的轻量级网络威胁情报仪表板,整合 VirusTotal 和 AbuseIPDB 两大情报源,提供 IP 与域名的交叉查询和历史记录追踪。

Stars: 0 | Forks: 0

# ⚔️ 网络威胁情报仪表板 ![Python](https://img.shields.io/badge/python-3.8+-blue) ![Flask](https://img.shields.io/badge/flask-2.3.2-green) ![MongoDB](https://img.shields.io/badge/mongodb-4.4-brightgreen) ![Docker](https://img.shields.io/badge/docker-compose-blue) ![License](https://img.shields.io/badge/license-MIT-green) ![Status](https://img.shields.io/badge/status-active-brightgreen) ![APIs](https://img.shields.io/badge/APIs-VirusTotal%20%7C%20AbuseIPDB-red) ## 概述 网络威胁情报仪表板是一个全栈威胁查询平台,它将两个行业标准的威胁情报 API 整合到一个统一的界面中。提交任何 IP 地址或域名,即可获得即时交叉引用的威胁数据 —— VirusTotal 引擎分析分数和 AbuseIPDB 置信度评级 —— 所有数据均持久化到 MongoDB 以进行历史追踪。 整个技术栈可通过单条命令在 Docker 中运行 —— Flask 应用 + MongoDB,无需手动设置。 ## 截图 ![CTI 仪表板](https://static.pigsec.cn/wp-content/uploads/repos/2026/05/0f49b6718c222000.png) *实时查询 — `45.83.64.1` 被标记为恶意:VirusTotal 上有 13 个引擎报告。`8.8.8.8` (Google DNS) 显示安全,Abuse Score: 0。* ## 架构 ``` ┌──────────────────────────────────────────────────────────────┐ │ CYBER THREAT INTELLIGENCE DASHBOARD │ ├──────────────────────────────────────────────────────────────┤ │ │ │ ┌────────────────────────────────────────────────────────┐ │ │ │ FLASK APP (app/__init__.py + routes.py) │ │ │ │ │ │ │ │ GET / → load IOC history from MongoDB │ │ │ │ POST /lookup → query APIs → store → redirect │ │ │ └────────────────────────────────────────────────────────┘ │ │ │ │ │ ┌───────────────┴───────────────┐ │ │ ▼ ▼ │ │ ┌──────────────────────┐ ┌──────────────────────────┐ │ │ │ VIRUSTOTAL API │ │ ABUSEIPDB API │ │ │ │ apis/virustotal.py │ │ apis/abuseipdb.py │ │ │ │ │ │ │ │ │ │ /v3/search?query= │ │ /v2/check?ip= │ │ │ │ x-apikey header │ │ maxAgeInDays: 90 │ │ │ │ Returns engine │ │ Returns abuse │ │ │ │ analysis stats │ │ confidence score │ │ │ └──────────────────────┘ └──────────────────────────┘ │ │ │ │ │ ▼ │ │ ┌────────────────────────────────────────────────────────┐ │ │ │ MONGODB (flask-pymongo) │ │ │ │ Database: cti_dashboard │ │ │ │ Collection: iocs │ │ │ │ Fields: ioc, timestamp, virustotal, abuseipdb │ │ │ │ Sorted by timestamp descending │ │ │ └────────────────────────────────────────────────────────┘ │ │ │ │ │ ▼ │ │ ┌────────────────────────────────────────────────────────┐ │ │ │ BOOTSTRAP DARK DASHBOARD (dashboard.html) │ │ │ │ IOC table: IOC | Timestamp | VirusTotal | AbuseIPDB │ │ │ │ Real-time lookup form │ │ │ └────────────────────────────────────────────────────────┘ │ │ │ │ ┌──────────────────────────────────────────────────────┐ │ │ │ DOCKER COMPOSE │ │ │ │ cti_flask_app → port 5000 │ │ │ │ cti_mongo → port 27017 + persistent volume │ │ │ └──────────────────────────────────────────────────────┘ │ └──────────────────────────────────────────────────────────────┘ ``` ## 功能 ### 🔍 IOC 查询 - 输入任何 IP 地址或域名 - 同时查询 VirusTotal 和 AbuseIPDB - 结果即时显示在仪表板表格中 - 每次查询均带 UTC 时间戳持久化到 MongoDB ### 🦠 VirusTotal 集成 - 使用 VirusTotal API v3 `/search` 端点 - 返回完整的 `last_analysis_stats`: - `malicious` — 标记为恶意的引擎 - `suspicious` — 标记为可疑的引擎 - `undetected` — 未检测到威胁的引擎 - `harmless` — 确认安全的引擎 - `timeout` — 超时的引擎 - API 密钥从环境变量 `VT_API_KEY` 加载 ### 🚨 AbuseIPDB 集成 - 使用 AbuseIPDB API v2 `/check` 端点 - 90 天回顾窗口 - 返回 `abuseConfidenceScore` (0-100%) - API 密钥从环境变量 `ABUSEIPDB_API_KEY` 加载 ### 🗄️ MongoDB 持久化 - 所有查询存储在 `cti_dashboard.iocs` 集合中 - 历史 IOC 表按最新优先排序 - 持久化 Docker 卷 — 数据在容器重启后依然保留 ### 🐳 Docker 优先部署 - 单个 `docker compose up` 命令启动所有内容 - Flask 应用 + MongoDB 一同容器化 - 通过 `.env` 文件配置环境变量 - 无需手动安装 MongoDB ## 项目结构 ``` CyberThreat-Intelligence/ │ ├── app/ │ ├── __init__.py # Flask app factory + MongoDB init │ ├── routes.py # Blueprint routes — index + lookup │ ├── apis/ │ │ ├── virustotal.py # VirusTotal API v3 integration │ │ └── abuseipdb.py # AbuseIPDB API v2 integration │ └── templates/ │ └── dashboard.html # Bootstrap 5 dark-theme dashboard │ ├── Dockerfile # Flask app container ├── docker-compose.yml # Flask + MongoDB orchestration ├── run.py # Entry point (host 0.0.0.0 for Docker) ├── requirements.txt # Python dependencies ├── CTI.png # Dashboard screenshot └── CTI_Report.docx # Sample CTI report ``` ## 技术栈 | 组件 | 技术 | 版本 | |-----------|-----------|---------| | 后端 | Python, Flask | 2.3.2 | | 数据库 | MongoDB | 4.4 | | ODM | flask-pymongo | 2.3.0 | | HTTP 客户端 | requests | 2.31.0 | | 配置 | python-dotenv | 1.0.1 | | 前端 | Bootstrap 5 暗色主题 | 5.3.0 | | 容器化 | Docker, Docker Compose | 3.8 | | 威胁情报 | VirusTotal API v3 | — | | 威胁情报 | AbuseIPDB API v2 | — | ## 安装 ### 前置条件 - 已安装 Docker + Docker Compose - VirusTotal API 密钥 ([获取免费密钥](https://www.virustotal.com/gui/join-us)) - AbuseIPDB API 密钥 ([获取免费密钥](https://www.abuseipdb.com/register)) ### 设置 **克隆仓库:** ``` git clone https://github.com/Ki1shan/CyberThreat-Intelligence.git cd CyberThreat-Intelligence ``` **创建 `.env` 文件:** ``` VT_API_KEY=your_virustotal_api_key_here ABUSEIPDB_API_KEY=your_abuseipdb_api_key_here FLASK_SECRET_KEY=your_secret_key_here ``` **启动技术栈:** ``` docker compose up --build ``` **在浏览器中打开:** ``` http://127.0.0.1:5000 ``` ## 使用 1. 打开 `http://127.0.0.1:5000` 2. 在查询字段中输入 IP 地址或域名 3. 点击 **Lookup** 4. 在 IOC 表格中查看结果: | IOC | 时间戳 | VirusTotal | AbuseIPDB | |-----|-----------|-----------|----------| | 45.83.64.1 | 2025-06-23 07:45:02 | malicious: 13, suspicious: 1 | Abuse Score: 0 | | 8.8.8.8 | 2025-06-23 07:40:12 | malicious: 0, harmless: 61 | Abuse Score: 0 | ## 示例 API 响应 **VirusTotal — 恶意 IP:** ``` { "last_analysis_stats": { "malicious": 13, "suspicious": 1, "undetected": 28, "harmless": 52, "timeout": 0 } } ``` **AbuseIPDB — 安全 IP:** ``` { "data": { "abuseConfidenceScore": 0, "totalReports": 0, "lastReportedAt": null } } ``` ## 环境变量 | 变量 | 描述 | |----------|-------------| | `VT_API_KEY` | VirusTotal API v3 密钥 | | `ABUSEIPDB_API_KEY` | AbuseIPDB API v2 密钥 | | `FLASK_SECRET_KEY` | Flask 会话密钥 | | `MONGO_URI` | MongoDB 连接字符串 (默认: `mongodb://mongo:27017/cti_dashboard`) | ## 作者 **Kishan N** 攻击性安全工程师 | 威胁情报 | 蓝队 构建网络威胁情报仪表板是为了演示真实的 CTI 工作流 —— 将多来源威胁数据聚合到一个持久化、可查询且对分析师友好的平台中。 ## 许可证 MIT License — 详见 `LICENSE` 文件。 *在威胁了解你之前,先了解你的威胁。*
标签:AbuseIPDB, API集成, Ask搜索, DAST, Docker, Docker-Compose, Flask, GitHub, IP信誉查询, IP 地址批量处理, MIT许可, MongoDB, Mutation, Python, VirusTotal, 代码示例, 可观测性, 可视化, 域名安全检测, 威胁分析, 威胁情报, 安全仪表盘, 安全防御评估, 开发者工具, 开源安全工具, 恶意软件分析, 数据分析, 无后门, 版权保护, 网络信息收集, 网络安全, 自动化侦查工具, 请求拦截, 逆向工具, 逆向工程平台, 隐私保护