Skip to content

About

Autonomous Penetration Testing Agent combining the Ralph Wiggum AI pattern and Kali Linux Docker containers controlled by Copilot CLI via Model Context Protocol

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

Autonomous Penetration Testing Agent

Autonomous pentest agent that combines the Ralph Wiggum agentic AI pattern with Dockerized Kali Linux containers controlled through MCP for systematic penetration testing and vulnerability assessment.

Features & Security

  • Autonomous Operation: AI-driven penetration testing & flag hunting following structured methodologies.
  • Kali Linux Integration: Full access to cybersecurity tools in an isolated Docker environment.
  • Strict Isolation: Docker-in-Docker architecture ensures tools run in nested containers and cannot compromise the host system.
  • Persistent Environment: Volume persistence so installed tools remain available until container is destroyed.
  • VS Code Integration: MCP server support allows for direct integration with Copilot Chat.

Quick Setup

Required Stack: Docker Desktop, .NET 10.0 SDK, Node.js, GitHub Copilot CLI, VS Code.

1. Install Dependencies

Install Docker Desktop & Engine (Expand for commands)

RHEL:

sudo subscription-manager repos --enable codeready-builder-for-rhel-10-$(arch)-rpms
sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-10.noarch.rpm pass gnome-shell-extension-appindicator
sudo gnome-extensions enable appindicatorsupport@rgcjonas.gmail.com
sudo dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
wget https://desktop.docker.com/linux/main/amd64/docker-desktop-x86_64-rhel.rpm
sudo dnf install -y ./docker-desktop-x86_64-rhel.rpm

Debian:

wget https://desktop.docker.com/linux/main/amd64/docker-desktop-amd64.deb
sudo dpkg -i docker-desktop-amd64.deb

Kali Linux: (Uses bookworm repository as kali-rolling is not natively supported)

sudo apt install -y apt-transport-https curl ca-certificates gnupg
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian bookworm stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
wget https://desktop.docker.com/linux/main/amd64/docker-desktop-amd64.deb
sudo apt install -y ./docker-desktop-amd64.deb

Ubuntu (Don't use Wayland):

sudo apt install -y apt-transport-https curl
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install -y ./docker-desktop-amd64.deb
sudo rm -f /etc/xdg/systemd/user/docker-desktop.service

Start & Enable Docker Desktop:

systemctl --user start docker-desktop
systemctl --user enable docker-desktop
Install .NET 10.0 SDK & Node.js (Expand for commands)

Debian / Kali / Ubuntu

wget https://packages.microsoft.com/config/debian/13/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
sudo apt-get update && sudo apt-get install -y dotnet-sdk-10.0

RHEL

sudo dnf install -y dotnet-sdk-10.0
Install Node.js & Copilot CLI:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.4/install.sh | bash
source "$HOME/.nvm/nvm.sh"
nvm install 24
npm install -g @github/copilot
copilot -i /login

2. Clone & Build

# Clone the repository
git clone https://github.com/timsonner/autonomous-pentest-agent.git
cd autonomous-pentest-agent/

# Build the Kali MCP Docker image
cd kali-mcp-server/
docker build --network host -t kali-mcp .
cd ..

# Install .NET Dependencies
dotnet add KaliMCP/KaliMCP.csproj package Microsoft.Extensions.Hosting --version 10.0.3
dotnet add KaliMCP/KaliMCP.csproj package ModelContextProtocol --version 1.1.0
dotnet add RalphAgent/RalphAgent.csproj package GitHub.Copilot.SDK --version 0.1.30
dotnet add RalphAgent/RalphAgent.csproj package Microsoft.Extensions.AI --version 10.2.0
dotnet add RalphAgent/RalphAgent.csproj package ModelContextProtocol --version 1.1.0

Usage & Execution

1. Start/restart MCP server

  1. The .vscode/mcp.json is pre-configured.
  2. Press Ctrl+Shift+P → type MCP: List Servers.
  3. Select VS-Code-Kali-MCP-Server → Start.
  4. In Copilot Chat, use @kali-exec or ask the agent to run commands (e.g., Install openvpn in the kali container).

2. Build and Run RalphAgent

The agent will automatically start the Kali MCP server, execute the mission defined in goal.md, and document its findings.

cd RalphAgent/
dotnet build
dotnet run

3. Direct MCP Client Usage

You can bypass the agent and execute manual Kali commands via the Reference Client:

cd kali-mcp-server/
dotnet run --project KaliClient -- "nmap -p- 127.0.0.1"

Agent Configuration

Modify the following files to adjust the agent's behavior:

File Purpose Example Customizations
RalphAgent/goal.md Defines the mission Target IPs, Flag Hunting Rules, Output Formats
RalphAgent/skills.md Adds capabilities New MCP Tools, Custom Workflow Actions
RalphAgent/Program.cs Code configurations Switch AI Models (e.g., Model = SONNET_4_6)

Pro-Tip on Models: Append .WithEffort("high") to supported models in Program.cs for greater reasoning. Currently supported tiers include gpt-5.1-codex, claude-sonnet-4.6, and claude-opus-4.6.


Documentation & Acknowledgments

Tags: #cybersecurity #penetration-testing #AI #MCP #KaliLinux #autonomous-agents

About

Autonomous Penetration Testing Agent combining the Ralph Wiggum AI pattern and Kali Linux Docker containers controlled by Copilot CLI via Model Context Protocol

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages