PentestGPT is a free, open source threat detection & response project written in Python and released under MIT. It has 15,521 GitHub stars, 2,700 forks and 81 open issues, and was last pushed 2 months ago. On this registry it ranks #5 of 15 tracked projects in Threat Detection & Response, with 5 head-to-head comparisons available.

What is PentestGPT?

PentestGPT is an MIT-licensed Python framework that uses large language models to run automated penetration tests and CTF challenges, aimed at penetration testers, security engineers and CTF players who want an agent to drive the tooling rather than working through it by hand.

What it is

PentestGPT is an agentic penetration-testing framework written in Python and released under the MIT licence. The v1.0 release is the agentic upgrade: an autonomous agent drives Claude Code or Codex to run tools and reason without human intervention, working through a multi-stage pipeline where each stage feeds its findings into the next. The project was published at USENIX Security 2024, keeps an official website at pentestgpt.com, and lives in the Python and large-language-model ecosystem that surrounds the Claude Code and Codex CLIs. It carries 15,521 stars, 2,700 forks and 81 open issues.

The concrete problem it solves is the repetitive, sequential labour of a manual engagement. In CTF use the pipeline runs recon, then exploit, then walkthrough. In penetration-testing use it runs asset discovery, then vulnerability identification, then reporting. Instead of an analyst driving scanners and exploits tool by tool and carrying the findings between them by hand, the agent sequences the stages itself and passes the output forward. Session persistence means a long engagement can be saved and resumed rather than restarted. What it replaces, in short, is the operator who manually chains reconnaissance, exploitation and write-up.

Key capabilities

  • An autonomous agent that drives Claude Code or Codex to run tools and reason without human intervention.
  • A multi-stage pipeline: recon, exploit and walkthrough for CTF work; asset discovery, vulnerability identification and report for pentests.
  • A command-line interface with pentestgpt --target 10.10.11.234, --instruction "WordPress site, focus on plugin vulnerabilities", --mode pentest and --list-sessions.
  • Session persistence, so penetration-testing sessions can be saved and resumed.
  • A modernized legacy interactive mode, pentestgpt-legacy, supporting OpenAI, Anthropic, Google Gemini, DeepSeek, xAI, Qwen, Moonshot and local Ollama.
  • Multi-category support covering Web, Crypto, Reversing, Forensics, PWN and Privilege Escalation.
  • A live walkthrough with real-time activity updates from an extensible, modular architecture.

Who uses it and how

  • CTF players point it at a challenge host with pentestgpt --target 10.10.11.234, using --instruction to supply context such as a WordPress site and a focus on plugin vulnerabilities.
  • Penetration-testing teams run --mode pentest to move from asset discovery through vulnerability identification to a report in one pass.
  • Teams that want the CLIs pre-bundled use the Docker flow: make docker-login is a one-time, idempotent step that checks logins and authenticates only what is missing, and sessions persist in named volumes so later runs require no re-login.
  • Backend and model are chosen per run, as in make docker-run TARGET=10.10.11.234 BACKEND=claude MODEL=opus MODE=pentest or BACKEND=codex MODEL=gpt-5.5 MODE=ctf.
  • Contributors extend the modular design; the repository shows 2,700 forks and 81 open issues, and make test and make check cover tests, lint and typecheck.

Getting started

Clone the repository and run make install, which runs uv sync, on Python 3.12 or later with uv available and either the Claude Code CLI (claude) or the Codex CLI (codex) installed and authenticated. Alternatively, build and run the self-contained Docker image with make docker-build and a one-time make docker-login, which bundles both CLIs.

How it compares

The facts provide no list of paid products that PentestGPT replaces, and they name no directly comparable tool. It stands alone in this registry.

When to use it — and when not to

A self-hoster must operate Python 3.12 or later with uv, plus an authenticated Claude Code or Codex CLI; the Docker path bundles both CLIs and keeps sessions in named volumes, which reduces re-authentication but adds a container to manage. It is a poor fit for anyone who wants a conventional scanner with no LLM dependency, because the autonomous pipeline is tied to those two CLI backends and only the legacy interactive mode covers the wider provider set. The repository is actively maintained, with the last push on 2026-07-14, so the main limitation is that backend coupling rather than staleness.

