A GPT-empowered penetration testing tool
A GPT-empowered penetration testing tool.
Explore the docs »
Design Details
·
View Demo
·
Report Bug or Request Feature
# Install
pip3 install git+https://github.com/GreyDGL/PentestGPT
# Configure API keys (choose your preferred provider)
export OPENAI_API_KEY='your_key_here' # For OpenAI models
export GOOGLE_API_KEY='your_key_here' # For Gemini models
export DEEPSEEK_API_KEY='your_key_here' # For Deepseek models
# Test connection
pentestgpt-connection
# Start PentestGPT with default settings (GPT-4o)
pentestgpt
View available models:
pentestgpt --models
Current models include
pentestgpt [-h] [--logDir LOGDIR] [--baseUrl BASEURL] [--models]
[--reasoning MODEL_NAME] [--parsing MODEL_NAME]
[--logging] [--useAPI]
help: Show help message
next: Get next step after entering execution results
more: Get more detailed explanation of current step
todo: Show todo list
discuss: Discuss with PentestGPT
quit: Exit and save output to log file
Use <SHIFT + right arrow> to end input, and
help
: show the help message.next
: key in the test execution result and get the next step.more
: let PentestGPT to explain more details of the current step. Also, a new sub-task solver will be created to guide the tester.todo
: show the todo list.discuss
: discuss with the PentestGPT.google
: search on Google. This function is still under development.quit
: exit the tool and save the output as log file (see the reporting section below).TAB
to autocomplete the commands.ENTER
to select the item. Similarly, use <SHIFT + right arrow> to confirm selection.more
, users can execute more commands to investigate into a specific problem:
help
: show the help message.brainstorm
: let PentestGPT brainstorm on the local task for all the possible solutions.discuss
: discuss with PentestGPT about this local task.google
: search on Google. This function is still under development.continue
: exit the subtask and continue the main testing session.PentestGPT is tested under Python 3.10
. Other Python3 versions should work but are not tested.
PentestGPT relies on OpenAI API to achieve high-quality reasoning. You may refer to the installation video here.
pip3 install git+https://github.com/GreyDGL/PentestGPT
git clone https://github.com/GreyDGL/PentestGPT
cd PentestGPT
pip3 install -e .
export OPENAI_API_KEY='<your key here>'
export OPENAI_BASEURL='https://api.xxxx.xxx/v1'
if you need.pentestgpt-connection
pentestgpt-connection
. After a while, you should see some sample conversation with ChatGPT.
You're testing the connection for PentestGPT v 0.11.0
#### Test connection for OpenAI api (GPT-4)
1. You're connected with OpenAI API. You have GPT-4 access. To start PentestGPT, please use <pentestgpt --reasoning_model=gpt-4>
pentestgpt --reasoning_model=gpt-4 --useAPI=False
.poetry
is installed. If not, please refer to the poetry installation guide.pentestgpt --logging
. We will only collect the LLM usage, without any information related to your OpenAI key.logs
folder (if you quit with quit
command).python3 utils/report_generator.py <log file>
. A sample report sample_pentestGPT_log.txt
is also uploaded.PentestGPT now support local LLMs, but the prompts are only optimized for GPT-4.
pentestgpt --reasoning=gpt4all --parsing=gpt4all
.module_mapping
class in pentestgpt/utils/APIs/module_import.py
.module_import.py
, gpt4all.py
and chatgpt_api.py
to create API support for your own model.Please cite our paper at:
@inproceedings {299699,
author = {Gelei Deng and Yi Liu and V{\'\i}ctor Mayoral-Vilches and Peng Liu and Yuekang Li and Yuan Xu and Tianwei Zhang and Yang Liu and Martin Pinzger and Stefan Rass},
title = {{PentestGPT}: Evaluating and Harnessing Large Language Models for Automated Penetration Testing},
booktitle = {33rd USENIX Security Symposium (USENIX Security 24)},
year = {2024},
isbn = {978-1-939133-44-1},
address = {Philadelphia, PA},
pages = {847--864},
url = {https://www.usenix.org/conference/usenixsecurity24/presentation/deng},
publisher = {USENIX Association},
month = aug
}
Distributed under the MIT License. See LICENSE.txt
for more information.
The tool is for educational purpose only and the author does not condone any illegal use. Use as your own risk.