diff --git a/.README.md.kate-swp b/.README.md.kate-swp new file mode 100644 index 0000000..230ca84 Binary files /dev/null and b/.README.md.kate-swp differ diff --git a/README.md b/README.md index 250bd75..466c6b7 100644 --- a/README.md +++ b/README.md @@ -40,18 +40,55 @@ This works through NAT/firewalls because the implant only makes outbound connect - Executes nmap scans, shell commands, Impacket tools, etc. locally - Reports results back to MCP server -## Setup +## Quick Start + +### Server Setup (One Command) ```bash -# Install dependencies -pip install -r requirements.txt +# Clone the repo and run the setup script +git clone https://github.com/creinky/agentic-pentest-mcp.git +cd agentic-pentest-mcp +./setup.sh +``` -# Start MCP server +The setup script will: +- Check for Python 3 installation +- Create a virtual environment (installing `python3-venv` if needed) +- Install all dependencies from `requirements.txt` + +After setup, start the server: +```bash +source .venv/bin/activate +export MCP_API_KEY="your-secret-key" # Optional but recommended python server.py --http 8000 +``` -# Start implant (on target network) +### Implant Setup (One Command) + +On your target machine (requires Python 3 and internet access): + +```bash +# Download the installer script +curl -O https://raw.githubusercontent.com/creinky/agentic-pentest-mcp/main/install_implant_service.sh +chmod +x install_implant_service.sh +./install_implant_service.sh +``` + +The installer will: +- Prompt for your MCP server IP, port (default 8001), and API key +- Test connectivity to the MCP server +- Check which pentest tools are installed on the implant +- Install a systemd service that auto-starts on boot with a 30-second beacon interval + +### Manual Implant Setup (Alternative) + +If you prefer not to use the installer: + +```bash +# On target machine export MCP_SERVER_URL="http://:8001" -python implant.py --id test-implant --interval 30 +export IMPLANT_API_KEY="your-secret-key" # Must match server's MCP_API_KEY +python implant.py --id my-implant --interval 30 ``` ## Available Tools @@ -98,15 +135,13 @@ pct create local:vztmpl/ubuntu-24.04-standard_24.04-1_amd64.tar.gz \ pct push agentic-pentest-mcp/ /opt/agentic-pentest-mcp/ pct enter cd /opt/agentic-pentest-mcp -apt update && apt install -y python3 python3-venv nmap -python3 -m venv .venv -source .venv/bin/activate -pip install -r requirements.txt +./setup.sh ``` ### Configure and Start ```bash -# Run server (listens on :8000 for MCP, :8001 for implant beacons) +source .venv/bin/activate +export MCP_API_KEY="your-secret-key" python server.py --http 8000 & ``` @@ -116,6 +151,7 @@ Create a systemd service or add to `/etc/rc.local`: #!/bin/bash cd /opt/agentic-pentest-mcp source .venv/bin/activate +export MCP_API_KEY="your-secret-key" python server.py --http 8000 & ``` @@ -130,7 +166,21 @@ curl http://localhost:8000/mcp ## Security Considerations -- **Optional API key authentication**: Set the `IMPLANT_API_KEY` environment variable on both server and implant to require an `X-API-Key` header on all beacon traffic. Without it, any host can register as an implant. +- **API key authentication**: Set `MCP_API_KEY` on the server and pass the same key to implants via `IMPLANT_API_KEY` environment variable or `--api-key` CLI argument. Without it, any host can register as an implant. - `run_command` tool is powerful; consider restricting in production - Use HTTPS transport for remote deployments - Implant IDs are auto-generated truncated UUIDs by default (8 hex chars), suitable for multi-implant environments + +## Troubleshooting + +### Implant gets 401 Unauthorized +Ensure the API key matches on both ends: +- Server: `export MCP_API_KEY="your-key"` +- Implant: `--api-key your-key` or `export IMPLANT_API_KEY="your-key"` + +### Implant can't reach server +Verify network connectivity and that port 8001 is open on the server. The implant only makes outbound connections, so no inbound ports are needed on the target network. + +### Service doesn't start after reboot +Check systemd service status: `systemctl status mcp-implant` +View logs: `journalctl -u mcp-implant` \ No newline at end of file