What is PentestCode?
PentestCode is an open-source penetration testing agent that runs in the terminal. You point it at a target and it runs the tools, reads their output, updates its picture of the network and decides what to do next. It sits in the Security Agents category of the Agents & Automation tools and is open-source, written in TypeScript and licensed MIT.
Overview
PentestCode is an open-source penetration testing agent that runs in the terminal. You point it at a target and it runs the tools, reads their output, updates its picture of the network and decides what to do next. It is a hard fork of the OpenCode coding agent (MIT), with the code-editing focus stripped out and the agent rebuilt for offensive security. The README labels it beta, and like every tool of its kind it is meant only for systems you are authorized to test.
Its design follows the strategist-coordinator model from the HPTSA research paper. A lead `pentest` agent breaks the engagement into tasks and dispatches specialist subagents in parallel, each with its own system prompt, tool permissions and domain knowledge. There are 13 agents in all, including recon, scanner, enumerator, exploiter, identity (Active Directory and Kerberos), webapp (OWASP Top 10), post-exploit, a critic that checks for false positives, and a reporter.
What ties them together is a shared, structured engagement state. It holds hosts and services, vulnerabilities with evidence chains and confidence scores, credentials, access levels, a relationship graph, an Active Directory model, network segments and attack paths computed with Dijkstra and Yen's K-shortest routes. The state survives the session, so the agent resumes where it stopped. A human-readable `findings.md` logs every vulnerability, credential and access gain with a timestamp. The agent talks to 20+ LLM providers through the Vercel AI SDK, including Anthropic, OpenAI, Google, AWS Bedrock and local models through Ollama.
What it does
- A lead strategist agent that dispatches 13 specialist subagents in parallel
- One persistent engagement state (hosts, vulns, creds, access, AD model, attack paths) shared by every agent and kept across sessions
- 18 built-in pentest tools beyond bash, including mandatory parsers for nmap, Nuclei, NetExec, Gobuster, SharpHound and sqlmap output
- Scope validation, credential-spray planning, tunnel tracking and markdown/JSON report generation
- 19 on-demand markdown skill packs (phase checklists, service knowledge, AD, web and cloud playbooks); add your own with a SKILL.md
- auto, free and guided modes plus pause-on-finding settings, driven by slash commands such as /status, /vulns and /creds
- Ships as one self-contained binary for Linux and macOS (x64 and arm64), working with 20+ LLM providers
Getting started
PentestCode installs as a single binary with no runtime to set up. Connect an LLM provider, then start an interactive session or run a one-shot prompt. Use it only against systems you are authorized to test.
Install
Install from npm, or use the install script. Arch users can install pentestcode-bin from the AUR.
npm install -g pentestcode-ai
# or
curl -fsSL https://raw.githubusercontent.com/s0ld13rr/pentestcode/main/install.sh | bashConnect an LLM provider
Log in to the provider whose model you want the agents to use.
pentestcode auth loginStart an engagement
Run it interactively, or give it a one-shot instruction. Follow progress with /status, /vulns and /creds, or tail findings.md.
pentestcode
pentestcode --prompt "scan 10.10.10.0/24 and enumerate all services"Pick a model in the project config
Per-project configuration lives in .pentestcode/pentestcode.jsonc.
{
"provider": {
"anthropic": {
"model": "claude-sonnet-4-20250514"
}
}
}Commands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Reach for it on authorized internal network and Active Directory pentests, where it sprays every credential against every service on every host
- Reach for it in CTF competitions and lab machines that need flag tracking and coordination across several targets
- Reach for it in bug bounty recon and web application testing within a defined scope
- Reach for it when an engagement spans several sessions and you want the findings and attack graph to persist between them
How PentestCode compares
PentestCode alongside other open-source security agents tools AI/TLDR tracks, ranked by GitHub stars.
| Tool | Stars | What it does |
|---|---|---|
| REA | ★ 485k | Open-source CLI and MCP server that lets coding agents reverse engineer apps locally, decompiling native binaries via Hopper or Ghidra and analysing JavaScript/Electron apps, recording each finding as reproducible evidence. |
| PentAGI | ★ 35.3k | PentAGI is a self-hosted AI security platform that plans and runs penetration tests autonomously using a team of agents and 20+ built-in pentesting tools. |
| PentestGPT | ★ 16.7k | An open-source agent that uses large language models to run penetration tests and solve security challenges, either fully autonomously or with a human in the loop. |
| HexStrike AI | ★ 14k | An MCP server that gives an AI agent a single interface to 150+ installed security tools — Nmap, Nuclei, SQLMap, Ghidra, Hashcat and more — so it can drive reconnaissance, scanning and binary analysis itself. |
| IDA Pro MCP | ★ 13.6k | An MCP server and IDA Pro plugin that exposes decompilation, cross-references, renaming and type editing to an LLM client, letting an agent read and annotate a binary inside your IDA database. |
| CAI | ★ 9.9k | CAI (Cybersecurity AI) is an open-source Python framework for building AI agents that automate offensive and defensive security tasks like recon, vulnerability discovery, and exploitation. |
| AiSOC | ★ 8.6k | A self-hostable AI Security Operations Center that ingests security telemetry, correlates detections into incidents and has LLM agents triage them, logging every step to an auditable ledger. |
| PentestCode | ★ 1.3k | A terminal pentest agent whose specialist subagents share one engagement state |
