sedat4ras/dns-threat-intelligence-tool

GitHub: sedat4ras/dns-threat-intelligence-tool

一个基于行为分析的DNS威胁狩猎管道,通过熵值分析、时序特征检测和VirusTotal情报集成,将PCAP流量转化为可执行威胁情报和可视化报告。

Stars: 0 | Forks: 0

# DNS Beacon 情报与威胁分析器 [![Python](https://img.shields.io/badge/Python-3.9+-blue?style=flat-square&logo=python&logoColor=white)](https://www.python.org/) [![Wireshark](https://img.shields.io/badge/Engine-TShark%2FPyshark-1679A7?style=flat-square&logo=wireshark&logoColor=white)](https://www.wireshark.org/) [![VirusTotal](https://img.shields.io/badge/Intel-VirusTotal_API-394EFF?style=flat-square)](https://www.virustotal.com/) [![License](https://img.shields.io/badge/License-MIT-lightgrey?style=flat-square)]() ## 概述 传统的 IDS/IPS 系统依赖于静态黑名单,无法捕获零日威胁。本工具采用了不同的方法 —— 它分析 DNS 流量的**行为**,以揭示签名检测遗漏的恶意模式。 通过结合香农熵分析、时序一致性(抖动)指标以及来自 70 多个杀毒引擎的全球威胁情报,它将原始 PCAP 捕获数据转化为可供高管使用的情报仪表板。 ## Pipeline 架构 ``` ┌─────────────────────────────────────────────────────────────────┐ │ DNS THREAT INTELLIGENCE PIPELINE │ ├──────────┬──────────────┬────────────────┬──────────────────────┤ │ Stage 1 │ Stage 2 │ Stage 3 │ Stage 4 │ │ │ │ │ │ │ EXTRACT │ ANALYZE │ ENRICH │ VISUALIZE │ │ │ │ │ │ │ .pcap │ Shannon │ VirusTotal │ 3-Panel Executive │ │ → CSV │ Entropy + │ API v3 │ Dashboard │ │ │ Jitter + │ (70+ AV │ │ │ │ Risk Score │ engines) │ • Threat Map │ │ │ (0-100) │ │ • Ranked List │ │ │ │ │ • VT Reputation │ └──────────┴──────────────┴────────────────┴──────────────────────┘ extractor.py analyzer.py enricher.py visualizer.py ``` ## 检测方法 | 方法 | 检测内容 | 工作原理 | |--------|----------------|--------------| | **Shannon Entropy** | DGA 生成的域名 | 测量字符随机性 —— 高熵值(>3.5)表明是算法生成的主机名 | | **Timing Consistency** | C2 beacon 模式 | 计算间隔标准差 —— 低抖动表明类似机器的周期性(自动化恶意软件回调) | | **Frequency Analysis** | 大容量数据渗出 | 统计每个域名的查询量 —— 异常流量峰值被加权计入风险评分 | | **VirusTotal Enrichment** | 已知威胁 | 将前 10 个可疑域名与 70 多个全球杀毒引擎进行交叉比对 | ### 风险评分公式 ``` Risk Score (0-100) = Entropy Factor (up to 40pts) + Beaconing Factor (up to 60pts) Whitelisted domains (Google, Microsoft, Discord, etc.) → 90% score reduction ``` ## 仪表板指南 输出是一份高分辨率的 3 面板高管情报报告: - **威胁地图(主):** 散点图,以熵(X 轴)对比时序一致性(Y 轴)。气泡大小反映流量。颜色渐变对应风险评分。 - **排名调查列表:** 按综合风险评分排序的前 15 个域名,包含事件计数。 - **VT 声誉面板:** 每个域名的判定 —— `POSITIVE (THREAT)` 或 `NEGATIVE (CLEAN)`,以及引擎标记计数。 ## 快速开始 ### 前置条件 - Python 3.9+ - 已安装 Wireshark / TShark 并添加到 `PATH` - VirusTotal API 密钥([提供免费层](https://www.virustotal.com/gui/join-us)) ### 安装 ``` git clone https://github.com/sedat4ras/dns-threat-intelligence-tool.git cd dns-threat-intelligence-tool python -m venv venv && source venv/bin/activate pip install -r requirements.txt ``` ### 配置 在项目根目录下创建一个 `.env` 文件: ``` VT_API_KEY=your_virustotal_api_key_here ``` ### 用法 ``` # 分析默认 PCAP 文件 python main.py # 分析特定 capture python main.py data/suspicious_traffic.pcapng # 仅重新渲染 dashboard (跳过处理) python src/visualizer.py ``` ## 项目结构 ``` dns-threat-intelligence-tool/ ├── main.py # Pipeline orchestrator ├── src/ │ ├── extractor.py # Stage 1 — PCAP → CSV (Pyshark DNS filter) │ ├── analyzer.py # Stage 2 — Entropy + jitter + risk scoring │ ├── enricher.py # Stage 3 — VirusTotal API integration │ └── visualizer.py # Stage 4 — Executive dashboard rendering ├── data/ # Input PCAP files ├── output/ │ ├── plots/ # Generated dashboard PNGs (300 DPI) │ └── *.csv # Intermediate pipeline outputs ├── requirements.txt └── .env # API key configuration ``` ## 技术栈 | 组件 | 技术 | |-----------|-----------| | PCAP 解析 | Pyshark (TShark wrapper) | | 数据处理 | pandas, NumPy | | 可视化 | matplotlib, seaborn | | 威胁情报 | VirusTotal API v3 | | 配置 | python-dotenv | ## 免责声明 所有发现均使用独立的统计算法和启发式方法生成。结果仅供参考,不保证确定的结果。对于安全关键决策,始终建议进行最终的人工分析。 ## 联系方式 GitHub: [sedat4ras](https://github.com/sedat4ras) | Email: sudo@sedataras.com
标签:C2检测, DeepSeek, DNS威胁分析, DNS隧道检测, IP 地址批量处理, PCAP解析, Pyshark, Python安全工具, Shannon熵, TShark, VirusTotal集成, 信标检测, 威胁情报, 安全仪表盘, 开发者工具, 异常检测, 恶意流量检测, 攻击面映射, 流量可视化, 熵值分析, 网络安全, 逆向工具, 隐私保护