PentestGPT provides advanced AI and integrated tools to help security teams conduct comprehensive penetration tests effortlessly. Scan, exploit, and analyze web applications, networks, and cloud environments with ease and precision, without needing expert skills.
Thank you so much, @fkesheh and @Fx64b, for your amazing work and dedication to this project.
Thank you for being part of the HackerAI family.
The primary purpose of this GitHub repo is to show what's behind PentestGPT in order to build trust.
You can run PentestGPT locally, but the RAG system, plugins, and more will only work with proper and complex configuration.
Follow these steps to get your own PentestGPT instance running locally.
You can watch the full video tutorial here.
git clone https://github.com/hackerai-tech/PentestGPT.gitOpen a terminal in the root directory of your local PentestGPT repository and run:
npm installPreviously, we used local browser storage to store data. However, this was not a good solution for a few reasons:
- Security issues
- Limited storage
- Limits multi-modal use cases
We now use Supabase because it's easy to use, it's open-source, it's Postgres, and it has a free tier for hosted instances.
We will support other providers in the future to give you more options.
You will need to install Docker to run Supabase locally. You can download it here for free.
MacOS/Linux
brew install supabase/tap/supabaseWindows
scoop bucket add supabase https://github.com/supabase/scoop-bucket.git
scoop install supabaseIn your terminal at the root of your local PentestGPT repository, run:
supabase startIn your terminal at the root of your local PentestGPT repository, run:
cp .env.local.example .env.localGet the required values by running:
supabase statusNote: Use API URL from supabase status for NEXT_PUBLIC_SUPABASE_URL
Now go to your .env.local file and fill in the values.
If the environment variable is set, it will disable the input in the user settings.
In the 1st migration file supabase/migrations/20240108234540_setup.sql you will need to replace 2 values with the values you got above:
project_url(line 53):http://supabase_kong_pentestgpt:8000(default) can remain unchanged if you don't change yourproject_idin theconfig.tomlfileservice_role_key(line 54): You got this value from runningsupabase status
This prevents issues with storage files not being deleted properly.
In your terminal at the root of your local PentestGPT repository, run:
npm run chatYour local instance of PentestGPT should now be running at http://localhost:3000. Be sure to use a compatible node version (i.e. v18).
You can view your backend GUI at http://localhost:54323/project/default/editor.
Go to the login screen at http://localhost:3000
Fill in your email and password, then press Sign Up.
Access Inbucket, the email testing service, at http://localhost:54324.
Find the mailbox for the email you used to sign up. Review the received message and confirm your email.
Now you can use this user and password to login.
Follow these steps to get your own PentestGPT instance running in the cloud.
Video tutorial coming soon.
Repeat steps 1-4 in "Local Quickstart" above.
You will want separate repositories for your local and hosted instances.
Create a new repository for your hosted instance of PentestGPT on GitHub and push your code to it.
Go to Supabase and create a new project.
Once you are in the project dashboard, click on the "Project Settings" icon tab on the far bottom left.
Here you will get the values for the following environment variables:
-
Project Ref: Found in "General settings" as "Reference ID" -
Project ID: Found in the URL of your project dashboard (Ex: https://supabase.com/dashboard/project/<YOUR_PROJECT_ID>/settings/general)
While still in "Settings" click on the "API" text tab on the left.
Here you will get the values for the following environment variables:
-
Project URL: Found in "API Settings" as "Project URL" -
Anon key: Found in "Project API keys" as "anon public" -
Service role key: Found in "Project API keys" as "service_role" (Reminder: Treat this like a password!)
Next, click on the "Authentication" icon tab on the far left.
In the text tabs, click on "Providers" and make sure "Email" is enabled.
We recommend turning off "Confirm email" for your own personal instance.
Open up your repository for your hosted instance of PentestGPT.
In the 1st migration file supabase/migrations/20240108234540_setup.sql you will need to replace 2 values with the values you got above:
project_url(line 53): Use theProject URLvalue from aboveservice_role_key(line 54): Use theService role keyvalue from above
Now, open a terminal in the root directory of your local PentestGPT repository. We will execute a few commands here.
Login to Supabase by running:
supabase loginNext, link your project by running the following command with the "Project ID" you got above:
supabase link --project-ref <project-id>Your project should now be linked.
Finally, push your database to Supabase by running:
supabase db pushYour hosted database should now be set up!
Go to Vercel and create a new project.
In the setup page, import your GitHub repository for your hosted instance of PentestGPT. Within the project Settings, in the "Build & Development Settings" section, switch Framework Preset to "Next.js".
In environment variables, add the following from the values you got above:
NEXT_PUBLIC_SUPABASE_URLNEXT_PUBLIC_SUPABASE_ANON_KEYSUPABASE_SERVICE_ROLE_KEY
You can also add API keys as environment variables.
OPENAI_API_KEYOPENROUTER_API_KEY
For the full list of environment variables, refer to the '.env.local.example' file. If the environment variables are set for API keys, it will disable the input in the user settings.
Click "Deploy" and wait for your frontend to deploy.
Once deployed, you should be able to use your hosted instance of PentestGPT via the URL Vercel gives you.
In your terminal at the root of your local PentestGPT repository, run:
npm run updateIf you run a hosted instance you'll also need to run:
npm run db-pushto apply the latest migrations to your live database.
You can get in touch with us through email at contact@hackerai.co or connect with us on X.
Interested in contributing to PentestGPT? Please see CONTRIBUTING.md for setup instructions and guidelines for new contributors. As an added incentive, top contributors will have the opportunity to become part of the PentestGPT team.
Licensed under the GNU General Public License v3.0