Errorcode-14/CyberIntel_Discord_System
GitHub: Errorcode-14/CyberIntel_Discord_System
一个基于 GitHub Actions 和 Discord Webhook 的定时网络安全情报聚合系统,自动从 RSS、公开 API 和网页抓取等多渠道采集威胁数据并分类分发。
Stars: 1 | Forks: 0
# CyberIntel Discord 系统 🛡️
CyberIntel Discord 系统是一个定时的网络安全情报系统,它从 RSS feeds、API 和网页抓取中汇总威胁数据,并将结构化的安全更新分发到五个分类的 Discord 频道中。
## 🔗 查看情报流
**加入 Discord 服务器以探索情报流:**
### 可用频道
* 📰 新闻
* 🚨 CVE 更新
* 🎯 威胁情报
* 🐞 Bug Bounty
* 🛠️ 工具与资源
更新每天会从受信任的网络安全来源自动收集、分类并发布多次。
## 工作原理
该机器人每天在 GitHub Actions 上唤醒 5 次,从跨越 RSS feeds、公开 API 和网页抓取的 20 多个来源中拉取数据,对所有内容进行去重处理,确保您永远不会看到同一篇文章出现两次,然后将富 embed 卡片发布到您的 Discord 频道中。每张卡片都会显示文章标题、从页面提取的真实摘要、可点击的 URL,以及其下方的原生 Discord 链接预览。
## 您的频道及其流入的内容
### `@threat-intel` - 深度威胁情报
严肃的内容。来自业界最受信任的机构的 APT 活动、国家级活动、违规事后分析以及深度的恶意软件分析。
**RSS feeds:**
- Krebs on Security
- Schneier on Security
- ESET Research
- Check Point Research
- WeLiveSecurity
**抓取(无 RSS):**
- Mandiant Blog
- Unit42 by Palo Alto Networks
- Recorded Future Blog
- CrowdStrike Blog
- Microsoft Security Blog
### `#cve-updates` - 漏洞警报
过去 24 小时内发布的 CVSS 评分为 7.0 或以上的每个 CVE。严重 CVE (9.0+) 会触发 @everyone 提醒。CISA 确认的主动利用漏洞在被添加到 KEV 目录的那一刻,会获得单独的 @everyone 警报。
**来源:**
- NVD / NIST CVE API v2.0 - 评分漏洞
- CISA 已知被利用漏洞 (KEV) 目录
### `#bug-bounty` - 漏洞利用与漏洞研究
来自研究人员和平台的公开 PoC 漏洞利用、Bug Bounty 披露以及前沿的漏洞研究。
**RSS feeds:**
- Exploit-DB
- HackerOne Hacktivity
- PortSwigger Research
- Chromium Bug Tracker
- Intigriti Blog
- Medium BugBountyWriteup
**抓取(无 RSS):**
- Google Project Zero
- watchTowr Labs
- Zero Day Initiative (ZDI)
### `#daily-news` - 安全新闻摘要
每日新闻周期——数据泄露、勒索软件、行业新闻、政府公告以及其他所有值得浏览的内容。
**RSS feeds:**
- Bleeping Computer
- The Hacker News
- SANS ISC Diary
- Dark Reading
- SecurityWeek
- Threatpost
- CIS Advisories
- Cyber Security News
**抓取(无 RSS):**
- Help Net Security
### `#tools-resources` - 新工具与研究
GitHub 上跨越 4 个主题领域新创建的安全仓库,以及来自 ArXiv 的最新学术安全研究。
**来源:**
- GitHub API - 新仓库标签:`cybersecurity`、`penetration-testing`、`osint`、`bug-bounty`
- ArXiv cs.CR — 密码学与安全研究论文
## 设置
### 1. Fork 或克隆此仓库
```
git clone https://github.com/YOUR_USERNAME/cyber-intel-bot.git
cd cyber-intel-bot
```
### 2. 创建 Discord webhooks
对于您的 5 个频道中的每一个,执行以下操作:
1. 右键单击频道 → **Edit Channel**
2. 转到 **Integrations → Webhooks → New Webhook**
3. 将其命名为 `CyberIntel Bot`
4. 点击 **Copy Webhook URL** 并保存它
### 3. 将 secrets 添加到 GitHub
转到您的仓库 → **Settings → Secrets and variables → Actions → New repository secret**
添加这 5 个 secrets:
| Secret 名称 | 用于 |
|---|---|
| `DISCORD_THREAT_INTEL` | `@threat-intel` |
| `DISCORD_CVE_UPDATES` | `#cve-updates` |
| `DISCORD_BUG_BOUNTY` | `#bug-bounty` |
| `DISCORD_DAILY_NEWS` | `#daily-news` |
| `DISCORD_TOOLS_RESOURCES` | `#tools-resources` |
### 4. 测试它
转到 **Actions 选项卡 → CyberIntel Discord Bot → Run workflow**
首次运行大约需要 3 分钟。检查您的 Discord — 所有内容应该都开始接收了。
## 运行时间表 (IST)
| 时间 | 运行内容 |
|---|---|
| 上午 6:30 | CVE 检查 + 威胁情报 |
| 上午 9:30 | 每日新闻摘要 |
| 下午 1:30 | 全面扫描 — 所有频道 |
| 下午 5:30 | Bug bounty + 工具 |
| 晚上 9:30 | 研究论文 + 总结 |
## 添加新来源
### 站点有 RSS - 添加一行
在 `src/bot.py` 中找到您想要的频道的 feed 列表,并添加您的站点:
```
DAILY_NEWS_FEEDS = [
# ... existing feeds ...
("https://yoursite.com/feed/", "Your Site Name"), # add here
]
```
Feed 列表 → 频道映射:
- `DAILY_NEWS_FEEDS` → `#daily-news`
- `THREAT_INTEL_FEEDS` → `@threat-intel`
- `BUG_BOUNTY_FEEDS` → `#bug-bounty`
### 站点没有 RSS - 添加一个抓取块
**第 1 步:** 在 Chrome 中打开该站点,按 F12,点击箭头图标,将鼠标悬停在文章卡片上以查找:
- 重复的 wrapper 元素(例如 `article`、`div.post-card`)
- 其内部的 title 元素(例如 `h2`、`h3`)
- link 元素(例如 `a`、`h3 a`)
**第 2 步:** 将其添加到 `src/bot.py` 中的相应函数:
```
def fetch_daily_news_scraped() -> list:
items = []
# ... existing scrape blocks ...
items += scrape(
url = "https://example-security-blog.com/",
article_sel = "article.post-card", # repeating wrapper
title_sel = "h2", # title element
link_sel = "a", # link element
base_url = "https://example-security-blog.com",
label = "Example Blog",
webhook_key = "daily_news",
color = "news",
)
return items
```
函数 → 频道映射:
- `fetch_daily_news_scraped()` → `#daily-news`
- `fetch_threat_intel_scraped()` → `@threat-intel`
- `fetch_bug_bounty_scraped()` → `#bug-bounty`
**适用于大多数安全博客的常见 CSS selector 模式:**
```
# WordPress(最常见)
article_sel = ".post, article"
title_sel = ".entry-title, h2.post-title"
link_sel = ".entry-title a, h2 a"
# 基于 Card 的布局
article_sel = ".card, .blog-card, .post-card"
title_sel = "h2, h3, .card-title"
link_sel = "a"
# 简单的文章标签
article_sel = "article"
title_sel = "h2, h3"
link_sel = "a"
```
如果抓取工具返回 0 个项目,则该站点可能是 JavaScript 渲染的(受 Cloudflare 保护)。请检查它们是否有 RSS feed —— 大多数都有。
### 添加任何内容后
```
git add src/bot.py
git commit -m "add: Site Name as source"
git push
```
更改将在下一次计划运行时生效,或者从 Actions 选项卡手动触发它。
## 自定义
**只想要严重的 CVE (CVSS ≥ 9.0):**
```
# src/bot.py — 在 run() 函数中
all_items += fetch_nvd_cves(min_cvss=9.0, hours=24) # change 7.0 to 9.0
```
**按关键字过滤 - 仅在文章匹配时发布:**
```
# 将此添加到 run() 内部,就在 send_embed 调用之前
KEYWORDS = ["ransomware", "zero-day", "rce", "actively exploited", "critical"]
if not any(k in item["title"].lower() for k in KEYWORDS):
skipped += 1
continue
```
**更改运行时间表:**
编辑 `.github/workflows/cyber_intel.yml` 中的 cron 行。使用 [crontab.guru](https://crontab.guru) 构建自定义时间表。时间为 UTC - 减去 5:30 即为 IST。
## 去重的工作原理
每次机器人发布内容时,它都会将该项目的指纹保存到 `sent_ids.json` 中。GitHub Actions 使用 `actions/cache` 在运行之间缓存此文件。因此,即使一篇文章在 feed 中保留一周,它也只会发布到 Discord 一次。该缓存最多保留最近的 2,000 个项目。
## 故障排除
首先检查日志:**Actions 选项卡 → 点击最新的一次运行 → 点击 `run-bot`**
| 日志行 | 含义 | 修复方法 |
|---|---|---|
| `✗ Failed` | Discord 拒绝了该帖子 | 检查 secrets 中的 webhook URL 是否正确 |
| `Webhook not configured` | Secret 未设置 | 在 GitHub Settings 中添加缺失的 secret |
| `Scraped X: 0 items` | Selectors 不匹配或站点使用 JS | 重新检查 HTML 或切换到 RSS |
| `403 Client Error` | 站点阻止了抓取工具 (Cloudflare) | 改用它们的 RSS feed |
| `Rate limited` | 一次有太多 Discord 帖子 | 机器人会自动处理 — 无需采取任何行动 |
## 成本
**$0。** GitHub Actions 免费层级每月提供 2,000 分钟。该机器人每月大约使用 300 分钟(每天运行 5 次 × 每次约 2 分钟)。您有充足的余量。
## 文件结构
```
cyber-intel-bot/
├── .github/
│ └── workflows/
│ └── cyber_intel.yml ← schedule + secrets config
├── src/
│ └── bot.py ← all the logic lives here
├── requirements.txt ← requests, feedparser, beautifulsoup4, lxml
├── .gitignore
└── README.md
```
标签:GitHub Actions, RSS, URL抓取, 威胁情报, 开发者工具, 数据抓取, 机器人, 网络调试, 自动化, 自动笔记, 逆向工具