PentestGPT setup guide provides everything you need to install, configure, and effectively use this revolutionary AI-powered penetration testing tool. Whether you’re a beginner or experienced security professional, this comprehensive step-by-step guide will walk you through every step from installation to advanced usage techniques.
Developed by GreyDGL, this tool streamlines and automates various aspects of security assessments, making comprehensive penetration tests more accessible to both seasoned professionals and newcomers.
PentestGPT is an open-source project harnessing artificial intelligence to enhance penetration testing capabilities. Developed by GreyDGL, this tool streamlines and automates various aspects of security assessments, making comprehensive penetration tests more accessible to both seasoned professionals and newcomers. Unlike traditional penetration testing tools, PentestGPT shows you how this AI assistant maintains contextual awareness throughout testing sessions, preventing the information loss that commonly occurs with standard GPT models.
Before beginning the PentestGPT setup process, ensure your system meets these requirements:
The fastest way to complete the PentestGPT setup is using pip installation:
# Install PentestGPT directly from GitHub pip3 install git+https://github.com/GreyDGL/PentestGPT
For customisation and development, this PentestGPT setup recommends cloning the repository:
# Clone the repository git clone https://github.com/GreyDGL/PentestGPT cd PentestGPT # Install in development mode pip3 install -e .
You Might Be Interested In
The PentestGPT recommends OpenAI for optimal performance:
# Export your OpenAI API key export OPENAI_API_KEY='your_openai_api_key_here' # Optional: Set custom base URL if needed export OPENAI_BASEURL='https://api.openai.com/v1'
This guide also supports alternative providers:
# For Google Gemini export GOOGLE_API_KEY='your_google_api_key_here' # For Deepseek export DEEPSEEK_API_KEY='your_deepseek_api_key_here'
Verify your PentestGPT configuration with the connection test:
pentestgpt-connection
Expected output should show successful API connection and model access confirmation.
Launch PentestGPT with default settings:
# Start with default GPT-4o model pentestgpt # Specify different models pentestgpt --reasoning_model=gpt-4o --parsing_model=gpt-4o
Once running, use these core commands from the PentestGPT guide:
help
: Display available commands and guidancenext
: Input test results and receive next step recommendationsmore
: Get detailed explanations of current testing phasetodo
: View current task list and objectivesdiscuss
: Engage in conversation with the AI assistantquit
: Exit and save session logs# View available models pentestgpt --models # Enable logging for improvement pentestgpt --logging # Custom log directory pentestgpt --logDir /path/to/custom/logs # Multiple model specification pentestgpt --reasoning deepseek-r1 --parsing gpt-4o
Start your penetration test by engaging with PentestGPT:
next
commandContinue the assessment phase:
more
for detailed vulnerability analysisExecute the penetration testing phase:
discuss
for complex scenario clarificationThe PentestGPT includes powerful sub-task handlers accessed via the more
command:
brainstorm
: Generate multiple solution approachesdiscuss
: Deep-dive into specific technical issuescontinue
: Return to main testing sessionhelp
: Sub-task specific guidancePentestGPT supports various input types:
Use <SHIFT + right arrow>
to complete input and <ENTER>
for new lines.
Current PentestGPT supports:
OpenAI Models:
Google Models:
Deepseek Models:
After empirical evaluation, we find that GPT-4 performs better than GPT-3.5 and other LLMs in terms of penetration testing reasoning. In fact, GPT-3.5 leads to failed test in simple tasks.
For organisations requiring local deployment, PentestGPT includes local model support:
# Use local GPT4ALL models pentestgpt --reasoning=gpt4all --parsing=gpt4all
Configure custom models by updating module_mapping
in pentestgpt/utils/APIs/module_import.py
.
echo $OPENAI_API_KEY
pentestgpt-connection
pip3 install --upgrade pip
pip3 cache purge
quit
PentestGPT includes comprehensive logging:
logs
directoryGenerate professional reports:
python3 utils/report_generator.py <log_file>
PentestGPT serves as an exceptional educational tool, fostering learning and skill development in penetration testing. Unlike many regular LLMs that restrict cybersecurity-related queries due to potential malicious use, PentestGPT is specifically designed for penetration testing.
When exploring new technology and incorporating it into your methodology, it’s always a good idea to start by examining what other folks in your space are already doing with that technology. When I initially started going down this path, my BHIS colleague Derek Banks introduced me to a project called burpference.
The original PentestGPT development team has launched Cybersecurity AI (CAI), representing the next evolution:
CAI Repository: https://github.com/aliasrobotics/CAI
Technical Paper: https://arxiv.org/pdf/2504.06017
PentestGPT v1.0 development includes:
Discord Channel: https://discord.gg/eC34CEfEkK
GitHub Repository: https://github.com/GreyDGL/PentestGPT
For additional cybersecurity and AI penetration testing insights:
You Might Be Interested In
Configure custom endpoints for enterprise deployments:
export OPENAI_BASEURL='https://your-custom-endpoint.com/v1'
Complete environment setup:
# Core configuration export OPENAI_API_KEY='your_key' export PENTESTGPT_LOG_LEVEL='INFO' export PENTESTGPT_SESSION_DIR='/path/to/sessions' # Model preferences export PENTESTGPT_DEFAULT_MODEL='gpt-4o' export PENTESTGPT_FALLBACK_MODEL='gpt-4'
This comprehensive guide provides everything needed to successfully install, configure, and utilise this AI-powered penetration testing tool. From basic installation to advanced configuration, the setup guide ensures you can leverage artificial intelligence to enhance your cybersecurity testing capabilities effectively. Remember that PentestGPT serves as an assistant similar to Kali-GPT (but PentestGPT is free) to augment human expertise, not replace it. The tool excels at automation, pattern recognition, and guidance, but skilled security professionals remain essential for complex decision-making and strategic testing approaches. Whether you’re conducting educational exercises, professional assessments, or research activities, this PentestGPT setup guide establishes the foundation for successful AI-enhanced penetration testing workflows.