YashvantHange/AgentArmor
GitHub: YashvantHange/AgentArmor
一款面向 LLM API、Agent、MCP 和 RAG 系统的 AI 安全测试与审计工具,提供红队测试、风险评分与 CI/CD 集成。
Stars: 2 | Forks: 0
# AgentArmor
**AI 安全的护甲** — 持续测试、审计和红队测试 LLM API、agents、MCP servers 和 RAG 系统。
AgentArmor 会对您的 AI 技术栈运行结构化的安全探测,使用企业风险模型(0–100)对发现的问题进行评分,将结果映射到 **OWASP LLM Top 10**,并为开发人员和安全团队导出报告(SARIF、HTML、PDF、CSV)。
**最新版本:** [v1.3.1](https://github.com/YashvantHange/AgentArmor/releases/tag/v1.3.1) · [更新日志](CHANGELOG.md)
## AgentArmor 的功能
| 功能 | 描述 |
|------------|-------------|
| **Endpoint 扫描** | 测试任何兼容 OpenAI 或自动检测的 chat API URL |
| **云服务提供商** | 通过 LiteLLM 支持 OpenAI、Anthropic、Gemini 等 |
| **本地模型** | 离线扫描 `.gguf` 和 HuggingFace 模型 |
| **Agent / MCP / RAG** | 针对 tool-calling agents、MCP servers 和检索 pipelines 的安全探测 |
| **L0 自适应攻击** | 每个攻击目标(越狱、prompt 泄露、数据渗出)有 100+ 种突变变体 |
| **自博弈红队测试** | 攻击者 → 目标 → 裁决者循环,用于发现静态探测遗漏的漏洞 |
| **基准测试** | 比较模型和工具(AgentArmor 对比 PyRIT、Garak、Promptfoo、Inspect AI) |
| **市场** | 安装社区探测和 OWASP 包 |
| **监控** | 带有漂移检测的计划重扫 |
| **CI/CD** | GitHub Action + `agentarmor gate`,用于 pipeline 的安全门禁 |
**Windows 上的最终用户:** 下载 [发布版安装程序](https://github.com/YashvantHange/AgentArmor/releases/latest),双击并运行扫描 — 无需安装 Python、Rust 或 Node。
**开发者 / CLI 用户:** 需要 Python 3.10+。Rust 仅用于编译可选的原生签名引擎或自行构建 Tauri GUI。
## 快速安装
### Windows 桌面版(推荐)
1. 从 [Releases](https://github.com/YashvantHange/AgentArmor/releases/latest) 下载 **`AgentArmor_1.3.1_x64-setup.exe`** 或 **`.msi`**
2. 运行安装程序
3. 打开 **AgentArmor** → 选择扫描类型(API、本地模型、Agent、MCP、RAG、基准测试)
4. 配置目标 → 运行扫描 → 查看发现的问题 → 导出报告
便携模式:在可执行文件旁放置一个名为 `PORTABLE` 的文件;数据将存储在 `./data/` 中。
### CLI(所有平台)
```
pip install agentarmor
# 可选:离线本地模型扫描
pip install agentarmor[local]
# 一次性检测模型下载
agentarmor models download
```
### Docker
```
docker build -f docker/Dockerfile -t agentarmor/agentarmor .
docker run -p 8787:8787 agentarmor/agentarmor
```
## 使用示例
### 扫描 API endpoint
```
# OpenAI 兼容的 chat API(使用 DevTools 中的 POST URL,而不是 HTML 页面)
agentarmor scan --url http://localhost:8000/v1/chat/completions
# 云服务提供商
export OPENAI_API_KEY=sk-...
agentarmor scan --provider openai
# 结合云情报扩充 + 自博弈 red teaming
agentarmor scan --url https://api.example.com/v1/chat/completions \
--analysis-mode cloud \
--self-play-enabled
```
### 扫描 agents、MCP 和 RAG
```
agentarmor scan --agent crewai --agent-config agent.toml
agentarmor scan --mcp ./filesystem-mcp
agentarmor scan --rag ./corpus --embedder bge
```
### 本地模型(离线)
```
pip install agentarmor[local]
agentarmor scan --model llama-3.gguf
agentarmor scan --model ./models/qwen3
```
### 基准测试
```
# 模型排行榜
agentarmor benchmark --providers openai,anthropic,gemini --suite owasp
# 工具比较
agentarmor benchmark tools --suite owasp-llm01 --targets corpus
```
### 生态系统 (v1.2)
```
agentarmor marketplace list
agentarmor marketplace install roleplay-injection
agentarmor monitor add "Daily API" --url https://api.example.com/v1/chat/completions --cron daily
agentarmor monitor run
agentarmor dataset export -o research.jsonl --anonymize
```
### 报告和 CI 门禁
```
agentarmor scan --url http://localhost:8000/v1/chat/completions --format html,sarif,pdf -o ./reports/
agentarmor gate --sarif ./reports/findings.sarif --fail-on HIGH,CRITICAL
```
### 配置文件
```
agentarmor scan --config AgentArmor.toml
```
请参阅 [AgentArmor.toml](AgentArmor.toml) 了解 endpoint 配置、L0 攻击目标、检测模式和插件目录。
## 桌面 GUI
Tauri v2 GUI 包含:
| 屏幕 | 用途 |
|--------|---------|
| **主页** | 扫描类型选择器 + 基准测试快捷方式 |
| **Chatbot 向导** | 带有离线/云端分析的引导式 API 扫描 |
| **扫描进度** | 实时 SSE 探测流 |
| **发现问题** | 风险评分、攻击链、证据图 |
| **报告** | 导出 HTML、SARIF、PDF、CSV、JSON |
| **基准测试** | 模型排行榜 + 工具比较 |
| **市场** | 安装社区探测 |
| **监控** | 计划任务、漂移警报、数据集导出 |
| **设置** | L0、自博弈、检测、API keys |
仅适用于 GUI 开发(最终用户不需要):
```
agentarmor serve --port 8787
cd gui && npm install && npm run dev # http://localhost:1420
```
请参阅 [gui/README.md](gui/README.md) 获取 Tauri 构建说明。
## API 服务器
```
agentarmor serve --port 8787
```
| Endpoint | 描述 |
|----------|-------------|
| `GET /health` | Sidecar 状态 |
| `POST /v1/scans` | 启动扫描 |
| `GET /v1/scans/{id}` | 扫描状态 + 元数据 |
| `GET /v1/scans/{id}/events` | SSE 实时进度 |
| `GET /v1/findings` | 列出发现的问题 |
| `POST /v1/benchmarks` | 运行基准测试 |
| `GET /v1/marketplace/rules` | 列出市场包 |
| `POST /v1/monitoring/schedules` | 创建监控计划任务 |
| `POST /v1/datasets/export` | 导出研究 JSONL |
## GitHub Action (CI/CD)
```
name: AI Security Scan
on: [push, pull_request]
jobs:
agentarmor:
runs-on: ubuntu-latest
steps:
- uses: YashvantHange/AgentArmor/action@v1
with:
url: https://api.example.com/v1/chat/completions
fail-on: HIGH,CRITICAL
```
请参阅 [action/action.yml](action/action.yml)。
## 服务商 API Keys
| 服务商 | 环境变量 |
|----------|---------------------|
| OpenAI | `OPENAI_API_KEY` |
| Anthropic | `ANTHROPIC_API_KEY` |
| Gemini | `GEMINI_API_KEY` |
| Mistral | `MISTRAL_API_KEY` |
| Groq | `GROQ_API_KEY` |
| Together | `TOGETHER_API_KEY` |
| OpenRouter | `OPENROUTER_API_KEY` |
| Azure | `AZURE_API_KEY`, `AZURE_API_BASE` |
| Bedrock | `AWS_*` 凭据 |
云端增强和自博弈需要用于分析服务商的 API key(在 GUI 设置或 `AgentArmor.toml` 中配置)。
## 自定义探测
使用 SDK 编写探测并将其发布到您的本地市场:
```
agentarmor marketplace validate probes/custom_probe.py
agentarmor marketplace publish probes/custom_probe.py --id my.probe --name "My Probe"
```
请参阅 [probes/custom_probe.py](probes/custom_probe.py) 和 `agentarmor.sdk.probe_sdk`。
## macOS
目前还没有原生的 Mac `.app`(优先开发 Windows 桌面版)。请使用 PyPI + CLI 或开发版 GUI:
```
pip install agentarmor
agentarmor models download
agentarmor serve --port 8787
```
请参阅 [docs/MAC.md](docs/MAC.md)。
## 开发
```
git clone https://github.com/YashvantHange/AgentArmor.git
cd AgentArmor
pip install -e ".[dev]"
pytest
```
可选的原生 L1 引擎(需要 Rust):
```
cd native/l1_signatures && pip install maturin && maturin develop --release
```
如果没有 Rust,将自动使用 Python L1 回退方案。
Windows 安装程序构建(维护者):
```
powershell -File packaging/build-installer.ps1
```
## 许可证
请参阅仓库的许可证文件。
标签:AI安全, Chat Copilot, DLL 劫持, 可视化界面, 大语言模型, 红队评估, 请求拦截, 逆向工具