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.
- 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.
Required Stack: Docker Desktop, .NET 10.0 SDK, Node.js, GitHub Copilot CLI, VS Code.
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.rpmDebian:
wget https://desktop.docker.com/linux/main/amd64/docker-desktop-amd64.deb
sudo dpkg -i docker-desktop-amd64.debKali 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.debUbuntu (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.serviceStart & Enable Docker Desktop:
systemctl --user start docker-desktop
systemctl --user enable docker-desktopInstall .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.0RHEL
sudo dnf install -y dotnet-sdk-10.0Install 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# 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- The
.vscode/mcp.jsonis pre-configured. - Press
Ctrl+Shift+P→ type MCP: List Servers. - Select VS-Code-Kali-MCP-Server → Start.
- In Copilot Chat, use
@kali-execor ask the agent to run commands (e.g.,Install openvpn in the kali container).
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 runYou 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"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 inProgram.csfor greater reasoning. Currently supported tiers includegpt-5.1-codex,claude-sonnet-4.6, andclaude-opus-4.6.
- MCP C# SDK Learning Path
- Ralph Pattern Implementation
- Kali MCP Server README
- Acknowledgments: timsonner/kali-mcp-server, GitHub Copilot SDK, Model Context Protocol
Tags: #cybersecurity #penetration-testing #AI #MCP #KaliLinux #autonomous-agents