sraodev/argus

GitHub: sraodev/argus

基于 Claude LLM 的 AI 安全威胁情报代理,自动采集、分类并推送带有双角色视角洞察的安全预警。

Stars: 0 | Forks: 0

# 👁️ ARGUS — AI 风险收集与紧急预警系统 **为 Guard0 打造的 AI 安全威胁情报代理** — 一个自动化流水线,可扫描 AI/ML 安全领域,基于角色视角对威胁进行分类,并将 优先级警报发送至 Slack(可选 WhatsApp)。 Argus 在两种模式下运行: 1. **计划任务模式**(推荐) — 通过 Claude Code Scheduled Tasks 使用您的 Claude Max 订阅。零 API 额度消耗。每 4 小时自动运行一次。 2. **CLI 模式** — 独立的 Python CLI 直接调用 Anthropic API。适用于 临时运行、无头部署(树莓派、服务器)或 Claude Code 之外的流水线。 ## 为什么选择 Argus AI 安全领域每天产生的新闻量超出了任何团队手动分类的能力。其中大部分是 噪音;剩下的一小部分则是极其关键且具有时效性的。Argus 的存在是为了: - **持续阅读** — 13 个 RSS 订阅源,外加可选的 Feedly 类别和 Claude 网页搜索。 - **智能分类** — 每篇相关文章都会获得一个分类、严重程度评估、 CISO 简报、工程师行动建议,以及关于与 Guard0 客户相关性的备注。 - **对重要事项发出警报** — 关键项目会在几分钟内发送到 Slack;其余项目将汇总到 每日摘要和每周高管简报中。 - **保持低成本和可移植性** — Mac → 树莓派 → 云,相同的代码可在任何地方运行。 ## 系统架构 ``` ┌───────────────────────────────────────────────┐ │ SOURCES (parallel) │ │ ┌──────────┐ ┌──────────┐ ┌──────────────┐ │ │ │ Feedly │ │ 13 RSS │ │ Claude │ │ │ │ category │ │ feeds │ │ web_search │ │ │ └─────┬────┘ └─────┬────┘ └──────┬───────┘ │ └────────┼─────────────┼──────────────┼─────────┘ └─────────────┼──────────────┘ ▼ ┌─────────────────────────┐ │ Dedup vs seen_urls │ └────────────┬────────────┘ ▼ ┌─────────────────────────┐ │ Pre-filter (keywords) │ ← skip / fast / needs-llm └────────────┬────────────┘ ▼ ┌─────────────────────────┐ │ Claude classification │ ← criticality, CISO TL;DR, │ (batch of 10) │ engineer action, tags └────────────┬────────────┘ ▼ ┌───────────────────────┴───────────────────────┐ ▼ ▼ ┌─────────────────────┐ ┌─────────────────────┐ │ CRITICAL pathway │ │ Persistence │ │ ── Slack alert │ │ ── today_articles │ │ ── WhatsApp ping │ │ ── seen_urls │ │ (immediate) │ │ ── scans/.json │ └─────────────────────┘ └─────────────────────┘ │ ▼ ┌────────────────────────────┐ │ Daily digest (8am cron) │ │ ── Slack (full Block Kit) │ │ ── WhatsApp (top 3) │ │ ── archive digest │ └────────────────────────────┘ ``` ### 本地状态 ``` ~/.argus/ ├── .env # secrets — gitignored, never in repo └── data/ ├── seen_urls.json # dedup cache (max 5000 URLs, auto-trimmed) ├── today_articles.json # accumulator, cleared after daily digest ├── scans/.json # per-scan audit trail └── digests/.json # archived daily/weekly digests ``` 所有 Argus 的状态都保存在本地。没有云数据库,也没有共享存储。可移植到任何机器上。 ### 领域模型 | 类型 | 用途 | |---|---| | `Article` | 来自任何来源的原始文章:url、title、summary、source、published_at、fetched_from | | `Classification` | LLM 输出:relevant、category、criticality、ai_specific、tags、ciso_tldr、engineer_action、one_line_summary、guard0_relevance | | `ClassifiedArticle` | Article + Classification + classified_at | | `Digest` | date + articles + stats (计数) + optional weekly_summary | 分类:`vulnerability` · `attack` · `regulation` · `tool` · `research` · `incident` · `advisory` 严重程度:`critical` · `high` · `medium` · `low` · `informational` ### 基于角色的洞察 每篇相关文章都会为两类受众提供标注: - **CISO TL;DR** — 面向董事会级别的单句风险定调。("Board-level risk: a core ML training library used across the data science stack was actively backdoored." / 董事会级别风险:数据科学堆栈中广泛使用的核心 ML 训练库被发现植入了后门。) - **Engineer action** — 具体的下一步单句行动建议。("Pin pytorch-lightning to a known-good version, scan recent CI runs, rotate exposed tokens." / 将 pytorch-lightning 固定为已知的安全版本,扫描近期的 CI 运行记录,轮换已暴露的 token。) 这使得摘要对同一消息中的两类受众都具有可操作性。 ## 设置 ### 前置条件 - macOS、Linux 或 Raspberry Pi - Python ≥ 3.11 - 一个 Slack 工作区(可选,但配合使用会使 Argus 的功能强大得多) - 满足以下条件之一: - Claude Max 订阅 → 通过 Scheduled Tasks 运行(无 API 费用) - Anthropic API 额度 → 通过 CLI 运行 ### 1. 克隆并安装 ``` git clone https://github.com/sraodev/argus.git cd argus python3 -m venv .venv && source .venv/bin/activate pip install -e . ``` ### 2. 配置密钥 ``` mkdir -p ~/.argus cp .env.example ~/.argus/.env $EDITOR ~/.argus/.env ``` 运行扫描的最低配置: ``` ANTHROPIC_API_KEY=sk-ant-... # only needed for CLI mode (skip for Scheduled Tasks) SLACK_BOT_TOKEN=xoxb-... SLACK_CHANNEL=#argus-intel ``` 可选配置: ``` FEEDLY_TOKEN=... # https://feedly.com/v3/auth/dev FEEDLY_USER_ID= FEEDLY_STREAMS=user//category/ TWILIO_ACCOUNT_SID=... TWILIO_AUTH_TOKEN=... TWILIO_WHATSAPP_FROM=whatsapp:+14155238886 WHATSAPP_TO=whatsapp:+91XXXXXXXXXX ``` ### 3. 验证 ``` argus status ``` 您应该能看到每个已配置的服务显示 ✓。 ## 使用说明 ### CLI 命令 | 命令 | 功能说明 | |---|---| | `argus scan` | 获取 → 去重 → 分类 → 警报关键项 → 持久化。默认:最近 4 小时。 | | `argus scan --dry-run` | 相同的获取+分类流水线,打印表格,但不写入 Slack/存储。 | | `argus scan --sources rss` | 限制为子集:可选 `feedly`、`rss`、`web` 中的任意组合,以逗号分隔。 | | `argus scan --hours 24` | 首次运行或停机后使用更宽的时间窗口。 | | `argus digest` | 将 `today_articles.json` 汇总为摘要,发送,归档并清空。 | | `argus digest --weekly` | 最近 7 天的归档摘要 + Claude 撰写的高管简报。 | | `argus digest --dry-run` | 打印摘要但不发送。 | | `argus query ""` | 按关键字搜索最近 7 天内的最新文章。 | | `argus setup` | 显示哪些服务已配置以及哪些缺失。 | | `argus status` | 显示已见 URL 计数、今日文章数、归档摘要计数及服务健康状况。 | | `argus -v ` | 添加 `-v` 以输出调试日志。 | ### 日常工作流 ``` argus scan # critical alerts pop into Slack as they're found argus scan # … repeat through the day argus digest # end-of-day roll-up message + archive ``` ### 实时测试(无 Slack/存储副作用) ``` argus scan --sources rss --hours 24 --dry-run ``` ## Slack 集成 ### 应用设置(一次性) 1. https://api.slack.com/apps → **Create New App** → **From scratch** → 命名为 `Argus` 2. **OAuth & Permissions** → 添加 Bot Token Scopes:`chat:write` 和 `chat:write.public` 3. **Install to Workspace** → 复制 **Bot User OAuth Token** (`xoxb-...`) 4. 创建一个频道(例如 `#argus-intel`);如果是私有频道,请在频道内运行 `/invite @Argus` 5. 添加至 `~/.argus/.env`: SLACK_BOT_TOKEN=xoxb-... SLACK_CHANNEL=#argus-intel ### 消息格式 **关键警报**(每个关键项一条,立即发送): ``` 🚨 ARGUS CRITICAL ALERT ** <one_line_summary> 🎯 CISO TL;DR: Board-level risk: <executive framing> 🔧 Engineer action: <concrete next step> 🏢 Guard0 relevance: <why this matters for AI-first enterprises> 🏷️ <tags> | 📁 <category> | 📰 <source> 🔗 <Read more> ``` **每日摘要**(每天一条,按严重程度分组): ``` 👁️ Argus Daily Intel — 2026-05-01 📊 3 Critical | 2 High | 5 Medium | 3 Low | 1 Info (total 14) 🚨 CRITICAL (3) • <title> — <summary> 🔗 <link> … ⚠️ HIGH (2) … ``` ## WhatsApp 集成(可选) 使用 Twilio。免费的沙盒可用于测试;生产环境需要经过验证的发送方号码。 1. 在 https://www.twilio.com 注册 → 激活 WhatsApp 沙盒 2. 在您的手机上,向 Twilio 沙盒号码发送 `join <sandbox-phrase>` 3. 添加至 `~/.argus/.env`: TWILIO_ACCOUNT_SID=AC... TWILIO_AUTH_TOKEN=... TWILIO_WHATSAPP_FROM=whatsapp:+14155238886 WHATSAPP_TO=whatsapp:+91XXXXXXXXXX WhatsApp 消息特意保持简短 — 完整的摘要会发送至 Slack。 ## Feedly 集成(可选) 将您精心整理的 Feedly 类别添加为数据源。 1. https://feedly.com/v3/auth/dev → 点击 **"Get my access token"** 2. 记下您的用户 ID(显示在 token 上方)以及您的 category UUID(可在 Feedly URL 栏中查看) 3. 添加至 `~/.argus/.env`: FEEDLY_TOKEN=<long-token> FEEDLY_USER_ID=<uuid> FEEDLY_STREAMS=user/<uuid>/category/<uuid>,user/<uuid>/category/<uuid> **注意事项:** 开发者 token 有每天 250 次请求的速率限制,并且每约 30 天就会过期一次。 若需长期在无人值守环境下使用,请在 Feedly Developer Console 中注册一个 OAuth 应用。 ## 调度 — 四种进阶方案 Argus 旨在实现自动化运行。请选择与您的设置相匹配的方案。 ### 阶段 1 — Claude Code Scheduled Tasks(Mac 推荐 Max 用户使用) 使用您的 Claude Max 订阅。**零 API 额度消耗。** 仅在 Claude Desktop 处于打开状态时运行。 该任务位于 `~/.claude/scheduled-tasks/argus-scan/SKILL.md` — 这是一个真正的 Markdown 文件,您可以对其进行版本控制。仓库中同样在 [`scheduled-tasks/argus-scan/SKILL.md`](scheduled-tasks/argus-scan/SKILL.md) 保留了一份副本,以确保 可复现性。 安装步骤: ``` # Inside Claude Code, ask it to create a scheduled task with the contents of # scheduled-tasks/argus-scan/SKILL.md and cron "0 */4 * * *" ``` 该任务每 4 小时触发一次,抓取 RSS,在对话中进行分类(免费,使用 Max 订阅), 持久化数据至 `~/.argus/data/`,并发布至 Slack。 ### 阶段 2 — Cloud Routines(24/7 运行,Argus 验证通过后推荐) 运行在 Anthropic 的基础设施上,基于真实的 cron 定时任务,无需 Mac。使用相同的 SKILL.md 格式。访问 https://claude.ai/code/routines 进行设置。费用:按每次运行的 API 时间 计算(成本很低)。 ### 阶段 3 — Raspberry Pi(无头模式,始终在线) ``` # On the Pi git clone https://github.com/sraodev/argus.git cd argus && python3 -m venv .venv && source .venv/bin/activate && pip install -e . scp local-mac:~/.argus/.env ~/.argus/.env # Add a systemd timer (every 4 hours) sudo tee /etc/systemd/system/argus-scan.service > /dev/null <<EOF [Unit] Description=Argus AI security scan [Service] Type=oneshot User=pi WorkingDirectory=/home/pi/argus ExecStart=/home/pi/argus/.venv/bin/argus scan EOF sudo tee /etc/systemd/system/argus-scan.timer > /dev/null <<EOF [Unit] Description=Run Argus scan every 4 hours [Timer] OnCalendar=*-*-* 00/4:00:00 Persistent=true [Install] WantedBy=timers.target EOF sudo systemctl enable --now argus-scan.timer ``` ### 阶段 4 — 产品化为 Python 代理(可部署至云端) `src/argus/` 包的结构已经是一个可部署的代理。使用 FastAPI 或 Cloud Run 进行封装,将本地 JSON 存储替换为托管的 KV 存储(Cloudflare R2、Supabase、Turso), 您就能拥有一个多租户版本。 ## 成本 | 模式 | 费用 | 备注 | |---|---|---| | Scheduled Tasks (Max plan) | 每月额外 $0 | 包含在您已支付的订阅中。 | | CLI 搭配 Anthropic API | 约 $5–15/月 | 基于 Sonnet 模型,每天 6 次扫描,每次约 50 篇文章。 | | Slack | $0 | 免费的工作区层级。 | | Twilio WhatsApp | 约 $0.005/条消息 | 可选。 | | Feedly | $0 (开发者 token) | 或者如果您需要 OAuth/无过期时间的功能,可选择付费计划。 | ## 开发 ``` pip install -e ".[dev]" pytest -v # unit tests ruff check src/ # lint mypy src/ # type check python -m argus scan --dry-run -v # debug a scan ``` ### 项目结构 ``` argus/ ├── src/argus/ │ ├── cli.py # Click CLI: scan, digest, query, setup, status │ ├── config.py # ~/.argus/.env loader, typed Config dataclass │ ├── models.py # Pydantic: Article, Classification, Digest │ ├── storage.py # JSON file I/O, dedup, archives │ ├── classifier.py # Two-stage: keyword pre-filter → Claude batch │ ├── sources/ │ │ ├── feedly.py # Feedly v3 API │ │ ├── rss.py # feedparser, async-parallel │ │ └── web.py # Claude web_search tool │ └── deliver/ │ ├── slack.py # Block Kit formatter │ └── whatsapp.py # Twilio sender ├── scheduled-tasks/ │ └── argus-scan/SKILL.md # version-controlled task definition ├── tests/ └── pyproject.toml ``` ## 安全与隐私 - 密钥仅存在于 `~/.argus/.env` 中 — 已被 gitignore 且绝不会被记录进日志。 - 文章状态保留在本地。Argus 不会调用任何已配置来源(Feedly/RSS/Claude/Slack/Twilio)之外的 服务。 - Slack 消息会禁用链接展开功能,因此 URL 不会在展示时被自动抓取。 - Feedly 开发者 token 会过期;请在长时间无人值守部署前进行轮换。 ## 许可证 MIT。详见 `LICENSE`。 ## 作者 由 [@sraodev](https://github.com/sraodev) 为 [Guard0](https://guard0.ai) 构建, 即 AI 安全态势管理平台。</div><div><strong>标签:</strong>AI威胁情报, AI风险, Anthropic, CISO, CIS基准, Claude API, DLL 劫持, Feedly, Guard0, meg, Python, RSS聚合, SecOps, Slack机器人, 云安全架构, 人工智能安全, 信息安全, 合规性, 多渠道告警, 大语言模型, 威胁分类, 安全运营, 定时任务, 实时处理, 库, 应急响应, 情报分析, 情报收集, 扫描框架, 新闻监控, 无后门, 漏洞研究, 漏洞预警, 网络安全, 网络诊断, 自动化告警, 逆向工具, 隐私保护, 风险态势</div></article></div> <!-- 人机验证 --> <script> (function () { var base = (document.querySelector('base') && document.querySelector('base').getAttribute('href')) || ''; var path = base.replace(/\/?$/, '') + '/cap-wasm/cap_wasm.min.js'; window.CAP_CUSTOM_WASM_URL = new URL(path, window.location.href).href; })(); </script> </body> </html>