agent-security-scanner

AI Agent 安全扫描器 - 多语言检测 + AST 分析 + 意图识别 + LLM 验证

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "agent-security-scanner" with this command: npx skills add caidongyun/agent-security-scanner

Agent Security Scanner v4.1.0

企业级 AI Agent 安全扫描器,支持多语言检测、AST 静态分析、意图识别和 LLM 二次判定。

🎯 核心能力

能力说明状态
多语言检测Python/JavaScript/YAML/Go/Shell
AST 静态分析Python 深度语法分析
智能评分多特征加权评分系统
意图识别二层检测,识别恶意意图
LLM 验证边界样本深度分析
白名单机制降低误报率
灵顺监控持续自动化优化

📊 性能指标

指标行业平均优势
检测率 (DR)100%85-92%+8-15%
误报率 (FPR)7.77%15-25%-50-70%
扫描速度5019/s2000-3000/s+60-140%
支持语言5 种2-3 种+70%

🏗️ 三层检测架构

[一层] 白名单/黑名单 → 快速筛查
[二层] 智能评分 + 意图分析 → 边界样本判定
[三层] LLM 深度分析 → 不确定样本

🚀 快速开始

安装

# 从 npm 安装 (待发布)
npm install agent-security-scanner@4.1.0

# 从源码安装
git clone https://github.com/agent-security/scanner.git
cd scanner/release/v4.1
pip install -r requirements.txt

基本使用

# 扫描单个文件
python3 src/multi_language_scanner_v4.py /path/to/sample.py

# 批量扫描目录
python3 src/fast_batch_scan.py

# 扫描指定目录
python3 src/fast_batch_scan.py --samples /path/to/samples

# 启用 LLM 分析
export ENABLE_LLM_ANALYSIS=true
export LLM_API_KEY=your_api_key
python3 src/fast_batch_scan.py

灵顺自动化

# 启动守护进程
nohup python3 lingshun_scanner_daemon.py > logs/daemon.log 2>&1 &

# 手动触发优化
bash lingshun_optimize.sh

# 查看状态
ps aux | grep lingshun_scanner_daemon

📁 目录结构

agent-security-scanner/
├── src/
│   ├── multi_language_scanner_v4.py  # 主扫描器
│   ├── fast_batch_scan.py            # 批量扫描入口
│   ├── intent_detector_v2.py         # 意图分析器
│   ├── llm_analyzer.py               # LLM 分析器
│   └── benchmark_full_scan.py        # 性能测试
├── config/
│   └── quality_gate.yaml             # 质量门禁配置
├── docs/
│   ├── USER_GUIDE.md                 # 用户指南
│   └── DELIVERY_REPORT.md            # 交付报告
├── examples/                         # 示例代码
├── tests/                            # 测试用例
├── lingshun_optimize.sh              # 灵顺优化脚本
├── lingshun_scanner_daemon.py        # 灵顺监控守护进程
├── package.json                      # npm 包配置
├── SKILL.md                          # 技能规范
├── requirements.txt                  # 依赖列表
└── LICENSE                           # 许可证

🔧 配置说明

环境变量

# LLM 分析配置
export ENABLE_LLM_ANALYSIS=true
export LLM_API_KEY=your_api_key
export LLM_API_URL=https://api.example.com/v1/chat

# 灵顺监控配置
export FEISHU_WEBHOOK=your_webhook_url
export ALERT_EMAIL=your@email.com

质量门禁

# config/quality_gate.yaml
metrics:
  detection_rate:
    min: 99.0
  false_positive_rate:
    max: 10.0
  throughput:
    min: 4000

📈 检测能力

支持攻击类型

攻击类型检测率说明
tool_poisoning100%工具投毒
data_exfiltration100%数据外泄
credential_theft100%凭证窃取
evasion100%绕过检测
persistence100%持久化
supply_chain_attack100%供应链攻击
resource_exhaustion100%资源耗尽
remote_load100%远程加载
prompt_injection100%提示注入
memory_pollution100%记忆污染

支持编程语言

语言检测方式覆盖率
PythonAST + 规则 + 智能评分100%
JavaScriptJS Analyzer + 智能评分100%
YAML规则检测 + 智能评分100%
Go规则检测 + 智能评分100%
Shell规则检测 + 智能评分100%

🛡️ 安全特性

白名单机制

# 仅包含明确可信的良性标识
whitelist_patterns = [
    '# BEN-NOR-',      # 正常样本
    '# BEN-COP-',      # 常见模式
    '# BEN-EVA-',      # Evasion 测试
    'print("Hello")',  # Hello World
]

三层检测

  1. 快速筛查: 白名单/黑名单匹配
  2. 智能评分 + 意图分析: 边界样本 (risk 15-35)
  3. LLM 验证: 意图不明确样本

🤖 灵顺自动化

# 启动守护进程
nohup python3 lingshun_scanner_daemon.py > logs/daemon.log 2>&1 &

# 手动触发优化
bash lingshun_optimize.sh

# 任务编排
bash lingshun_task_orchestration.sh

📋 API 参考

扫描器接口

from multi_language_scanner_v4 import MultiLanguageScanner

scanner = MultiLanguageScanner()
result = scanner.scan_file('/path/to/sample.py')

print(f"is_malicious: {result.is_malicious}")
print(f"risk_score: {result.risk_score}")
print(f"risk_level: {result.risk_level}")
print(f"behaviors: {result.behaviors}")

意图分析接口

from intent_detector_v2 import EnhancedIntentDetector

detector = EnhancedIntentDetector()
result = detector.analyze(code, 'sample.py')

print(f"intent: {result.intent}")
print(f"confidence: {result.confidence}")

LLM 分析接口

from llm_analyzer import LLMAnalyzer

analyzer = LLMAnalyzer()
result = analyzer.analyze(code, {
    'risk_score': 25,
    'behaviors': ['subprocess', 'base64']
})

print(f"is_malicious: {result.is_malicious}")

🧪 测试

# 运行测试
python3 -m pytest tests/

# 性能基准测试
python3 src/benchmark_full_scan.py

# 质量门禁验证
python3 -c "from src.multi_language_scanner_v4 import MultiLanguageScanner; print('✅ OK')"

📝 更新日志

v4.1.0 (2026-04-04)

  • ✅ 三层检测架构 (白名单 + 智能评分 + 意图 + LLM)
  • ✅ 回退到安全配置 (FPR 7.77%)
  • ✅ 灵顺 V5 自动化监控
  • ✅ 完整文档和示例
  • ✅ 30 个测试样本 (AST/意图/LLM)

v4.0.0 (2026-04-03)

  • ✅ 多语言融合检测
  • ✅ AST 静态分析集成
  • ✅ 白名单/黑名单机制

🤝 贡献

# Fork 仓库
git fork https://github.com/agent-security/scanner.git

# 创建分支
git checkout -b feature/your-feature

# 提交更改
git commit -m "feat: add your feature"

# 推送并创建 PR
git push origin feature/your-feature

📄 许可证

MIT License - 详见 LICENSE

📞 联系方式


版本: 4.1.0
发布日期: 2026-04-04
状态: ✅ 生产就绪
Benchmark: DR 100% | FPR 7.77% | Speed 5019/s

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Security

Component Library Audit

Audit React, Vue, or Svelte component libraries — find unused components, inconsistent props, missing documentation, accessibility issues, missing tests, and...

Registry SourceRecently Updated
Security

Repository Health Score

Score a repository's health across 8 dimensions — code quality, testing, documentation, CI/CD, security, dependencies, community, and maintainability. Produc...

Registry SourceRecently Updated
270Profile unavailable
Security

个人数字安全体检

检查邮箱泄露和密码强度,生成安全评分报告。

Registry SourceRecently Updated
1760Profile unavailable
Security

agent-bom registry

MCP server security registry and trust assessment — look up servers in the 427+ server security metadata registry, run pre-install marketplace checks, batch...

Registry SourceRecently Updated
7180Profile unavailable