vxcontrol/pentagi
摘要
PentAGI是一款开源AI驱动的渗透测试工具,在沙盒化的Docker环境中运行,具有自主代理、集成专业安全工具、智能记忆和知识图谱功能。
查看缓存全文
缓存时间: 2026/07/09 13:36
vxcontrol/pentagi 源码地址:https://github.com/vxcontrol/pentagi
PentAGI 渗透测试通用人工智能
加入社区! 与安全研究人员、人工智能爱好者和道德黑客同行交流。获取支持、分享见解,并了解 PentAGI 的最新进展。 Discord (https://discord.gg/2xrMh7qX6m)⠀Telegram (https://t.me/+Ka9i6CNwe71hMWQy)
目录
- 概述
- 特性
- 架构
- 智能体监控
- 快速开始
- 登录后如何使用 PentAGI
- API 访问
- LLM 提供商配置
- Ollama
- OpenAI
- Anthropic
- Google AI (Gemini)
- AWS Bedrock
- DeepSeek
- GLM
- Kimi
- Qwen
- 高级设置
- Langfuse 集成
- 监控与可观测性
- 知识图谱 (Graphiti)
- OAuth 集成
- Docker 镜像配置
- 开发
- 测试 LLM 智能体
- 嵌入配置与测试
- 使用 ftester 进行功能测试
- 构建
- 鸣谢
- 许可证
概述
PentAGI 是一款创新型的自动化安全测试工具,利用最前沿的人工智能技术。该项目专为信息安全专业人员、研究人员和爱好者设计,为他们提供强大且灵活的渗透测试解决方案。
您可以观看视频 PentAGI 概述:PentAGI 概述视频 (https://youtu.be/R70x5Ddzs1o)
特性
- 安全且隔离。所有操作均在沙盒 Docker 环境中执行,实现完全隔离。
- 完全自主。由 AI 驱动的智能体自动确定并执行渗透测试步骤,并支持可选的执行监控和智能任务规划,提高可靠性。
- 专业渗透测试工具。内置超过 20 种专业安全工具,包括 nmap、metasploit、sqlmap 等。
- 智能记忆系统。长期存储研究成果和成功方法,供未来使用。
- 知识图谱集成。基于 Graphiti 的知识图谱,使用 Neo4j 进行语义关系跟踪和高级上下文理解。
- 网络情报。通过 scraper (https://hub.docker.com/r/vxcontrol/scraper) 内置浏览器,从网络来源收集最新信息。
- 外部搜索系统。集成高级搜索 API,包括 Tavily (https://tavily.com)、Traversaal (https://traversaal.ai)、Perplexity (https://www.perplexity.ai)、DuckDuckGo (https://duckduckgo.com/)、Google Custom Search (https://programmablesearchengine.google.com/)、Sploitus Search (https://sploitus.com) 和 Searxng (https://searxng.org),实现全面信息收集。
- 专家团队。委托系统配备专门的 AI 智能体,分别负责研究、开发和基础设施任务,并支持可选的执行监控和智能任务规划,以较小的模型获得最佳性能。
- 全面监控。详细的日志记录以及与 Grafana/Prometheus 的集成,实现系统实时观察。
- 详细报告。生成全面的漏洞报告,附带利用指南。
- 智能容器管理。根据具体任务需求自动选择 Docker 镜像。
- 现代化界面。简洁直观的 Web UI,用于系统管理和监控。
- 全面的 API。功能完备的 REST 和 GraphQL API,支持 Bearer token 认证,便于自动化和集成。
- 持久化存储。所有命令和输出均存储在带有 pgvector (https://hub.docker.com/r/vxcontrol/pgvector) 扩展的 PostgreSQL 中。
- 可扩展架构。基于微服务的设计,支持水平扩展。
- 自托管解决方案。完全掌控您的部署和数据。
- 灵活的认证。支持超过 10 种 LLM 提供商(OpenAI (https://platform.openai.com/)、Anthropic (https://www.anthropic.com/)、Google AI/Gemini (https://ai.google.dev/)、AWS Bedrock (https://aws.amazon.com/bedrock/)、Ollama (https://ollama.com/)、DeepSeek (https://www.deepseek.com/en/)、GLM (https://z.ai/)、Kimi (https://platform.moonshot.ai/)、Qwen (https://www.alibabacloud.com/en/)、自定义)以及聚合器(OpenRouter (https://openrouter.ai/)、DeepInfra (https://deepinfra.com/))。对于本地生产部署,请参阅我们的 vLLM + Qwen3.5-27B-FP8 指南。
- API Token 认证。安全的 Bearer token 系统,用于对 REST 和 GraphQL API 进行编程访问。
- 快速部署。通过 Docker Compose (https://docs.docker.com/compose/) 轻松设置,配备全面的环境配置。
当前能力边界
- PentAGI 目前是一个自主且由助手引导的渗透测试平台,并非 CALDERA 式的攻防模拟 (BAS) 或具有预定义活动计划或攻击计划的对手模拟产品。
- 类似 BAS 的智能体撰写的攻击脚本应视为概念或未来工作,而非当前已实现的功能。
- 当前流程报告 UI 支持 Web 视图、复制到剪贴板、Markdown 下载和 PDF 下载。JSON 格式的流程报告导出目前不是文档支持的输出格式。
- 提供商灵活性目前通过内置提供商和自定义/OpenAI 兼容端点实现。请参阅自定义 LLM 提供商配置和 vLLM + Qwen3.5-27B-FP8 指南。
架构
系统上下文
flowchart TB
classDef person fill:#08427B,stroke:#073B6F,color:#fff
classDef system fill:#1168BD,stroke:#0B4884,color:#fff
classDef external fill:#666666,stroke:#0B4884,color:#fff
pentester["👤 Security Engineer (User of the system)"]
pentagi["✨ PentAGI (Autonomous penetration testing system)"]
target["🎯 target-system (System under test)"]
llm["🧠 llm-provider (OpenAI/Anthropic/Ollama/Bedrock/Gemini/Custom)"]
search["🔍 search-systems (Google/DuckDuckGo/Tavily/Traversaal/Perplexity/Sploitus/Searxng)"]
langfuse["📊 langfuse-ui (LLM Observability Dashboard)"]
grafana["📈 grafana (System Monitoring Dashboard)"]
pentester --> |Uses HTTPS| pentagi
pentester --> |Monitors AI HTTPS| langfuse
pentester --> |Monitors System HTTPS| grafana
pentagi --> |Tests Various protocols| target
pentagi --> |Queries HTTPS| llm
pentagi --> |Searches HTTPS| search
pentagi --> |Reports HTTPS| langfuse
pentagi --> |Reports HTTPS| grafana
class pentester person
class pentagi system
class target,llm,search,langfuse,grafana external
linkStyle default stroke:#ffffff,color:#ffffff
容器架构(点击展开)
graph TB
subgraph Core Services
UI[Frontend UI<br/>React + TypeScript]
API[Backend API<br/>Go + GraphQL]
DB[(Vector Store<br/>PostgreSQL + pgvector)]
MQ[Task Queue<br/>Async Processing]
Agent[AI Agents<br/>Multi-Agent System]
end
subgraph Knowledge Graph
Graphiti[Graphiti<br/>Knowledge Graph API]
Neo4j[(Neo4j<br/>Graph Database)]
end
subgraph Monitoring
Grafana[Grafana<br/>Dashboards]
VictoriaMetrics[VictoriaMetrics<br/>Time-series DB]
Jaeger[Jaeger<br/>Distributed Tracing]
Loki[Loki<br/>Log Aggregation]
OTEL[OpenTelemetry<br/>Data Collection]
end
subgraph Analytics
Langfuse[Langfuse<br/>LLM Analytics]
ClickHouse[ClickHouse<br/>Analytics DB]
Redis[Redis<br/>Cache + Rate Limiter]
MinIO[MinIO<br/>S3 Storage]
end
subgraph Security Tools
Scraper[Web Scraper<br/>Isolated Browser]
PenTest[Security Tools<br/>20+ Pro Tools<br/>Sandboxed Execution]
end
UI --> |HTTP/WS| API
API --> |SQL| DB
API --> |Events| MQ
MQ --> |Tasks| Agent
Agent --> |Commands| PenTest
Agent --> |Queries| DB
Agent --> |Knowledge| Graphiti
Graphiti --> |Graph| Neo4j
API --> |Telemetry| OTEL
OTEL --> |Metrics| VictoriaMetrics
OTEL --> |Traces| Jaeger
OTEL --> |Logs| Loki
Grafana --> |Query| VictoriaMetrics
Grafana --> |Query| Jaeger
Grafana --> |Query| Loki
API --> |Analytics| Langfuse
Langfuse --> |Store| ClickHouse
Langfuse --> |Cache| Redis
Langfuse --> |Files| MinIO
classDef core fill:#f9f,stroke:#333,stroke-width:2px,color:#000
classDef knowledge fill:#ffa,stroke:#333,stroke-width:2px,color:#000
classDef monitoring fill:#bbf,stroke:#333,stroke-width:2px,color:#000
classDef analytics fill:#bfb,stroke:#333,stroke-width:2px,color:#000
classDef tools fill:#fbb,stroke:#333,stroke-width:2px,color:#000
class UI,API,DB,MQ,Agent core
class Graphiti,Neo4j knowledge
class Grafana,VictoriaMetrics,Jaeger,Loki,OTEL monitoring
class Langfuse,ClickHouse,Redis,MinIO analytics
class Scraper,PenTest tools
实体关系(点击展开)
erDiagram
Flow ||--o{ Task : contains
Task ||--o{ SubTask : contains
SubTask ||--o{ Action : contains
Action ||--o{ Artifact : produces
Action ||--o{ Memory : stores
Flow {
string id PK
string name "Flow name"
string description "Flow description"
string status "active/completed/failed"
json parameters "Flow parameters"
timestamp created_at
timestamp updated_at
}
Task {
string id PK
string flow_id FK
string name "Task name"
string description "Task description"
string status "pending/running/done/failed"
json result "Task results"
timestamp created_at
timestamp updated_at
}
SubTask {
string id PK
string task_id FK
string name "Subtask name"
string description "Subtask description"
string status "queued/running/completed/failed"
string agent_type "researcher/developer/executor"
json context "Agent context"
timestamp created_at
timestamp updated_at
}
Action {
string id PK
string subtask_id FK
string type "command/search/analyze/etc"
string status "success/failure"
json parameters "Action parameters"
json result "Action results"
timestamp created_at
}
Artifact {
string id PK
string action_id FK
string type "file/report/log"
string path "Storage path"
json metadata "Additional info"
timestamp created_at
}
Memory {
string id PK
string action_id FK
string type "observation/conclusion"
vector embedding "Vector representation"
text content "Memory content"
timestamp created_at
}
智能体交互(点击展开)
sequenceDiagram
participant O as Orchestrator
participant R as Researcher
participant D as Developer
participant E as Executor
participant VS as Vector Store
participant KB as Knowledge Base
Note over O,KB: Flow Initialization
O->>VS: Query similar tasks
VS-->>O: Return experiences
O->>KB: Load relevant knowledge
KB-->>O: Return context
Note over O,R: Research Phase
O->>R: Analyze target
R->>VS: Search similar cases
VS-->>R: Return patterns
R->>KB: Query vulnerabilities
KB-->>R: Return known issues
R->>VS: Store findings
R-->>O: Research results
Note over O,D: Planning Phase
O->>D: Plan attack
D->>VS: Query exploits
VS-->>D: Return techniques
D->>KB: Load tools info
KB-->>D: Return capabilities
D-->>O: Attack plan
Note over O,E: Execution Phase
O->>E: Execute plan
E->>KB: Load tool guides
KB-->>E: Return procedures
E->>VS: Store results
E-->>O: Execution status
记忆系统(点击展开)
graph TB
subgraph "Long-term Memory"
VS[(Vector Store<br/>Embeddings DB)]
KB[Knowledge Base<br/>Domain Expertise]
Tools[Tools Knowledge<br/>Usage Patterns]
end
subgraph "Working Memory"
Context[Current Context<br/>Task State]
Goals[Active Goals<br/>Objectives]
State[System State<br/>Resources]
end
subgraph "Episodic Memory"
Actions[Past Actions<br/>Commands History]
Results[Action Results<br/>Outcomes]
Patterns[Success Patterns<br/>Best Practices]
end
Context --> |Query| VS
VS --> |Retrieve| Context
Goals --> |Consult| KB
KB --> |Guide| Goals
State --> |Record| Actions
Actions --> |Learn| Patterns
Patterns --> |Store| VS
Tools --> |Inform| State
Results --> |Update| Tools
VS --> |Enhance| KB
KB --> |Index| VS
classDef ltm fill:#f9f,stroke:#333,stroke-width:2px,color:#000
classDef wm fill:#bbf,stroke:#333,stroke-width:2px,color:#000
classDef em fill:#bfb,stroke:#333,stroke-width:2px,color:#000
class VS,KB,Tools ltm
class Context,Goals,State wm
class Actions,Results,Patterns em
链式摘要(点击展开)
链式摘要系统通过选择性总结较早的消息来管理对话上下文的增长。这对于防止超出令牌限制同时保持对话连贯性至关重要。
flowchart TD
A[Input Chain] --> B{Needs Summarization?}
B -->|No| C[Return Original Chain]
B -->|Yes| D[Convert to ChainAST]
D --> E[Apply Section Summarization]
E --> F[Process Oversized Pairs]
F --> G[Manage Last Section Size]
G --> H[Apply QA Summarization]
H --> I[Rebuild Chain with Summaries]
I --> J{Is New Chain Smaller?}
J -->|Yes| K[Return Optimized Chain]
J -->|No| C
classDef process fill:#bbf,stroke:#333,stroke-width:2px,color:#000
classDef decision fill:#bfb,stroke:#333,stroke-width:2px,color:#000
classDef output fill:#fbb,stroke:#333,stroke-width:2px,color:#000
class A,D,E,F,G,H,I process
class B,J decision
class C,K output
该算法在对话链的结构化表示(ChainAST)上运行,该表示保留了消息类型,包括工具调用及其响应。所有摘要操作在减小上下文大小的同时,保持关键的对话流。
全局摘要器配置选项
| 参数 | 环境变量 | 默认值 | 描述 |
|---|---|---|---|
| 保留最后部分 | SUMMARIZER_PRESERVE_LAST | true | 是否完整保留最后部分的所有消息 |
| 使用问答对 | SUMMARIZER_USE_QA | true | 是否使用问答对摘要策略 |
| 在问答中总结人类消息 | SUMMARIZER_SUM_MSG_HUMAN_IN_QA | false | 是否在问答对中总结人类消息 |
| 最后部分大小 | SUMMARIZER_LAST_SEC_BYTES | 51200 | 最后部分的最大字节大小(50KB) |
| 最大主体对大小 | SUMMARIZER_MAX_BP_BYTES | 16384 | 单个主体对的最大字节大小(16KB) |
| 最大问答部分数 | SUMMARIZER_MAX_QA_SECTIONS | 10 | 要保留的最大问答对部分数 |
| 最大问答大小 | SUMMARIZER_MAX_QA_BYTES | 65536 | 问答对部分的最大字节大小(64KB) |
| 保留问答部分数 | SUMMARIZER_KEEP_QA_SECTIONS | 1 | 保留的最近问答部分数量,不进行摘要 |
助手摘要器配置选项
助手实例可以使用自定义的摘要设置来微调上下文管理行为:
| 参数 | 环境变量 | 默认值 | 描述 |
|---|---|---|---|
| 保留最后部分 | ASSISTANT_SUMMARIZER_PRESERVE_LAST | true | 是否保留助手最后部分的所有消息 |
| 最后部分大小 | ASSISTANT_SUMMARIZER_LAST_SEC_BYTES | 76800 | 助手最后部分的最大字节大小(75KB) |
| 最大主体对大小 | ASSISTANT_SUMMARIZER_MAX_BP_BYTES | 16384 | 助手上下文中单个主体对的最大字节大小(16KB) |
| 最大问答部分数 | ASSISTANT_SUMMARIZER_MAX_QA_SECTIONS | 7 | 助手上下文中要保留的最大问答部分数 |
| 最大问答大小 | ASSISTANT_SUMMARIZER_MAX_QA_BYTES | 76800 | 助手问答部分的最大字节大小(75KB) |
| 保留问答部分数 | ASSISTANT_SUMMARIZER_KEEP_QA_SECTIONS | 3 | 助手上下文中保留的最近问答部分数量,不进行摘要 |
助手摘要器配置提供了比全局摘要器更多的内存用于上下文保留。
相似文章
从受控到真实世界:面向实际环境的渗透测试智能体评估
本文提出了一种实用的评估协议,用于在现实复杂目标(而非简化基准)中评估AI渗透测试智能体。它采用基于LLM的语义匹配、二分图解析和持续真值来对发现的漏洞进行评分,并发布了专家标注的真值数据和代码。
@DanKornas:安全测试代理通常缺乏安全特定的工作流程、可靠的证据收集和可审计性。Pentest…
PentesterFlow 是一款开源的终端助手,面向经授权的进攻性安全工作,可针对限定范围的目标进行规划,使用渗透测试工具,对敏感操作请求审批,跨会话保留经验教训,并撰写有证据支持的安全发现。它内置了侦察和 Web 漏洞技能、会话连续性功能、本地持续学习以及 Burp 集成。
Astra Autonomous Pentest
Astra Security 推出一款自主渗透测试产品,利用AI代理自动发现、验证并修复漏洞。
@XAMTO_AI: 用过传统手动渗透测试的都懂!! 工具开一堆,Burp、Nmap、Metasploit来回切,recon半天exploit半天,PoC还得自己手写,报告写到怀疑人生,假阳性满天飞,真实漏洞反而漏掉…… 有位开发者实在看不下去了,直接开源了一…
Strix is an open-source AI penetration testing tool that uses autonomous AI agents to perform real vulnerability discovery and exploitation, generating working PoCs and compliance-ready reports. It supports multi-agent orchestration, CI/CD integration, and various LLMs, aiming to replace manual pentesting with AI-driven automation.
@hetmehtaa: 本地AI用于渗透测试与研究 https://projectblack.io/blog/local-ai-for-cyber-security/…
一篇博客文章对四种方法(Semgrep、搭载Strix的GLM 5.1、具备代码审查技能的云端SOTA、以及使用自定义工具的本地AI)在PHPIPAM中发现已知LFI漏洞的表现进行了基准测试,结果显示采用定制化方案的本地AI工具优于其他方法。