| name | pentestcode-ai-pentest-agent |
| description | AI-powered penetration testing agent with multi-agent architecture, engagement state tracking, and autonomous security testing |
| triggers | ["run automated penetration test","use PentestCode to scan targets","set up AI pentesting agent","enumerate services with PentestCode","manage pentest engagement state","coordinate multi-agent security testing","parse nmap results into engagement","spray credentials across discovered services"] |
PentestCode AI Pentest Agent
Skill by ara.so — Security Skills collection.
PentestCode is an AI penetration testing agent that runs in your terminal with a multi-agent architecture. It maintains persistent engagement state, coordinates 13 specialized security agents, and automates reconnaissance through post-exploitation workflows. Built on TypeScript with Effect library.
Installation
curl -fsSL https://raw.githubusercontent.com/s0ld13rr/pentestcode/main/install.sh | bash
PENTESTCODE_VERSION=0.1.7 curl -fsSL https://raw.githubusercontent.com/s0ld13rr/pentestcode/main/install.sh | bash
PENTESTCODE_INSTALL=/usr/local/bin curl -fsSL https://raw.githubusercontent.com/s0ld13rr/pentestcode/main/install.sh | bash
bun install
bun run build --single --skip-embed-web-ui
Authentication & Configuration
pentestcode auth login
Example configuration:
{
"provider": {
"anthropic": {
"model": "claude-sonnet-4-20250514",
"apiKey": "${ANTHROPIC_API_KEY}"
}
},
"mode": "auto",
"pauseOnFindings": "checkpoint",
"scope": {
"targets": ["10.10.10.0/24"],
"exclude": ["10.10.10.1"]
}
}
Supported providers: Anthropic, OpenAI, Google, Azure, AWS Bedrock, Ollama, Together, Groq, Fireworks, DeepSeek, Mistral.
Core Usage Patterns
Interactive Session
pentestcode
you: "pentest 10.10.10.5, goal is domain admin"
you: "scan 192.168.1.0/24 and enumerate all services"
you: "spray credentials across SMB and WinRM"
One-Shot Execution
pentestcode --prompt "scan 10.10.10.0/24 and enumerate all services"
pentestcode --config custom.jsonc --prompt "pentest 10.10.11.23"
CTF Mode
pentestcode --prompt "HTB box 10.10.11.45, find user.txt and root.txt"
Slash Commands
/status
/targets
/vulns
/creds
/scope add 10.10.10.0/24
/scope exclude 10.10.10.1
/scope list
/phase
/phase recon
/mode auto
/mode free
/mode guided
/pause never
/pause always
/pause checkpoint
/report
Multi-Agent Architecture
PentestCode uses 13 specialized agents coordinated by a strategist:
Agents spawn in parallel and share engagement state:
Built-in Tools
Parser Tools (Mandatory Usage)
nmap -sS -sV -p- 10.10.10.5 -oX scan.xml
nuclei -u https://target.com -json -o nuclei.json
netexec smb 10.10.10.0/24 -u users.txt -p passwords.txt > cme.log
gobuster dir -u https://target.com -w wordlist.txt -o gobuster.txt
Analysis Tools
Tactical Tools
State Management Tools
state_update({
type: "add_host",
ip: "10.10.10.5",
hostname: "dc01.corp.local",
os: "Windows Server 2019"
})
state_update({
type: "add_service",
host: "10.10.10.5",
port: 445,
protocol: "tcp",
service: "microsoft-ds",
version: "Windows Server 2019"
})
state_update({
type: "add_vuln",
host: "10.10.10.5",
title: "SMB Signing Not Required",
severity: "medium",
confidence: 0.9,
evidence: "nmap output shows signing disabled"
})
state_update({
type: "add_cred",
username: "administrator",
password: "P@ssw0rd",
type: "plaintext",
domain: "CORP",
: [, ]
})
([
{ : , : },
{ : , : , : }
])
state_query({ type: "hosts" })
state_query({ type: "services", host: "10.10.10.5" })
state_query({ type: "vulns", severity: "critical" })
state_query({ type: "creds" })
state_query({ type: "access", host: "10.10.10.5" })
state_query({ type: "ad_domain" })
state_query({
type: "attack_paths",
source: "10.10.10.5",
target: "domain_admin"
})
Engagement State Structure
The engagement state persists at .pentestcode/state.json:
interface EngagementState {
hosts: Array<{
ip: string;
hostname?: string;
os?: string;
ports: Array<{
port: number;
protocol: "tcp" | "udp";
state: "open" | "closed" | "filtered";
service?: string;
version?: string;
banner?: string;
}>;
}>;
vulns: Array<{
id: string;
host: string;
title: string;
severity: "critical" | "high" | "medium" | "low" | "info";
status: "suspected" | "confirmed" | "exploited";
confidence: number;
evidence: string[];
cve?: string;
}>;
: <{
: ;
?: ;
?: ;
: | | | | ;
?: ;
: [];
}>;
: <{
: ;
: | | | | | ;
: ;
: | | ;
}>;
: <{
: ;
: ;
: | | | ;
: ;
}>;
?: {
: ;
: [];
: [];
: ;
: <{ : ; : }>;
};
: | | | | | ;
: <{
: ;
: ;
: | ;
?: ;
}>;
}
Real Workflow Example
pentestcode
you: "pentest 10.10.10.5, goal is domain admin"
/status
/vulns
/creds
/report
Skills System
PentestCode loads knowledge packs on demand:
PHASE_RECON.md
PHASE_SCAN.md
PHASE_ENUMERATE.md
PHASE_EXPLOIT.md
PHASE_POST_EXPLOIT.md
PHASE_REPORT.md
SERVICE_SMB.md
SERVICE_SSH.md
SERVICE_HTTP.md
SERVICE_DNS.md
SERVICE_DATABASES.md
PLAYBOOK_INFRASTRUCTURE.md
PLAYBOOK_ACTIVE_DIRECTORY.md
PLAYBOOK_WEB_APPLICATION.md
PLAYBOOK_CLOUD.md
Add custom skills by creating SKILL_NAME.md:
# Custom Skill: Internal App Testing
## Tools
- Custom scanner at /opt/internal-scanner
- Credential wordlist at /wordlists/internal.txt
## Workflow
1. Run internal-scanner against target
2. Parse output with custom parser
3. ...
Skills are plain markdown — no code changes needed.
Mode-Specific Patterns
Auto Mode (Autonomous)
pentestcode --prompt "pentest 10.10.10.0/24"
Free Mode (Unrestricted)
pentestcode
/mode free
you: "scan this random IP I found: 8.8.8.8"
Guided Mode (Step-by-Step)
pentestcode
/mode guided
you: "pentest 10.10.10.5"
you: "yes"
you: "yes"
Troubleshooting
High Token Usage
{
"provider": {
"anthropic": {
"model": "claude-haiku-3-5-20250305"
}
}
}
you: "scan target, only report critical findings"
Agent Loops / Repeats Work
/status
/targets
you: "enumerate HTTP on port 80 at 10.10.10.5, do not rescan"
/mode guided
Parser Failures
you: "the nmap XML is at scan.xml but format is unusual"
tail -f .pentestcode/findings.md
Missing Dependencies
sudo apt install nmap nuclei gobuster netexec bloodhound crackmapexec
sudo pacman -S nmap
brew install nmap nuclei gobuster
Scope Violations
/scope add 10.10.11.0/24
/mode free
you: "scan 1.2.3.4"
/mode auto
Environment Variables
export ANTHROPIC_API_KEY="sk-ant-..."
export OPENAI_API_KEY="sk-..."
export GOOGLE_API_KEY="..."
export PENTESTCODE_CONFIG="/path/to/config.jsonc"
export PENTESTCODE_INSTALL="/usr/local/bin"
export PENTESTCODE_VERSION="0.1.7"
Integration Patterns
With Existing Tools
nmap -sS -sV -p- 10.10.10.5 -oX scan.xml
pentestcode --prompt "parse scan.xml and continue pentest"
python exploit.py > output.txt
pentestcode --prompt "analyze output.txt and suggest next steps"
With CI/CD
#!/bin/bash
pentestcode --prompt "scan staging environment at 10.0.1.0/24" \
--config ci.jsonc \
--report report.md
if grep -q "severity: critical" report.md; then
exit 1
fi
Programmatic State Access
import fs from 'fs';
interface State {
hosts: Array<{ ip: string; ports: any[] }>;
vulns: Array<{ severity: string; title: string }>;
creds: Array<{ username: string; password: string }>;
}
const state: State = JSON.parse(
fs.readFileSync('.pentestcode/state.json', 'utf-8')
);
const critical = state.vulns.filter(v => v.severity === 'critical');
const valid_creds = state.creds.filter(c => c.valid_for.length > 0);
Performance Optimization
{
"maxParallelAgents": 3
}
{
"provider": {
"ollama": {
"model": "llama3.1:8b",
"baseURL": "http://localhost:11434"
}
}
}
/pause checkpoint
License
MIT License - See project LICENSE file for details.