AUTOATTACKER IMPLEMENTATION
- Automates penetration testing tasks using AI.
- Integrates with various tools like sqlmap and playwright.
- Provides an interactive command-line interface.
- macOS (Intel or Apple Silicon)
- Python 3.10 (managed by Conda)
- Xcode Command Line Tools (for compiling packages)
Conda is an open-source package and environment management system that simplifies package installation and management. We'll use Miniforge, a community-driven minimal installer for Conda, which is preferred for its simplicity and compatibility.
Download Miniforge for Intel Macs:
curl -LO https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-x86_64.sh
## Install Miniforge
```bash
bash Miniforge3-MacOSX-x86_64.sh- Follow the on-screen prompts.
- Accept the license agreement.
- Choose the installation location (default is recommended).
- Allow the installer to initialize Conda.
- Restart Terminal to apply changes.
Download Miniforge for Apple Silicon Macs:
curl -LO https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.shInstall Miniforge:
bash Miniforge3-MacOSX-arm64.sh- Follow the on-screen prompts.
- Accept the license agreement.
- Choose the installation location (default is recommended).
- Allow the installer to initialize Conda.
- Restart Terminal to apply changes.
Create a New Conda Environment with Python 3.10:
conda create -n pentestgpt_env python=3.10Activate the Conda Environment:
conda activate pentestgpt_envVerify the Python Version and Architecture:
python --version
python -c "import platform; print(platform.machine())"- Ensure the Python version is 3.10.x.
- For Intel Macs,
platform.machine()should return x86_64. - For Apple Silicon Macs, it should return arm64.
Before installing dependencies, ensure you have Xcode Command Line Tools installed, as some packages require compilers.
xcode-select --install- Follow the prompts to complete the installation.
If you haven't cloned the repository yet:
cd pentestgptSome packages are available via Conda, and others via Pip.
conda install -c conda-forge \
cffi \
cryptography \
greenlet \
orjson \
pydantic \
sqlalchemy \
lxml \
pillow \
numpypip install --upgrade pip setuptools wheel
pip install -r requirements.txtIf your project uses Poetry, install dependencies using Poetry:
pip install poetry
poetry installNote: Ensure that pyproject.toml is present in the project directory.
Activate the Conda environment (if not already active):
conda activate pentestgpt_envRun the Application:
pentestgpt-connectionIf the command is not found, ensure that the package scripts are installed correctly. You might need to adjust your PATH or run the application using Python:
pentestgpt-connectionAfter successful installation, you can start using AutoAttacker by running:
python autoattacker.pyFollow the on-screen instructions to interact with the tool.
-
pip Command Not Found Ensure that you have activated the Conda environment:
conda activate pentestgpt_env
-
Architecture Mismatch Errors If you receive errors related to architecture mismatch (e.g., trying to install packages built for
arm64onx86_64), ensure that:- You're using the correct Miniforge installer for your Mac's architecture.
- Your terminal is not running under Rosetta (for Apple Silicon Macs).
-
Compilation Errors During Package Installation Some packages require compilation from source. Ensure that:
- Xcode Command Line Tools are installed:
xcode-select --install
- You have installed necessary build dependencies via Conda.
- Rust is installed for packages like
orjsonandtiktoken:curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source $HOME/.cargo/env
- Xcode Command Line Tools are installed:
-
Issues with playwright Installation For
playwright, you might need to install browser binaries:playwright install
-
Environment Activation Issues If the Conda environment doesn't activate properly, try initializing Conda for your shell:
conda init $(basename $SHELL) source ~/.bashrc # or ~/.zshrc depending on your shell
- GitHub Issues: Open an issue at GitHub Issues for assistance.
Note: The setup and config is based on a windows laptop that i currently use and depending on your command line setup and other system setting the configuration and system setup might differ
- Set PowerShell Execution Policy:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
- PS C:\Users\cghdhv\venv> cd venv
- PS C:\Users\cghdhv\venv> .\Scripts\Activate.bat
- PS C:\Users\cghdhv\venv> .\Scripts\activate
- pip3 install -e .
- $Env:OPENAI_KEY = ''
- $Env:PINECONE_API_KEY = ''
- PS C:\Users\cghdhv\venv> pentestgpt-connection
- Get the API key
- Setup index, check for the settings in vectorDB.py, and update the parameters there if needed.
- python TestExperienceManger.py
- This will check the working of Experience mainly dependent on the VectorDB.py implementation
- There are two auto attacker pipelines one is using GPT-4 and the other using ThinkGPT, autoattacker.py, and autoattacker_thinkGPT.py
- They can be run after experience manager's working has been tested