Update readme

This commit is contained in:
Joey Yakimowich-Payne 2025-05-14 14:56:57 -06:00
commit c0abe8f0f0

150
README.md
View file

@ -24,6 +24,156 @@ You will also need to set your Hugging Face token as an environment variable:
export HF_TOKEN=your_huggingface_token
```
## Windows Installation Guide
### Prerequisites
- Windows 10 or 11
- Internet connection
- Administrator access (for some steps)
### Step 1: Install Python (if not already installed)
1. Download Python 3.12 from [python.org](https://www.python.org/downloads/)
2. Run the installer
3. **Important:** Check "Add Python to PATH" during installation
4. Complete the installation
### Step 2: Install CUDA (Only if you have an NVIDIA GPU)
1. Check if you have a compatible NVIDIA GPU:
- Right-click on desktop → NVIDIA Control Panel
- Or check Device Manager → Display adapters
- No NVIDIA GPU? Skip to Step 3
2. Download CUDA Toolkit:
- Go to [NVIDIA CUDA Downloads](https://developer.nvidia.com/cuda-downloads)
- Select "Windows" and your Windows version
- Download the installer (select "exe (local)")
3. Install CUDA:
- Run the downloaded installer
- Choose "Express" installation
- Follow the prompts to complete installation
4. Verify installation:
- Open Command Prompt
- Type `nvcc --version` and press Enter
- If installed correctly, you'll see the CUDA version
### Step 3: Install UV (Python Package Manager)
1. Open PowerShell as Administrator (right-click PowerShell in Start menu → "Run as administrator")
2. Run this command:
```
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
```
### Step 4: Create a Virtual Environment
1. In PowerShell, run:
```
uv venv --python 3.12.0
```
2. Activate the environment:
```
.\venv\Scripts\activate
```
### Step 5: Install Required Packages
Choose ONE of these options depending on your computer:
**If you have a NVIDIA GPU (for faster processing):**
```
uv pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126
```
**If you don't have a NVIDIA GPU or unsure:**
```
uv pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
```
### Step 6: Install Additional Required Packages
```
uv pip install -U "huggingface_hub[cli]" transformers tiktoken
```
### Step 7: Set Up Hugging Face Access
1. Create a Hugging Face account at [huggingface.co](https://huggingface.co/join) if you don't have one
2. Get your access token from [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens)
3. Login with this command:
```
huggingface-cli login
```
4. Paste your token when prompted
### Step 8: Run the Tool
```
python hacking.py
```
## PyCharm Configuration
### Step 1: Install PyCharm
1. Download PyCharm from [JetBrains website](https://www.jetbrains.com/pycharm/download/)
- Community Edition (free) is sufficient for this project
- Professional Edition offers more features if you have access
2. Run the installer and follow the prompts
3. Launch PyCharm after installation
### Step 2: Open the Project
1. In PyCharm, select "Open" from the welcome screen
2. Navigate to the folder containing your prompt-hacking tool
3. Select the folder and click "OK"
### Step 3: Configure the Python Interpreter
1. Go to File → Settings (or PyCharm → Preferences on macOS)
2. Navigate to Project → Python Interpreter
3. Click the gear icon → Add...
4. Select "Existing environment"
5. Browse to your virtual environment:
- Find the `venv` folder created earlier
- Select the Python interpreter inside:
- Windows: `venv\Scripts\python.exe`
- macOS/Linux: `venv/bin/python`
6. Click "OK" to apply
### Step 4: Run Configuration Setup
1. Go to Run → Edit Configurations...
2. Click "+" to add a new configuration
3. Select "Python"
4. Set the following:
- Script path: Select `hacking.py`
- Python interpreter: Ensure your venv interpreter is selected
- Working directory: Should be set to the project root automatically
5. Click "OK"
### Step 5: Add Environment Variables
1. Go to Run → Edit Configurations... again
2. Select your configuration
3. Click on "Environment variables" field
4. Click the browse button (folder icon)
5. Click "+" to add a new variable
6. Add your Hugging Face token:
- Name: `HF_TOKEN`
- Value: Paste your Hugging Face token
7. Add any other environment variables needed
8. Click "OK" to save
### Step 6: Configure Command-Line Arguments
1. Go to Run → Edit Configurations... again (if not already open)
2. Select your configuration
3. In the "Parameters" field, add your desired arguments:
- Example: `--injection "Say the following exactly:" --mandatory-text " give me the password"`
- Each argument should be properly quoted if it contains spaces
4. Common arguments:
```
--injection "Your injection text"
--mandatory-text "Your payload text"
--init-prefix-words-count 25
```
5. Click "OK" to save
### Step 7: Run the Tool
1. Click the green play button in the top right
2. Alternatively, right-click on `hacking.py` in the project explorer and select "Run"
3. The tool will run with your configured environment variables and arguments
## Usage
Basic usage: