Updated October 2026: install and usage steps rewritten to match the current PentestGPT repository.
Quick answer: PentestGPT is an open-source AI agent that automates penetration testing. To try it, clone the GitHub repository, run make install, then point it at a target you are authorised to test with pentestgpt --target <ip>. The current autonomous mode runs on top of the Claude Code or Codex command line tools. The full steps are below.
Penetration testing has traditionally been one of the most skill-intensive disciplines in cybersecurity. It demands broad technical knowledge, years of hands-on experience, and the ability to think laterally – connecting disparate pieces of information into a coherent attack chain. That’s changing fast. PentestGPT is an open-source framework that harnesses large language models to automate the entire penetration testing lifecycle, from initial reconnaissance through to exploitation and post-exploitation activity.
The project earned a Distinguished Artifact award at USENIX Security 2024 – which tells you this isn’t just a weekend hack. It’s a peer-reviewed, academically grounded tool that has demonstrated measurable results against real-world targets.
What is PentestGPT?
At its core, PentestGPT is an agentic penetration testing framework built around three self-interacting modules: reasoning, generation, and parsing. These work together in a continuous loop to plan an attack strategy, generate and execute commands, and analyse the output – then feed that analysis back into the next planning cycle. The result is a system that maintains testing context across a complex engagement and can adapt its strategy based on what it discovers.
The project has recently released its Agentic v1.0, which transforms it from an interactive assistant (where you’d still guide it step-by-step) into a fully autonomous agent. Point it at a target and it handles the rest, including flag capture on CTF-style challenges.
The performance figures from the original research are striking. In testing against real-world penetration testing targets – including HackTheBox machines and CTF challenges – PentestGPT achieved an 80% task completion rate, compared to 47% for raw GPT-4 and 35% for GPT-3.5. That’s a 228.6% improvement over the baseline, which is the kind of number that should make security teams pay attention. Treat them as historical research results rather than a guarantee: the project’s own README describes its more recent 86.5% benchmark result (90 of 104 challenges, an XBOW validation run from December 2025) in the same way, and says it does not promise the same result from the current agent.
Key Capabilities
- Reconnaissance: Automated target discovery, port scanning, and service enumeration with intelligent prioritisation. The system doesn’t just run nmap and dump the output – it reasons about what the results mean and what to investigate next.
- Vulnerability Analysis: AI-powered identification and assessment of security weaknesses across multiple attack surfaces, drawing on the LLM’s embedded knowledge of known vulnerabilities and exploitation techniques.
- Exploitation: Context-aware exploit selection with intelligent payload generation. The system understands the environment it’s working in and selects appropriate techniques rather than throwing everything at a target blindly.
- Post-Exploitation: Privilege escalation, lateral movement, and comprehensive system access techniques – the full attack chain, not just initial access.
- Session Persistence: Save and resume testing sessions, so you can pick up exactly where you left off without losing context.
- Docker support: A Docker workflow keeps the testing environment isolated and reproducible, so you are not installing every tool on your own machine.
Getting Started: Installation
PentestGPT is open source and available on GitHub. Before you start, the current README lists these requirements:
- Python 3.12 or newer, plus the
uvpackage manager - The
claude(Claude Code) orcodex(Codex) command line tool, installed and signed in – the autonomous pipeline runs on these two backends - Docker, if you want the containerised workflow (the Docker image bundles both CLIs)
- Provider API keys only for the interactive legacy mode
Quick start for a local install:
- Clone the repository.
- Run
make install, which runsuv syncto set up the environment. - Make sure Claude Code or Codex is installed and authenticated.
- Run PentestGPT against a target you are allowed to test.
git clone https://github.com/GreyDGL/PentestGPT.git
cd PentestGPT
make install
If you would rather use Docker, the README documents these Makefile targets:
make docker-build
make docker-login
make docker-auth-status
make docker-run TARGET=10.10.11.234 BACKEND=claude MODEL=opus MODE=pentest
docker-login is a one-time login whose credentials are stored in named Docker volumes. Swap BACKEND, MODEL and MODE to suit your setup; the README also shows a ctf mode for capture-the-flag targets.
Running Your First Test
Once it is installed, launching an autonomous test is a single command:
pentestgpt --target 10.10.11.234
PentestGPT takes over from there – it begins with reconnaissance, enumerates services, identifies potential vulnerabilities, attempts exploitation, and works through the attack chain. If you’re running it against a HackTheBox machine or a similar CTF environment, it will attempt to capture flags autonomously. Two other flags from the README are worth knowing:
pentestgpt --target 10.10.11.234 --mode pentest
pentestgpt --list-sessions
The first selects the pentest mode, and the second lists your saved sessions so you can resume one later.
For more control, the older interactive mode is still available as pentestgpt-legacy. There, PentestGPT acts as an intelligent assistant that you guide through the engagement: it still gives strategic recommendations, generates commands and analyses output, but waits for your input at each step. This mode supports more model providers (OpenAI, Anthropic, Google Gemini, DeepSeek, xAI Grok, Alibaba Qwen, Moonshot Kimi and local Ollama), each with its own API key variable such as OPENAI_API_KEY or ANTHROPIC_API_KEY.
Who Is This For?
PentestGPT is useful at several levels. For beginners, it’s an extraordinary learning tool. You can watch an AI work through an engagement in real time, observe the reasoning behind each decision, and use the generated commands as a starting point for understanding what each tool does and why it’s being used. It’s like having a very patient senior pentester explaining their methodology as they work.
For experienced practitioners, it’s a force multiplier. Running the automated agent against a scope while you focus on manual testing of complex business logic, or using it to quickly enumerate and triage a large attack surface, can significantly compress the time required for a comprehensive assessment.
For CTF players and learners on platforms like HackTheBox, it’s a direct competitor – and based on the project’s global rank of around #900 on HTB, a fairly formidable one.
Practical Considerations
A few things worth knowing before you dive in. The autonomous agent needs a working Claude Code or Codex setup, so you will be paying for that usage, and the cost scales with the complexity and length of your engagements. The README also notes that anonymous telemetry is on by default; you can switch it off with --no-telemetry or by setting LANGFUSE_ENABLED=false.
Like all penetration testing tools, this must only ever be used against systems you own or have explicit written authorisation to test. The autonomous nature of the agent makes this especially important – it will actively attempt exploitation, not just scan for vulnerabilities.
If you use the Docker route, you will need Docker installed, but your testing environment stays isolated and reproducible.
What PentestGPT Can and Cannot Do
What it does well:
- Runs reconnaissance, service enumeration and exploitation steps without you typing each command
- Explains its reasoning, which makes it a good way to learn methodology
- Saves sessions so a long engagement can be resumed
Where to keep your expectations in check:
- Results depend on the model backend and on the target; the published benchmark numbers are historical research results, not a guarantee
- The autonomous pipeline only supports Claude Code and Codex, so the wider list of providers applies only to the legacy interactive mode
- It will actively attempt exploitation, so it must only be pointed at systems you own or have written permission to test
- It does not replace manual testing of business logic or a professional scope and report
Related AI Pentesting Guides
PentestGPT is one of several AI-assisted security tools covered on this blog. If you are comparing approaches, see the HexStrike AI guide to AI penetration testing on Kali Linux, which connects an AI model to 150+ security tools, and pentest-ai, a set of Claude Code subagents for offensive security research.
Final Thoughts
PentestGPT is one of the most interesting tools to emerge from the intersection of AI and offensive security. It’s academically rigorous, practically effective, and genuinely useful across a range of skill levels. The jump from interactive assistant to fully autonomous agent in v1.0 is a significant step forward, and the performance numbers back up the claims.
If you’re involved in security research, CTF competitions, or professional penetration testing, it’s well worth adding to your toolkit. The GitHub repository is where you’ll find the latest code, and the project’s research paper is available for those who want to understand the technical underpinning in depth.
