Skip to content

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
Step-by-step guide: how to use PentestGPTInstall, first run, examples, tips and FAQs

How to get it

  1. 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.git

    Enter the project folder

    cd PentestGPT

    Install dependencies

    make install
  2. 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. 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

ProjectStarsTypeLevelUpdatedBest for
PentestGPT (this)16.2kAI model / agentadvanced4 months agoSecurity students working through CTF challenges
nebula18.5kAppadvanced7 days agoTeams connecting servers across several clouds or data centers
storm31.8kAI model / agentintermediate1.1 years agoDevelopers who want to build a customizable research or report-writing pipeline
FinGPT21.5kAI model / agentadvanced12 days agoDevelopers who want to experiment with finance-tuned LLMs for sentiment analysis
petals10.7kLibraryintermediate2.2 years agoDevelopers who want to experiment with large open models like Llama 3.1 or BLOOM without owning the hardware to run them alone
langflow156kAppintermediate4 days agoDevelopers 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.