mark-Aryan/Codexploit-cve-threat-intelligence

GitHub: mark-Aryan/Codexploit-cve-threat-intelligence

一个基于双模型 AI 架构的自动化 CVE 威胁情报流水线,从 NIST NVD 拉取最新漏洞数据并生成结构化分析报告。

Stars: 0 | Forks: 0

# 🛡️ CVE 威胁情报流水线 v2.0 ## ✨ v2.0 新特性 - **双模型 AI 架构** — Gemini 2.0 Flash(主模型)+ Groq Llama 4 Maverick(自动回退) - **模块化代码库** — 7 个专注模块,替代单一庞大的脚本 - **全面测试套件** — `test_pipeline.py` 在部署前验证每个组件 - **每日索引文件** — `reports/YYYY-MM-DD/index.md` 自动生成并附带严重性徽章 - **轮转日志文件** — `logs/pipeline.log` 保留 7 天 - **精美终端输出** — 彩色编码日志和测试结果 ## 🗂️ 项目结构 ``` . ├── main.py # Entry point ├── pipeline.py # Orchestrator ├── config.py # All configuration in one place ├── logger.py # Structured logging setup ├── state_manager.py # Run state persistence ├── cve_fetcher.py # NIST NVD API client ├── ai_generator.py # Dual-model AI report generator ├── report_writer.py # Markdown + daily index writer ├── git_manager.py # Git operations via subprocess ├── test_pipeline.py # Integration test runner ├── requirements.txt # Python dependencies ├── .env.example # Environment variable template ├── .github/ │ └── workflows/ │ └── cve_automation.yml # GitHub Actions workflow ├── state/ │ └── last_run.json # Auto-managed deduplication state ├── reports/ │ └── YYYY-MM-DD/ │ ├── CVE-XXXX-XXXXX.md # Individual threat reports │ └── index.md # Daily summary index └── logs/ └── pipeline.log # Rotating pipeline logs ``` ## ⚡ 5 分钟设置 ### 步骤 1 — Fork 并克隆此仓库 ### 步骤 2 — 添加 GitHub Secrets **Settings → Secrets and variables → Actions → New repository secret** | Secret | 是否必需 | 获取位置 | |--------|----------|-----------------| | `GEMINI_API_KEY` | ✅ 推荐 | [aistudio.google.com](https://aistudio.google.com/app/apikey) — 免费 | | `GROQ_API_KEY` | ✅ 推荐 | [console.groq.com](https://console.groq.com/keys) — 免费 | | `NVD_API_KEY` | ⚠️ 强烈推荐 | [nvd.nist.gov](https://nvd.nist.gov/developers/request-an-api-key) — 免费 | ### 步骤 3 — 授予写入权限 **Settings → Actions → General → Workflow permissions → Read and write permissions → Save** ### 步骤 4 — 启用 Actions 转到 **Actions** 标签页,如果出现提示,请启用 workflows。 ### 步骤 5 — 立即测试 ``` Actions → 🛡️ CVE Threat Intelligence Pipeline → Run workflow ``` ## 🧪 本地运行测试 ``` # 克隆并设置 git clone https://github.com/your-org/your-repo.git cd your-repo python -m venv .venv && source .venv/bin/activate pip install -r requirements.txt # 配置 API keys cp .env.example .env # 使用你的实际 keys 编辑 .env # 运行完整 test suite python test_pipeline.py # 仅运行 AI provider 测试 python test_pipeline.py --tests gemini,groq # 运行并显示详细 AI 输出 python test_pipeline.py --verbose # 本地运行 pipeline python main.py ``` ## 🏗️ 架构 ``` GitHub Actions (cron: */15 * * * *) │ StateManager ──── reads last_run.json │ CVEFetcher ──────── NIST NVD API v2 │ (only CVEs since last_run) │ AIReportGenerator ├── Gemini 2.0 Flash ← PRIMARY (best quality) └── Groq Llama 4 ← FALLBACK (auto-triggered on Gemini failure) │ ReportWriter ─────── reports/YYYY-MM-DD/.md │ reports/YYYY-MM-DD/index.md │ StateManager ────── writes new last_run.json │ GitManager ──────── git add → commit → push ``` ## 📊 AI 提供商对比 | | Gemini 2.0 Flash Lite | Groq Llama 3.3 70B Versatile | |---|---|---| | **角色** | 主模型 | 回退模型 | | **写作质量** | ⭐⭐⭐⭐ | ⭐⭐⭐⭐½ | | **免费层 RPD** | ~1,000 | 1,000 | | **上下文窗口** | 1M tokens | 128K tokens | | **速度** | 极快 | 极快 | | **何时使用** | 始终优先 | Gemini 配额/错误时 | ## 📄 示例报告结构 每个生成的报告均遵循此结构: ``` # CVE-YYYY-XXXXX — 漏洞威胁报告 ## 🔍 Executive Summary ← 适合 C-suite 阅读,4-6 句话 ## 📋 Vulnerability Details ← 结构化表格 (CVSS, CWE, 日期) ## 🔬 Technical Analysis ← 根本原因、攻击向量、CVSS 详析 ## 🖥️ Affected Systems & Versions ← 基于 CPE 的产品列表 ## ⚠️ Threat Context & Risk ← 现实可利用性 + 优先级评级 ## 🛠️ Remediation & Mitigation ← 立即 / 短期 / 长期 ## 🔎 Indicators of Compromise ← 已知 IoC 或确认不存在 ## 📚 References & Further Reading ``` ## 🔒 安全说明 - `GITHUB_TOKEN` 自动使用 — 无需 Personal Access Token - API key 作为环境变量注入,绝不写入磁盘 - 报告默认分类为 `TLP:WHITE` - `logs/` 目录在 `.gitignore` 中 — 日志仅保留在每个 runner 本地
标签:CVE自动化, DevSecOps, DLL 劫持, GitHub Actions, Git自动化, GPT, Markdown, NIST NVD, Python, Sysdig, 上游代理, 人工智能, 双模型架构, 大语言模型, 威胁情报, 安全报告生成, 开发者工具, 无后门, 漏洞分析, 漏洞管理, 用户模式Hook绕过, 网络安全, 网络安全研究, 自动化运维, 自动笔记, 路径探测, 逆向工具, 防御加固, 隐私保护