How 2runbe/pentestgpt works
PentestGPT is an autonomous penetration-testing and CTF agent. The primary workflow starts with a target and optional challenge context, runs an agent through the controller/backend, persists session progress and results, and presents activity and findings through the CLI or TUI. The graph also preserves the archived multi-provider implementation and documented telemetry capability. Edges are limited to relationships visible in excerpts, the source index, or README; unsampled subsystems are represented without speculative wiring.
Main entry points: pentest_gpt.py Legacy Orchestrator · tui.py Interactive TUI · controller.py Agent Controller · agent.py Pentest Agent
Components 29
Entry and Interface
- CLI Entry
pentestgpt/interface/main.py - Interactive TUI
pentestgpt/interface/tui.py - Activity Feed
pentestgpt/interface/components/activity_feed.py - Startup Screen
pentestgpt/interface/components/splash.py
Agent Runtime
- Agent Controller
pentestgpt/core/controller.py - Pentest Agent
pentestgpt/core/agent.py - Agent Backend
pentestgpt/core/backend.py - Runtime Config
pentestgpt/core/config.py - Tool Registry
pentestgpt/tools/registry.py - Tool Base
pentestgpt/tools/base.py
Sessions and Events
- Session Store
pentestgpt/core/session.py - Event Bus
pentestgpt/core/events.py
Prompts and Telemetry
- Agent Tracer
pentestgpt/core/tracer.py - Langfuse Telemetry
pentestgpt/core/langfuse.py - Pentesting Prompt
pentestgpt/prompts/pentesting.py
Archived Multi-LLM
- Legacy CLI
legacy/pentestgpt/main.py - Legacy Orchestrator
legacy/pentestgpt/utils/pentest_gpt.py - Legacy Chat Config
legacy/pentestgpt/config/chat_config.py - Legacy Prompts
legacy/pentestgpt/prompts/prompt_class.py - Legacy LLM API
legacy/pentestgpt/utils/llm_api.py - Provider Adapters
legacy/pentestgpt/utils/APIs/module_import.py - ChatGPT Client
legacy/pentestgpt/utils/chatgpt.py - Task Handling
legacy/pentestgpt/utils/task_handler.py - Web Parsing
legacy/pentestgpt/utils/web_parser.py - Search Utility
legacy/pentestgpt/utils/search.py - Model Interface
legacy/pentestgpt/llm_generation/models/base.py - Conversation History
legacy/pentestgpt/llm_generation/conversation_manager.py
Other components
- Operator
- Langfuse Service
Connections 25
- Operator → CLI Entry: starts
- CLI Entry → Interactive TUI: launches
pentestgpt/interface/main.py - Interactive TUI → Agent Controller: starts agent
pentestgpt/interface/tui.py - Interactive TUI → Event Bus: subscribes
pentestgpt/interface/tui.py - Interactive TUI → Activity Feed: updates
pentestgpt/interface/tui.py - Interactive TUI → Startup Screen: renders
pentestgpt/interface/tui.py - Agent Controller → Pentest Agent: runs
pentestgpt/core/controller.py - Agent Controller → Agent Backend: queries
pentestgpt/core/controller.py - Agent Controller → Session Store: persists
pentestgpt/core/controller.py - Agent Controller → Event Bus: subscribes
pentestgpt/core/controller.py - Pentest Agent → Runtime Config: uses
pentestgpt/core/agent.py - Pentest Agent → Agent Tracer: tracks
pentestgpt/core/agent.py - Pentest Agent → Pentesting Prompt: uses
pentestgpt/core/agent.py - Langfuse Telemetry → Event Bus: observes
pentestgpt/core/langfuse.py - Langfuse Telemetry → Langfuse Service: sends telemetry
- Legacy CLI → Legacy Orchestrator: invokes
legacy/pentestgpt/main.py - Legacy Orchestrator → Legacy Chat Config: loads
legacy/pentestgpt/utils/pentest_gpt.py - Legacy Orchestrator → Legacy Prompts: uses
legacy/pentestgpt/utils/pentest_gpt.py - Legacy Orchestrator → Provider Adapters: loads providers
legacy/pentestgpt/utils/pentest_gpt.py - Legacy Orchestrator → ChatGPT Client: uses
legacy/pentestgpt/utils/pentest_gpt.py - Legacy Orchestrator → Task Handling: uses
legacy/pentestgpt/utils/pentest_gpt.py - Legacy Orchestrator → Web Parsing: uses
legacy/pentestgpt/utils/pentest_gpt.py - Legacy LLM API → Legacy Chat Config: reads config
legacy/pentestgpt/utils/llm_api.py - Legacy CLI → Legacy Orchestrator: starts testing
legacy/pentestgpt/main.py - Model Interface → Conversation History: supports history