kossisoroyce/ares

GitHub: kossisoroyce/ares

Ares 是一款基于 eBPF 遥测与每分钟 AI 调查周期的 Linux 主机安全调查工具,能够将可疑活动关联为证据驱动的判定并提供安全的自动化响应。

Stars: 0 | Forks: 0

Ares

面向 Linux 的 AI 原生主机安全调查工具。
持续的 eBPF 遥测技术与每分钟一次的 AI 调查。

CI PyPI Python versions License Ruff

Ares 持续记录进程、网络、文件系统、身份认证和 持久化事件,实时运行确定性检测,并且每分钟 运行一次 AI 调查周期,将可疑活动重构成 有证据支持的判定。 设计原则(规范 §1): ## 架构 ``` kernel/OS ──► sensors ──► redaction + enrichment ──► SQLite store │ streaming detector ──► immediate critical path │ (evidence capture) ▼ one-minute scheduler ──► correlation ──► cases ──► AI investigator │ policy + response ──► notifications / approved actions ``` | 层级 | 模块 | 规范 | | ----- | ------ | ---- | | 持续 daemon | `ares.daemon` | §6.1 | | 传感器(eBPF + procfs/psutil 后备) | `ares.sensors` | §8 | | 事件 schema | `ares.events` | §9 | | 脱敏处理 | `ares.redaction` | §11 | | 信息扩充 | `ares.enrichment` | §10 | | 流式检测 | `ares.detection` | §12 | | 关联分析 | `ares.correlation` | §16 | | 基线分析 | `ares.baseline` | §17 | | 案例 | `ares.cases` | §18 | | AI 调查器 | `ares.investigator` | §19 | | 策略与响应 | `ares.policy`, `ares.response` | §22 | | 调度器 | `ares.scheduler` | §15 | | 存储 | `ares.storage` | §23 | | CLI | `ares.cli` | §29 | ## 平台支持 首个发布版本面向 Linux(Ubuntu/Debian/Amazon Linux/Rocky/Alma)。 传感器层是抽象的:在 Linux 上首选 eBPF,并带有自动的 procfs/psutil/inotify 后备机制(规范 §8.2),这也使得完整的 pipeline 可以在 macOS 上运行以供开发使用。 ## 安装 ``` pip install -e ".[dev,fs]" # from source ``` 可选的附加功能:`ai`(Anthropic 原生提供商)、`api`(本地 HTTP API)、 `fs`(watchdog 文件系统监视器)。OpenAI SDK(用于 OpenRouter)是 核心依赖项。 ## 快速开始(开发模式,无需 root) ``` export ARES_STATE_DIR="$HOME/.ares" # dev state dir ares init ares daemon run # terminal 1: collect + detect ares investigator run # terminal 2: one-minute investigation cycle ares status ares cases list ``` ## AI 调查(默认使用 OpenRouter) 默认提供商是 **OpenRouter**,因此你可以通过两个 环境变量运行*任何*模型 —— 无需更改代码或配置: ``` export OPENROUTER_API_KEY=sk-or-... export OPENROUTER_MODEL=anthropic/claude-3.5-sonnet # any OpenRouter model id ``` 其他后端(将 `investigation.model_provider` 设置为相应值): | 提供商 | 环境变量 | | -------- | -------- | | `openrouter`(默认) | `OPENROUTER_API_KEY`, `OPENROUTER_MODEL` | | `openai` / 自托管 gateway | `OPENAI_API_KEY`, `OPENAI_BASE_URL`, `OPENAI_MODEL` | | `anthropic` | `ANTHROPIC_API_KEY` (`pip install -e ".[ai]"`) | | `local` | 无 —— 确定性的,无需外部模型(规范 §11.3) | 如果不存在任何凭证,调查器会自动**回退到 `local`**,因此全新安装只需零配置即可运行,并在你 设置环境变量后即刻激活。密钥从环境中读取,从不存储 在配置中。请参阅 [`examples/ares.env.example`](examples/ares.env.example)。 ## 通知 Ares 通过**仅限出站**的渠道推送事件 —— 主机上无需 暴露任何入站内容。通过环境变量配置任意子集: ``` export ARES_NOTIFY_MIN_SEVERITY=high # global floor export ARES_SLACK_WEBHOOK=https://hooks.slack.com/... # recommended default export ARES_PAGERDUTY_ROUTING_KEY=... # pages on-call (critical) export ARES_NOTIFY_WEBHOOK=https://ops.internal/ares # route anywhere export ARES_SMTP_HOST=smtp.example.com ARES_SMTP_TO=secops@example.com # email ``` ``` ares notify channels # show what's active ares notify test # send a test alert through every channel ``` | 渠道 | 最适合 | 阈值 | | ------- | -------- | --------- | | Slack | 团队可见性,丰富的格式 | 全局 `min_severity` | | 通用 webhook | 路由到你自己的工具 | 全局 `min_severity` | | Email / SMTP | 通用后备方案 | 全局 `min_severity` | | PagerDuty | 针对真实事件唤醒待命人员 | 独立的 `min_severity`(默认为 `critical`) | 告警疲劳通过全局严重性下限、PagerDuty 独立的 更高阈值以及案例去重来控制(重复的活动会更新同一个案例 / 同一个 PagerDuty 事件,而不是重复发送提醒)。 ## 响应安全性 - 默认模式为 `recommend`:不会自动运行任何破坏性操作。 - 仅允许列表中的**证据**操作(哈希/捕获/保留)无需 批准即可运行。遏制/恢复操作需要操作员明确批准,并且 带有回滚元数据(规范 §22.3)。 - `delete_file` 和 `execute_generated_shell_command` 被**禁止**; 语言模型永远不会获得 shell 访问权限(规范 §22.3)。 ## Python API ``` from ares import Ares client = Ares.from_config("examples/config.yaml") print(client.status()) for case in client.cases.list(status="open"): print(case["title"], case["risk_score"]) ``` ## 测试 ``` pytest # unit + integration + attack simulations (safe fixtures) ``` ## 状态 此仓库实现了阶段 1 和阶段 2 的核心部分(规范 §36)。 eBPF 程序(`bpf/`)和特权响应助手属于 Linux 集成 步骤;请参阅 `docs/` 了解路线图和安全模型。 基于 Apache-2.0 许可。
标签:AI, Docker镜像, FOFA, 安全规则引擎, 安全调查, 自动化代码审查, 自动化响应, 逆向工具