jamesKhor/Zcybernews

GitHub: jamesKhor/Zcybernews

一个 AI 驱动的双语网络安全情报平台,自动摄取 RSS 并生成、翻译、验证与发布威胁分析内容。

Stars: 1 | Forks: 0

# ZCyberNews **AI 驱动的网络安全情报平台** 一个专业的网络安全与技术情报网站,提供双语(英文/中文)威胁分析、漏洞研究和安全新闻 —— 具备 AI 内容管道,可摄取 RSS 源、生成分析师级别的文章并自动发布。 [![Deploy to VPS](https://static.pigsec.cn/wp-content/uploads/repos/2026/04/5f7bbf016a082247.svg)](https://github.com/jamesKhor/Zcybernews/actions/workflows/deploy-vps.yml) [实时站点](https://zcybernews.com) | [English](https://zcybernews.com/en) | [中文](https://zcybernews.com/zh) ## 架构 ``` graph TB subgraph "Content Sources" RSS[RSS Feeds
Krebs, BleepingComputer,
Malwarebytes, etc.] ADMIN[Admin Panel
/admin/compose] end subgraph "AI Pipeline" INGEST[Ingest & Deduplicate] DEEPSEEK[DeepSeek-V3
Article Generation] KIMI[Kimi K2
EN → ZH Translation] VALIDATE[Zod Schema Validation
+ CVE Sanitization] end subgraph "Content Layer" MDX_EN[content/en/**/*.mdx] MDX_ZH[content/zh/**/*.mdx] GIT[Git Repository
GitHub] end subgraph "Application" NEXTJS[Next.js 16
App Router + SSG] INTL[next-intl v4
EN/ZH Routing] MDX_RENDER[MDX Compiler
remark-gfm, rehype-highlight] SEARCH[Search API
Server-side] end subgraph "Deployment" VPS[Evoxt VPS Malaysia
PM2 + Nginx] CF[Cloudflare
CDN + DDoS Protection] VERCEL[Vercel
Staging Only] end RSS --> INGEST ADMIN --> DEEPSEEK INGEST --> DEEPSEEK DEEPSEEK --> KIMI DEEPSEEK --> VALIDATE KIMI --> VALIDATE VALIDATE --> MDX_EN VALIDATE --> MDX_ZH MDX_EN --> GIT MDX_ZH --> GIT GIT -->|push to main| VPS GIT -->|push to develop| VERCEL VPS --> CF GIT --> NEXTJS NEXTJS --> INTL NEXTJS --> MDX_RENDER NEXTJS --> SEARCH style RSS fill:#1e3a5f,stroke:#38bdf8,color:#e2e8f0 style ADMIN fill:#1e3a5f,stroke:#38bdf8,color:#e2e8f0 style DEEPSEEK fill:#064e3b,stroke:#34d399,color:#e2e8f0 style KIMI fill:#064e3b,stroke:#34d399,color:#e2e8f0 style INGEST fill:#064e3b,stroke:#34d399,color:#e2e8f0 style VALIDATE fill:#064e3b,stroke:#34d399,color:#e2e8f0 style MDX_EN fill:#44403c,stroke:#a8a29e,color:#e2e8f0 style MDX_ZH fill:#44403c,stroke:#a8a29e,color:#e2e8f0 style GIT fill:#44403c,stroke:#a8a29e,color:#e2e8f0 style NEXTJS fill:#312e81,stroke:#818cf8,color:#e2e8f0 style INTL fill:#312e81,stroke:#818cf8,color:#e2e8f0 style MDX_RENDER fill:#312e81,stroke:#818cf8,color:#e2e8f0 style SEARCH fill:#312e81,stroke:#818cf8,color:#e2e8f0 style VPS fill:#7f1d1d,stroke:#f87171,color:#e2e8f0 style CF fill:#7f1d1d,stroke:#f87171,color:#e2e8f0 style VERCEL fill:#7f1d1d,stroke:#f87171,color:#e2e8f0 ``` ## AI 内容管道 ``` sequenceDiagram participant RSS as RSS Feeds participant Pipeline as AI Pipeline participant DeepSeek as DeepSeek-V3 participant Kimi as Kimi K2 participant Git as GitHub participant VPS as Production VPS Note over RSS,VPS: Triggered daily via GitHub Actions or manually from Admin Panel RSS->>Pipeline: Fetch & normalize feeds Pipeline->>Pipeline: Deduplicate against cache Pipeline->>Pipeline: Cluster related stories loop For each story cluster Pipeline->>DeepSeek: Generate EN article (800-1200 words) DeepSeek-->>Pipeline: Structured JSON (title, body, IOCs, TTPs) Pipeline->>Pipeline: Zod validation + CVE sanitization Pipeline->>Kimi: Translate EN → ZH Kimi-->>Pipeline: Chinese article (title, excerpt, body) Pipeline->>Pipeline: Write EN + ZH MDX files end Pipeline->>Git: git commit + push Git->>VPS: Deploy via SSH (GitHub Actions) VPS->>VPS: npm run build + pm2 restart ``` ## 技术栈 | 层级 | 技术 | 用途 | | -------------------- | ----------------------------- | --------------------------- | | **框架** | Next.js 16(App Router、TypeScript) | SSG + 服务器路由 | | **样式** | Tailwind CSS v4 + shadcn/ui | 暗黑网络安全主题 | | **内容** | gray-matter + next-mdx-remote | 基于 Git 的 MDX CMS | | **i18n** | next-intl v4 | 英文/中文双语路由 | | **AI — 文章** | DeepSeek-V3 | 快速、低成本的文章生成 | | **AI — 翻译** | Kimi K2(Moonshot AI) | 优秀的中文质量 | | **AI — 备用** | OpenRouter 免费模型 | 零成本备用层级 | | **搜索** | 服务端 API | 全文文章搜索 | | **认证** | NextAuth v5 + bcrypt | 管理面板认证 | | **验证** | Zod v4 | Frontmatter + 管道模式验证 | | **部署 — 生产** | Evoxt VPS(马来西亚)+ PM2 + Nginx | 无服务器超时限制 | | **部署 — 预发布** | Vercel | 预览部署 | | **CDN** | Cloudflare(免费层级) | DDoS 防护 + 边缘缓存 | | **CI/CD** | GitHub Actions | 推送到 `main` 时自动部署 | ## 功能 ### 威胁情报 - **IOC 表格** — 可排序、可筛选,支持 CSV 导出与复制到剪贴板 - **MITRE ATT&CK 矩阵** — 战术列链接至 attack.mitre.org - **CVE 自动链接** — 内联 CVE 卡片,关联实时 NVD 数据查询 - **严重性徽章** — 关键/高/中/低视觉指示 - **威胁行为体卡片** — 来源、活动、受影响行业 ### 内容平台 - **双语支持** — 完整的英文/中文支持,带区域感知路由 - **微信检测** — 自动将微信浏览器用户重定向至 `/zh` - **搜索** — 支持 Cmd/Ctrl+K 的搜索对话框,调用服务端 API - **RSS 与微信订阅** — `/api/feed`(Atom)与 `/api/wechat?locale=zh`(JSON) - **SEO** — JSON-LD 结构化数据、XML 站点地图、hreflang 标签、每个分类的 OG 图像 - **暗黑主题** — 专为网络安全设计的审美风格 ### 管理面板(`/admin`) - **订阅源阅读器** — 浏览 RSS 源,选择要综合的故事 - **AI 编辑器** — 模型选择(DeepSeek/Kimi/自动)、长度控制、自定义提示词 - **流式生成** — 实时 NDJSON 状态,按模型显示进度 - **一键发布** — 仅英文或英文+中文(自动通过 Kimi 翻译) - **文章管理** — 编辑、预览与管理已发布内容 ### AI 管道安全机制 - **CVE 验证** — 三层防御机制,防止幻觉 CVE ID(提示规则、Zod 模式过滤、正文清洗) - **语言验证** — 检测并移除英文文章中的中文字符 - **模式强制** — 每个 AI 生成的文章均通过 Zod 模式验证 - **去重** — 基于缓存的去重机制,防止重复生成文章 ## 项目结构 ``` zcybernews/ ├── app/ │ ├── [locale]/ # EN/ZH routes │ │ ├── articles/ # Article listing + detail pages │ │ ├── threat-intel/ # Threat intel reports │ │ ├── categories/ # Category pages │ │ └── tags/ # Tag pages │ ├── admin/ # Admin panel (auth-protected) │ └── api/ # API routes (feed, search, CVE, admin) ├── components/ │ ├── articles/ # ArticleCard, ArticleMeta │ ├── threat-intel/ # IOCTable, MitreMatrix │ ├── search/ # SearchDialog (Cmd+K) │ └── layout/ # Header, Footer ├── content/ │ ├── en/posts/ # English articles (.mdx) │ ├── en/threat-intel/ # English TI reports (.mdx) │ ├── zh/posts/ # Chinese articles (.mdx) │ └── zh/threat-intel/ # Chinese TI reports (.mdx) ├── scripts/ │ ├── pipeline/ # AI content pipeline orchestrator │ ├── ai/ # Provider config, prompts, schemas │ └── utils/ # Cache, dedup, rate limiting ├── lib/ # Content helpers, MDX compiler, types ├── messages/ # i18n strings (en.json, zh.json) ├── proxy.ts # Locale + WeChat middleware └── auth.ts # NextAuth v5 configuration ``` ## 快速开始 ### 前置条件 - Node.js 22+ - npm 10+ ### 安装 ``` git clone https://github.com/jamesKhor/Zcybernews.git cd Zcybernews npm install cp .env.example .env.local ``` ### 环境变量 使用 API 密钥编辑 `.env.local`。完整列表请参考 [`.env.example`](.env.example)。最低要求: ``` NEXTAUTH_SECRET= # openssl rand -base64 32 ADMIN_USERNAME= # Admin panel login ADMIN_PASSWORD_HASH= # node -e "require('bcryptjs').hash('pass',12).then(console.log)" DEEPSEEK_API_KEY= # Article generation KIMI_API_KEY= # Chinese translation ``` ### 开发 ``` npm run dev # http://localhost:3000 (redirects to /en) npm run build # Production build npx tsc --noEmit # Type-check only ``` ### 运行 AI 管道 ``` # 从 RSS 源生成文章 npx tsx scripts/pipeline/index.ts --max-articles=5 # 干运行(获取源但不生成) npx tsx scripts/pipeline/index.ts --dry-run # 将现有的英文文章翻译成中文 npx tsx scripts/translate-existing.ts ``` ## 部署 ``` graph LR DEV[Local Dev] -->|git push| GH[GitHub] GH -->|main branch| VPS[Evoxt VPS
Production] GH -->|develop branch| VERCEL[Vercel
Staging] GH -->|cron / manual| PIPELINE[AI Pipeline
GitHub Actions] PIPELINE -->|commit articles| GH VPS --> NGINX[Nginx
Reverse Proxy] NGINX --> CF[Cloudflare
CDN + SSL] CF --> USER[zcybernews.com] style DEV fill:#1e3a5f,stroke:#38bdf8,color:#e2e8f0 style GH fill:#44403c,stroke:#a8a29e,color:#e2e8f0 style VPS fill:#7f1d1d,stroke:#f87171,color:#e2e8f0 style VERCEL fill:#312e81,stroke:#818cf8,color:#e2e8f0 style PIPELINE fill:#064e3b,stroke:#34d399,color:#e2e8f0 style NGINX fill:#7f1d1d,stroke:#f87171,color:#e2e8f0 style CF fill:#7f1d1d,stroke:#f87171,color:#e2e8f0 style USER fill:#7f1d1d,stroke:#f87171,color:#e2e8f0 ``` | 分支 | 目标 | 触发机制 | | --------- | ------------------ | ------------------------------------------- | | `main` | Evoxt VPS(马来西亚) | 自动推送 — SSH + 构建 + PM2 重启 | | `develop` | Vercel | 自动推送 — 预览部署 | | 手动/定时 | GitHub Actions | AI 管道 — 生成并提交文章 | ## 文章 Frontmatter 每个 MDX 文章都会根据 Zod 模式进行验证。必填字段: ``` --- title: "Article Title" slug: "url-slug" date: "2026-04-13" excerpt: "1-2 sentence summary" category: "threat-intel" # threat-intel | vulnerabilities | malware | industry | tools | ai tags: ["ransomware", "apt"] language: "en" # en | zh author: "ZCyberNews" draft: false --- ``` 可选威胁情报字段:`severity`、`cvss_score`、`cve_ids`、`threat_actor`、`iocs`、`ttp_matrix` 等更多字段。完整模式请参考 [`lib/types.ts`](lib/types.ts)。 ## 许可证 所有权利保留。本项目为专有项目。
基于 [Next.js](https://nextjs.org) 构建 | 由 [DeepSeek](https://deepseek.com) & [Kimi](https://moonshot.cn) 提供支持
标签:AI 内容生成, AI 智能体, AI 翻译, App Router, Cloudflare CDN, CVE 清洗, DDoS 防护, DeepSeek, GitHub Actions, Kimi 大模型, MDX, next-intl, Nginx, OSV, PM2, RSS 聚合, SEO, Server-side Search, SSG, Vercel, VPS, Zod 架构, 中文英文, 内容去重, 内容校验, 双语内容, 国际化路由, 威胁情报, 安全新闻, 开发者工具, 开源框架, 持续集成, 摘要生成, 文章生成, 深度推理, 漏洞分析, 熵值分析, 站长工具, 网络安全, 自动化发布管道, 自动笔记, 路径探测, 部署自动化, 隐私保护, 静态站点生成