difcn2026/agentguard
GitHub: difcn2026/agentguard
AgentGuard 是一款结合静态规则与本地 LLM 审查的 Python 代码安全扫描器,致力于在降低误报的同时实现一条命令完成「扫描→审查→修复」的自动化 pipeline。
Stars: 0 | Forks: 0
# AgentGuard
**AI 驱动的代码安全扫描器。扫描 ? 审查 ? 修复,一条命令搞定。**
34 条内置规则 + Bandit 的 100+ 引擎。本地 LLM 审查减少误报。一条命令:扫描 → 审查 → 修复。
[](https://pypi.org/project/agentguard/)
[](LICENSE)
[](https://www.python.org/)
## 为什么选择 AgentGuard
SAST 工具会让你淹没在误报中,并让你手动修复所有问题。AgentGuard 则不同:
| | Bandit | Semgrep | **AgentGuard** |
|---|---|---|---|
| Python 规则 | 100+ | 多语言 | **34 + Bandit 100+** |
| 误报过滤 | ❌ | ❌ | **ML + LLM 审查** |
| 自动修复 | ❌ | ❌ | **✅ Pipeline** |
| 本地 LLM | ❌ | ❌ | **✅ DeepSeek** |
| 桌面端 GUI | ❌ | ❌ | **✅ 暗黑主题** |
| 定价 | 免费 | 免费/$40 | **免费 + Pro $29/月** |
## 快速开始
```
# 安装
pip install agentguard
# 扫描项目
agentguard scan ./my-project
# 完整 pipeline:扫描 → 审查 → 修复
agentguard pipeline ./src --bandit --ds --mode safe --write
# 用于 CI/CD 的 JSON 输出
agentguard scan ./src --format json -o report.json
# 桌面 GUI
agentguard serve
# 打开 http://127.0.0.1:1099
```
## Windows 桌面应用
从 GitHub Releases 下载最新的 AgentGuard.exe:https://github.com/difcn2026/agentguard/releases
**遇到 Windows SmartScreen 警告?** 这对于未签名的应用来说很正常。点击 **更多信息** 然后选择 **仍要运行**。该 exe 使用 PyInstaller 构建。Release 页面提供 SHA256 校验和。
## Windows 桌面应用
从 [GitHub Releases](https://github.com/difcn2026/agentguard/releases) 下载最新的 AgentGuard.exe。
## Pipeline
```
34 rules + Bandit 100+
↓
ML filter ← Hardcoded literal detection, confidence threshold
↓
DS Review ← Local LLM classifies TP/FP per finding
↓
Auto-fix ← 10 of 17 rule types, safe mode default
↓
Clean report
```
一条命令:
```
agentguard pipeline ./src --bandit --ds --mode safe
```
## 检测内容
- **代码注入**:`eval()`、`exec()`、`os.system()`、`subprocess` shell=True
- **反序列化**:`pickle.loads()`、`yaml.load()`、`marshal.loads()`
- **敏感信息**:硬编码的 API key、token、密码、私钥
- **路径遍历**:未经清理的文件路径、目录遍历
- **SSRF**:HTTP 请求中由用户控制的 URL
- **弱加密**:MD5、SHA1、ECB 模式、不安全的加密算法、弱随机数
- **XML 攻击**:外部实体注入、XPath 注入、实体爆炸
- **不安全的协议**:用于敏感数据的 HTTP、FTP、Telnet
## 版本层级
| | 免费 | Pro ($29/月) |
|---|---|---|
| 34 条内置规则 | ✅ | ✅ |
| Bandit 100+ 条规则 | ✅ | ✅ |
| ML 误报过滤器 | ✅ | ✅ |
| LLM (DS) 审查 | — | ✅ |
| Pipeline 自动修复 | — | ✅ |
| 桌面端 GUI | ✅ | ✅ |
| SARIF / JSON / MD 输出 | ✅ | ✅ |
| 每次扫描文件数 | 100 | 不限 |
## [实验室] 预览
我们正在测试一款 LLM 确认 Agent,它会审查 SAST 的发现结果,并以比纯 ML 更高的精度确认或拒绝它们。目前处于预览阶段 —— swallowed_exception 检测器在我们的测试套件中通过了 3/3(置信度 0.95+)。完整的多 Agent pipeline 将在未来的版本中推出。
```
# 启用 [Labs] 实验性功能
agentguard pipeline ./src --bandit --ds --labs
```
## 架构
```
agentguard/
├── cli.py ← CLI (scan/pipeline/fix/serve)
├── gui.py ← Desktop GUI (dark theme, port 1099)
├── desktop.py ← Web-based GUI server
├── pipeline.py ← scan → review → fix pipeline
├── scanner/
│ ├── code_scanner.py ← Pattern + AST engine (34 rules)
│ ├── bandit_adapter.py ← Bandit 100+ rules integration
│ ├── bandit_rules.py ← Bandit rule ID mapping
│ ├── ml_filter.py ← Literal detection FP filter
│ ├── llm_review.py ← DS LLM TP/FP classification
│ └── llm_heuristic.py ← Multi-agent LLM (Labs preview)
├── rules/
│ └── python_rules.py ← 34 security rules (7 categories)
├── reporter/
│ └── reporter.py ← Terminal/JSON/SARIF/Markdown
├── fixer/
│ └── code_fixer.py ← Auto-fix engine (10/17 rules)
└── docs/
├── marketing/ ← Landing copy, pricing, launch kit
├── spec/ ← Technical specs
└── eval/ ← DS evaluation reports
```
## 本地优先
所有操作都在你的机器上运行:
- **DS LLM** 位于 `127.0.0.1:57321` —— 代码永远不会离开你的网络
- **许可证服务器** 可以自托管
- **零遥测**。我们根本不知道你的存在。
## 链接
- 📦 [PyPI](https://pypi.org/project/agentguard/)
- 📖 [文档](docs/)
- 🧪 [测试套件](tests/)
MIT 许可证。由 XHLS 团队于 2026 年构建。
## 研究基础
每一个重大架构决策都有同行评审的研究作为支撑 —— 15 篇论文(且在不断增加)。不是主观意见,不是盲目猜测。
| # | 论文 | 洞察 | 影响 |
|---|-------|---------|--------|
| 1 | QASecClaw | 多 Agent LLM > 单次 prompt,F2 +23% | 5-Agent 划分 |
| 2 | SAST-Genius | LLM 生成的发现结果 → 误报激增 | 实验室成果未发布 |
| 3 | Local LLM Bug Detection | 滑动窗口 20% 重叠 | 跨函数检测 |
| 4 | LLM4PFA | 路径可行性减少 72-96% 误报 | DS 审查阶段 |
| 5 | SecureFixAgent | 自动修复需要自我验证 | 10/17 安全模式 |
| 6 | Prompt vs FT | Fine-tuning > prompt engineering | 长期 FT 路线图 |
| 7 | AdaTaint | 神经符号污染推理 | 规则自适应 |
| 8 | AgenticSCR | Agentic AI 预提交准确率提升 +153% | 实验室方向得到验证 |
| 9 | Small LM CWE | 本地 SLM 实现 ~99% CWE 准确率 | 本地优先得到验证 |
| 10 | LLMs in Vuln Analysis | LLM 覆盖完整的安全生命周期 | 架构得到验证 |
| 11 | PatchIsland | Agent 集成修复 91% 漏洞 | 多 Agent 自动修复 |
| 12 | Vul-R2 | 用于漏洞修复的推理 LLM | FT 数据集路线图 |
| 13 | The Code Whisperer | AST+CFG+PDG+LLM 对齐 | 下一代检测引擎 |
| 14 | AutoSafeCoder | SAST+Fuzzing 多 Agent | Runtime 漏洞路线图 |
| 15 | JitVul Benchmark | 879 个 CVE,ReAct > 纯 LLM | 标准化评估 |
标签:AI辅助开发, DevSecOps, DNS 反向解析, Homebrew安装, IP 地址批量处理, LNA, Python, 上游代理, 代码安全, 搜索语句(dork), 文档结构分析, 无后门, 本地大模型, 漏洞挖掘, 漏洞枚举, 逆向工具, 静态代码扫描