project readme (upstream, from github) — read inline

[![Contributors][contributors-shield]][contributors-url] [![Forks][forks-shield]][forks-url] [![Stargazers][stars-shield]][stars-url] [![Issues][issues-shield]][issues-url] [![MIT License][license-shield]][license-url] [![Discord][discord-shield]][discord-url]


PentestGPT

AI-Powered Autonomous Penetration Testing Agent
Published at USENIX Security 2024

Official Website: pentestgpt.com »

Research Paper · Report Bug · Request Feature

GreyDGL%2FPentestGPT | Trendshift


Demo

Installation

Installation Demo

Watch on YouTube

PentestGPT in Action

PentestGPT Demo

Watch on YouTube


What's New in v1.0 (Agentic Upgrade)

  • Multi-Stage Pipeline - The agent works through staged phases (recon → exploit → walkthrough for CTF; asset discovery → vulnerability identification → report for pentests), feeding each stage's findings into the next.
  • Autonomous Agent - Drives Claude Code or Codex to run tools and reason without human intervention.
  • Session Persistence - Save and resume penetration testing sessions.

The autonomous CTF pipeline is backend-pluggable for Claude Code and Codex. The interactive modernized legacy mode (pentestgpt-legacy) supports a wider provider set: OpenAI, Anthropic, Google Gemini, DeepSeek, xAI, Qwen, Moonshot, and local Ollama. See Interactive Multi-LLM Mode.


Features

  • AI-Powered Challenge Solver - Leverages LLM advanced reasoning to perform penetration testing and CTFs
  • Live Walkthrough - Tracks steps in real-time as the agent works through challenges
  • Multi-Category Support - Web, Crypto, Reversing, Forensics, PWN, Privilege Escalation
  • Real-Time Feedback - Watch the AI work with live activity updates
  • Extensible Architecture - Clean, modular design ready for future enhancements

Quick Start

Prerequisites

  • Python 3.12+
  • uv - Python package manager
  • Claude Code CLI (claude) - installed and authenticated for local Claude runs. See Claude Code docs
  • Codex CLI (codex) - installed and authenticated for local Codex runs. The Docker flow below bundles both CLIs.

Installation

git clone https://github.com/GreyDGL/PentestGPT.git
cd PentestGPT
make install    # runs uv sync

Commands Reference

Command Description
make install Install dependencies
make test Run all tests
make check Run lint + typecheck
make build Build distributable package

Usage

# Run against a target (CTF mode by default)
pentestgpt --target 10.10.11.234

# With challenge context
pentestgpt --target 10.10.11.50 --instruction "WordPress site, focus on plugin vulnerabilities"

# Penetration-test mode (asset discovery → vulnerabilities → report)
pentestgpt --target 10.10.11.234 --mode pentest

# List previously saved sessions
pentestgpt --list-sessions

The agent works through a multi-stage pipeline, feeding each stage's findings into the next — recon → exploit → walkthrough for CTF, asset discovery → vulnerability identification → report for pentest.

Run in Docker (install once, log in once)

A self-contained image bundles the tool + the Claude Code and Codex CLIs. You log in once and the sessions persist in named volumes — no re-login on later runs.

make docker-build        # build the tool image
make docker-login        # ONE-TIME, idempotent: checks logins, logs in only what's missing
make docker-auth-status  # check both are logged in (ROUNDTRIP=1 for a live 1-token check)

# Run the pipeline against a target (any backend / model / mode):
make docker-run TARGET=http://127.0.0.1:8000 BACKEND=codex MODEL=gpt-5.5 MODE=ctf
make docker-run TARGET=10.10.11.234         BACKEND=claude MODEL=opus    MODE=pentest

make docker-login logs in Claude (setup-token → token stored in the volume) and Codex (its own in-container codex login, OAuth callback forwarded via socat — not seeded, since ChatGPT refresh tokens are single-use). It is idempotent: re-running skips whatever is still valid. Logins persist across container recreation; make docker-down keeps them, make docker-nuke removes the login volumes (to force a fresh login / rotate a token). Design + details: docs/docker-dev-plan.md.


