
PentestGPT
AI agent that runs penetration tests and CTF challenges in stages, with human-in-the-loop legacy mode.
- Stars
- 16.2k
- Forks
- 2.8k
- Licence
- MIT
- Language
- Python
- Last update
- 4 months ago
- Type
- AI model / agent
What it is
PentestGPT is a Python tool that uses large language models to help with security testing. In its main mode it runs an autonomous agent, driving Claude Code or Codex, through staged phases such as recon, exploit and walkthrough for CTF challenges, or asset discovery, vulnerability identification and report for penetration tests. An older interactive mode, pentestgpt-legacy, keeps a human in the loop and supports several LLM providers. It is published alongside a USENIX Security 2024 paper.
- Run a CTF-style challenge against a lab target with --target and an optional --instruction
- Run a staged penetration-test mode that ends in a report
- Save and resume sessions with --list-sessions and session persistence
- Use the interactive legacy mode with a chosen LLM provider or a local Ollama model
Great for
- Security students working through CTF challenges
- Security professionals who want an AI-assisted pentest workflow on authorized targets
- Researchers studying LLM-driven penetration testing
- Users who already have Claude Code or Codex CLI set up
Not ideal for
- Anyone testing systems they do not have explicit permission to test, since it is built to attack targets
- Beginners with no security or command-line background, because the setup and results need expert review
- Teams needing a guaranteed, audited scanner, because agent output depends on the underlying model and may be wrong
How to get it
- 1
Clone and build from source
You'll need: Python 3.12+ · uv (Python package manager) · Claude Code CLI or Codex CLI, installed and authenticated
Clone the repository
git clone https://github.com/GreyDGL/PentestGPT.gitEnter the project folder
cd PentestGPTInstall dependencies
make install - 2
Run it
- Install prerequisites: Python 3.12+, uv, and Claude Code or Codex CLI
- Clone the repository and run make install
- Run pentestgpt --target <address> against a target you are authorized to test
- Review results and resume later with pentestgpt --list-sessions
- 3
Get the most out of it
- Use --instruction to give the agent context such as the technology stack
- Use --mode pentest for the asset discovery to report workflow
- Use the Docker flow (make docker-build, make docker-login) to avoid repeated logins
- Use pentestgpt-legacy --list-models and --smoke-test to check which providers are configured
Downloads
Strengths
- Multi-stage pipeline passes findings from one stage to the next
- Supports several LLM providers in legacy mode, including local Ollama models
- Sessions can be saved and resumed, and the project is MIT licensed
Trade-offs
- Autonomous mode depends on Claude Code or Codex CLI being installed and authenticated
- Requires an API key or paid account for the chosen model provider; costs are not described in the README
- Telemetry sends anonymous usage data to Langfuse by default, and users must opt out explicitly
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| PentestGPT (this) | 16.2k | AI model / agent | advanced | 4 months ago | Security students working through CTF challenges |
| nebula | 18.5k | App | advanced | 7 days ago | Teams connecting servers across several clouds or data centers |
| storm | 31.8k | AI model / agent | intermediate | 1.1 years ago | Developers who want to build a customizable research or report-writing pipeline |
| FinGPT | 21.5k | AI model / agent | advanced | 12 days ago | Developers who want to experiment with finance-tuned LLMs for sentiment analysis |
| petals | 10.7k | Library | intermediate | 2.2 years ago | Developers who want to experiment with large open models like Llama 3.1 or BLOOM without owning the hardware to run them alone |
| langflow | 156k | App | intermediate | 4 days ago | Developers who want a visual way to prototype LLM workflows and then move them into code |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.