# PentestCode

> A terminal pentest agent whose specialist subagents share one engagement state

- Category: Agents & Automation / Security Agents
- Language: TypeScript
- Licence: MIT
- Repository: https://github.com/s0ld13rr/pentestcode
- Canonical page: https://ai-tldr.dev/tools/pentestcode/

## In short

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.

1. Install

   Install from npm, or use the install script. Arch users can install pentestcode-bin from the AUR.

```bash
npm install -g pentestcode-ai

# or
curl -fsSL https://raw.githubusercontent.com/s0ld13rr/pentestcode/main/install.sh | bash
```

2. Connect an LLM provider

   Log in to the provider whose model you want the agents to use.

```bash
pentestcode auth login
```

3. Start an engagement

   Run it interactively, or give it a one-shot instruction. Follow progress with /status, /vulns and /creds, or tail findings.md.

```bash
pentestcode
pentestcode --prompt "scan 10.10.10.0/24 and enumerate all services"
```

4. Pick a model in the project config

   Per-project configuration lives in .pentestcode/pentestcode.jsonc.

```jsonc
{
  "provider": {
    "anthropic": {
      "model": "claude-sonnet-4-20250514"
    }
  }
}
```

## 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
