PentestCode is a terminal agent for offensive security work. You name a target and a goal, and it runs the tooling, reads the output, updates its picture of the network, and picks the next step: scanning ports, recognizing what a host is, enumerating services in parallel, attacking to obtain a first credential, spraying that credential across every discovered service, and exploiting the resulting foothold. It is a hard fork of OpenCode with the code-editing focus removed and rebuilt for security testing, and the project labels the release beta.
Work is split across 13 agents. A lead pentest agent plans the engagement and dispatches specialists — recon, scanner, enumerator, exploiter, identity for Active Directory and Kerberos, infrastructure for SNMP, IPMI, and databases, webapp for the OWASP Top 10, post-exploit, exploit-dev, a critic that checks for false positives, and a reporter — each with its own system prompt, tool permissions, and domain knowledge. The design follows the strategist-coordinator model described in HPTSA research.
Every agent reads and writes one structured engagement state, so a port found by the scanner is immediately visible to the enumerator. The state holds hosts and services, vulnerabilities with severity, status, evidence chain, and confidence, credentials and what they unlock, current access and privilege level, an entity relationship graph, an Active Directory domain model, network segments, and attack paths computed with cost-based Dijkstra and Yen's K-shortest routes. It survives across sessions, and a findings.md file logs each vulnerability, credential, and access gain with timestamps.
Eighteen built-in tools sit alongside bash, and the parser tools are mandatory: output from nmap, Nuclei, NetExec, Gobuster, SharpHound, and sqlmap must be piped through the matching parser so findings reach the engagement state rather than staying in the terminal. Nineteen knowledge packs are loaded on demand — six phase checklists, nine service-specific packs, and four playbooks — and you can add your own by dropping a SKILL.md file into the skills directory.
A live session is driven with slash commands such as /status, /vulns, /creds, /scope, /phase, and /report, and three modes set how much autonomy the agent gets: auto runs the phases on its own, free drops the phase structure and scope checks, and guided proposes each action and waits for approval. Modes combine with a pause setting of never, always, or checkpoint.
Features
- Multi-agent engagement: a lead agent dispatches 13 specialist subagents in parallel, each with its own prompt and tool permissions
- Shared engagement state: hosts, services, vulnerabilities, credentials, access, relationships, AD model, network segments, and attack paths in one structure
- Attack-path finding: cost-based Dijkstra and Yen's K-shortest routes over the relationship graph
- Mandatory parsers: nmapparse, nucleiparse, cmeparse, gobusterparse, bloodhoundparse, and sqlmapparse convert tool output into state
- Analysis tools: xssdetect, jwtanalyze, credspray, scopecheck, attackpathsuggest, tunnelmanage, and phasecontrol
- Reporting: report_gen produces Markdown or JSON reports, and findings.md logs each finding with a timestamp
- On-demand skills: 19 Markdown knowledge packs covering phases, services, and playbooks, extensible by adding a SKILL.md file
- Session persistence: state survives closing the terminal, and the agent resumes where it stopped
- Autonomy modes: auto, free, and guided, combined with never, always, or checkpoint pause behavior
- Provider choice: more than 20 model providers reachable through the ai-sdk layer, selected in .pentestcode/pentestcode.jsonc
