GreyDGL/PentestGPT

Automated Penetration Testing Agentic Framework Powered by Large Language Models

PentestGPT – AI‑Powered Autonomous Penetration‑Testing Agent

What it is – PentestGPT is a Python‑based command‑line tool that orchestrates large language models (LLMs) to perform automated penetration‑testing or capture‑the‑flag (CTF) challenges. It was introduced in a USENIX Security 2024 paper and is released under the MIT license.

Key capabilities

  • Multi‑stage pipeline – The agent runs a fixed sequence of stages (recon → exploit → walkthrough for CTF, or asset discovery → vulnerability identification → report for real‑world pentests), passing the output of each stage to the next.
  • Autonomous mode – Uses Claude Code or Codex back‑ends to run tools and make decisions without human input.
  • Legacy interactive modepentestgpt-legacy runs three cooperating LLM sessions (reasoning, generation, parsing) and lets a user steer the process (next, more, todo, …). It supports many providers (OpenAI, Anthropic, Gemini, DeepSeek, xAI, Qwen, Moonshot, Ollama).
  • Session persistence – Test runs can be saved and resumed later.
  • Live walkthrough & telemetry – Real‑time console updates show what the agent is doing; optional anonymous telemetry is sent to a Langfuse endpoint.

Installation

# Clone and install dependencies (requires Python 3.12+ and uv)
git clone https://github.com/GreyDGL/PentestGPT.git
cd PentestGPT
make install          # runs `uv sync`

Docker – a pre‑built image bundles the tool plus the Claude Code and Codex CLIs. Use the provided make docker-* targets to build, log in to the model providers once, and run the agent inside the container.

Quick usage

# Default CTF mode
pentestgpt --target 10.10.11.234

# Specify a focus
pentestgpt --target 10.10.11.50 \
          --instruction "WordPress site, focus on plugin vulnerabilities"

# Full pentest workflow (asset discovery → vuln → report)
pentestgpt --target 10.10.11.234 --mode pentest

# List saved sessions
pentestgpt --list-sessions

For the interactive legacy mode:

pentestgpt-legacy                     # auto‑pick best models
pentestgpt-legacy --reasoning-model claude-opus-4-8 --parsing-model gemini-3.5-flash
pentestgpt-legacy --list-models       # shows every configured provider/model

Environment variables such as OPENAI_API_KEY, ANTHROPIC_API_KEY, etc., enable the corresponding providers.

Benchmark – In the authors’ December 2025 evaluation on the XBOW suite, PentestGPT solved 90 of 104 challenges (≈86.5 % success). The benchmark code lives outside the repository.

License & disclaimer – MIT‑licensed, intended for educational and authorized security testing only.


For more details, see the official website, the USENIX paper, and the repository’s README and docs/ folder.

Related

  • Project
  • Project
  • Project
  • Project
  • Project