Interactive Multi-LLM Mode (modernized legacy)

The classic, human-in-the-loop PentestGPT from the USENIX 2024 paper is preserved and modernized as pentestgpt-legacy. It runs three cooperating LLM sessions — reasoning / generation / parsing — that maintain a Pentesting Task Tree (PTT) while you drive the session interactively (next, more, todo, discuss). The autonomous fixed-stage pipeline supports Claude and Codex backends; this legacy mode talks natively to many providers via their official SDKs.

Configure providers

Set an API key for any provider you want to use (in your environment or .env — see .env.example). Only the providers you configure are enabled.

OPENAI_API_KEY=...        ANTHROPIC_API_KEY=...     GEMINI_API_KEY=...   # or GOOGLE_API_KEY
DEEPSEEK_API_KEY=...      GROK_API_KEY=...          QWEN_API_KEY=...     KIMI_API_KEY=...

Run

# Auto-pick the best available models for each session
pentestgpt-legacy

# Choose models per session
pentestgpt-legacy --reasoning-model claude-opus-4-8 --parsing-model gemini-3.5-flash

# Local model via Ollama (OpenAI-compatible)
pentestgpt-legacy --reasoning-model ollama:qwen3 --base-url http://localhost:11434/v1

# List every supported model (shows which providers are configured)
pentestgpt-legacy --list-models

# Live round-trip every configured model and print a pass/fail matrix
pentestgpt-legacy --smoke-test

Supported models (web-verified June 2026)

pentestgpt-legacy --list-models always renders the live registry. Re-run --smoke-test after model IDs change. Current snapshot:

Provider Current models Legacy (kept) Env key
OpenAI gpt-5.5, gpt-5.5-pro, gpt-5.4-mini, gpt-5.4-nano, gpt-5.2, gpt-5.3-codex gpt-4o, gpt-4o-mini, o3, o4-mini OPENAI_API_KEY
Anthropic claude-opus-4-8, claude-sonnet-4-6, claude-haiku-4-5-20251001 ANTHROPIC_API_KEY
Google Gemini gemini-3.1-pro, gemini-3.5-flash, gemini-3-pro, gemini-3.1-flash-lite gemini-2.5-pro, gemini-2.5-flash GEMINI_API_KEY / GOOGLE_API_KEY
DeepSeek deepseek-v4-flash, deepseek-v4-pro deepseek-chat, deepseek-reasoner DEEPSEEK_API_KEY
xAI Grok grok-4.3 GROK_API_KEY / XAI_API_KEY
Alibaba Qwen qwen3.7-max, qwen3.5-flash qwen3-max QWEN_API_KEY / DASHSCOPE_API_KEY
Moonshot Kimi kimi-k2.6 KIMI_API_KEY (.cn default; set MOONSHOT_BASE_URL for .ai)
Local (Ollama) ollama: (e.g. ollama:qwen3) none (OLLAMA_BASE_URL)

The registry lives in pentestgpt_legacy/llm/registry.py (the single source of truth). Adding a model is one ModelSpec entry; OpenAI-compatible providers reuse one connector.


Telemetry

PentestGPT collects anonymous usage data to help improve the tool. This data is sent to our Langfuse project and includes:

  • Session metadata (target type, duration, completion status)
  • Tool execution patterns (which tools are used, not the actual commands)
  • Flag detection events (that a flag was found, not the flag content)

No sensitive data is collected - command outputs, credentials, or actual flag values are never transmitted.

readme truncated — read the full docs on github

Frequently asked questions

Is PentestGPT free to use?

PentestGPT is open source under the MIT licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does PentestGPT do?

Automated Penetration Testing Agentic Framework Powered by Large Language Models

What is PentestGPT written in?

PentestGPT is primarily written in Python. Its source is publicly available at https://github.com/GreyDGL/PentestGPT, and it has 15,521 GitHub stars.