Artificial Intelligence

PentestCode: A Guide to AI-Powered Penetration Testing

Meet PentestCode, an open-source AI penetration testing tool that uses 13 AI agents to automate security testing. Learn how it works, explore its features, and see how to install it.

M
Md Shayon
Nov 29, 2026
10 min read
Table of Contents
PentestCode: A Guide to AI-Powered Penetration Testing

Testing the security of a network or website takes time. You need to scan systems, check open ports, find security problems, and test possible ways attackers could get in. Now imagine having an AI assistant that can help with most of this work. That's what PentestCode is trying to do. PentestCode is a free, open-source AI penetration testing tool that runs in your terminal. You give it a target and a testing goal. It can run security tools, read their results, find things worth checking, and decide what to investigate next. But it doesn't use just one AI agent. It has 13 specialized agents that work together. For example, one agent handles scanning, another checks discovered services, and another focuses on web security. They share information, so they don't have to repeat the same work. PentestCode is built from OpenCode, an open-source coding agent. Its coding features have been removed and replaced with tools made for security testing. It's still a beta project, so you may run into some bugs. But the idea behind it is interesting. Follow Official PentestCode GitHub repository. Let's see how it works.

How Does PentestCode Work?

The main idea is simple: instead of making one AI agent do everything, PentestCode gives different tasks to different agents. A main agent called pentest manages the whole process. It decides what needs to be done and sends tasks to other agents. For example, during an authorized network security test, the process might look like this:

  1. Scan: Find open ports and running services.

  2. Identify: Understand what services are running.

  3. Investigate: Check for possible security problems.

  4. Test: Verify whether the discovered issues are real.

  5. Report: Save the findings and prepare a report.

The agents can also work on different tasks at the same time.

Meet the 13 AI Agents

Each agent has its own job.

Here are some of the main ones:

Agent

What it does

Recon

Collects information about targets

Scanner

Finds open ports and services

Enumerator

Checks discovered services

Exploiter

Tests possible vulnerabilities

Identity

Handles Active Directory and Kerberos testing

Infrastructure

Checks network services and databases

Webapp

Focuses on website security

Post-exploit

Handles post-exploitation testing

Critic

Reviews findings and checks for mistakes

Reporter

Creates security reports

There are also agents for exploit development, context management, and other tasks. The best part? These agents share information with each other.

All Agents Share the Same Memory

Imagine one agent finds an open port on a server. Another agent can use that information immediately. It doesn't need to scan the same server again just to understand what was discovered. PentestCode stores information in a shared engagement state. This includes:

  • Hosts: IP addresses, hostnames, and operating systems.

  • Services: Open ports and running services.

  • Vulnerabilities: Security problems and their evidence.

  • Credentials: Discovered usernames and passwords or hashes.

  • Access: Which systems have been accessed and at what level.

  • Network relationships: Connections between different systems.

  • Attack paths: Possible routes through the network.

This information also stays saved after you close the terminal. So, if you stop working today and come back tomorrow, you can continue from where you left off. PentestCode also keeps a findings.md file containing discovered issues and other important information. You can watch it from your terminal:

tail -f findings.md

That's much easier than going through every conversation and tool output.

Read article on "What Can Developers Learn From the GTA 6 Hack?"

Main Features of PentestCode

PentestCode comes with several useful features. Let's look at the ones that matter most.

1. Built-in Security Tools

PentestCode includes 18 specialized security tools beyond its standard Bash tool. Some of them are:

Tool

Purpose

nmap_parse

Reads Nmap scan results

nuclei_parse

Processes vulnerability scan results

gobuster_parse

Reads directory scanning results

bloodhound_parse

Processes Active Directory data

sqlmap_parse

Reads SQL injection test results

xss_detect

Checks for common XSS issues

jwt_analyze

Checks JWT tokens for weaknesses

scope_check

Checks whether a target is within the allowed scope

report_gen

Creates security reports

state_query

Reads saved engagement information

One interesting detail is how PentestCode handles scan results. For example, after running Nmap, the agent uses nmap_parse to read the results and save discovered hosts and services. This means other agents can use that information later.

2. Support for 20+ AI Providers

You aren't limited to one AI model. PentestCode supports more than 20 LLM providers, including:

  • OpenAI

  • Anthropic

  • Google

  • Azure

  • AWS Bedrock

  • Ollama

  • DeepSeek

  • Mistral

  • Groq

You can choose a provider based on your needs and budget. It also supports Ollama, so you can connect locally running AI models instead of relying on an external API. Just remember that local models still need enough hardware to run properly.

3. 19 Knowledge Packs

PentestCode also includes 19 knowledge packs. Think of them as small instruction files that teach agents about different security topics. They cover things like:

  • Network testing

  • Web application security

  • Active Directory

  • SSH and FTP

  • Databases

  • Docker and Kubernetes

  • Cloud security

These instructions are loaded when needed instead of loading everything at once. You can also create your own knowledge packs using a SKILL.md file.

4. Three Working Modes

PentestCode offers three modes.

Mode

How it works

Auto

Agents manage the testing process automatically

Free

You give direct instructions without the normal phase structure

Guided

The agent suggests actions and waits for your approval

If you're new to the tool, Guided mode is a good place to start. You can review what the agent wants to do before allowing it to continue. There's also a pause setting that controls when the agent should stop. For example, you can make it pause whenever it finds something important.

One important warning: Free mode bypasses scope checks. Be careful when using it, especially during real security assessments.

Read article on "Protect Your TypeScript Code"

Useful PentestCode Commands

You can manage your testing session using simple slash commands.

Command

What it does

/status

Shows current progress

/targets

Lists discovered systems

/vulns

Shows discovered vulnerabilities

/creds

Shows discovered credentials

/scope

Views or changes the testing scope

/phase

Manages testing phases

/mode

Changes the working mode

/pause

Changes pause settings

/report

Creates a report

For example, use /status to see what's happening during an engagement. Use /vulns when you want to review security findings. Pretty simple.

Read article on "Fix the "Works on My Machine" Problem with Docker"

How to Install PentestCode

Installing PentestCode is fairly easy. It provides a self-contained binary for Linux and macOS, so you don't need to install a separate JavaScript runtime to run it.

Step 1: Install the Tool

You can install it using npm:

npm install -g pentestcode-ai

Or use the installation script:

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

Arch Linux users can also install it through the AUR:

paru -S pentestcode-bin

Step 2: Connect Your AI Provider

After installation, connect your preferred AI provider:

pentestcode auth login

Follow the instructions in your terminal to complete the setup.

Step 3: Start PentestCode

Start an interactive session:

pentestcode

You can also give it a one-time instruction:

pentestcode --prompt "Scan my authorized lab network and enumerate its services"

And that's it. You can now start working with PentestCode.

Step 4: Choose an AI Model

You can configure your preferred provider in:

.pentestcode/pentestcode.jsonc

For example:

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

Check the official GitHub repository for the latest setup instructions and supported models.

Read article on "Cloudflare Python Workers"

What Can You Use PentestCode For?

PentestCode can help with different types of security testing. Here are some examples.

Network security testing

You can use it to organize network scans, identify services, and investigate possible security problems in an authorized environment.

Active Directory testing

It includes tools and knowledge for checking Active Directory environments, user accounts, and network relationships.

CTF competitions

If you enjoy Capture The Flag challenges, PentestCode can help track discovered information and manage your progress.

Bug bounty research

It can help with web application testing and vulnerability investigation within an approved bug bounty scope.

Security research

Researchers can use it to organize findings and investigate possible vulnerabilities. Of course, it doesn't guarantee that every security problem will be found. You still need to check the results yourself.

Read article on "Resume Not Getting Interviews?"

PentestCode vs Other AI Security Tools

PentestCode isn't the only project working on AI-powered security testing. There are several other tools worth knowing about.

Tool

Main focus

PentestCode

Multi-agent penetration testing with shared memory

PentAGI

Autonomous AI security testing platform

PentestGPT

AI-assisted penetration testing

HexStrike AI

Connecting AI agents with security tools through MCP

CAI

Framework for building AI cybersecurity agents

These tools have different goals and ways of working. PentestCode focuses on terminal-based testing, specialist agents, and saved engagement data. PentAGI takes a more platform-based approach. PentestGPT focuses on helping users with penetration testing tasks, while HexStrike AI gives AI agents access to a large collection of security tools. So, which one should you choose? It depends on your workflow and what you want to achieve.

Read article on "Why PostgreSQL 19 Is the Most Reverted Release Ever?"

Is PentestCode Free?

Yes. PentestCode is open source and uses the MIT license. You can install it and use the software without paying for a subscription. However, your AI provider may charge you for API usage. Here's a simple breakdown:

Item

Cost

PentestCode

Free

MIT license

Free

Paid AI API

Depends on usage

Ollama local models

No external model API fee

If you want to avoid API costs, you can try connecting a local model through Ollama. Just keep in mind that running AI models locally requires suitable hardware. You can find the project here: GitHub: https://github.com/s0ld13rr/pentestcode

Things to Know Before Using PentestCode

PentestCode has some interesting features, but there are a few things you should keep in mind.

It's still in beta.

You may experience bugs or unexpected behavior. Don't assume everything will work perfectly.

AI can make mistakes.

An agent might misunderstand scan results or report something that isn't actually a vulnerability. Always verify important findings.

It needs human supervision.

Automated testing can affect real systems. Review the agent's actions and use Guided mode when you need more control.

API usage can cost money.

Running multiple agents may require many AI model calls. Your costs will depend on the provider and model you choose.

It doesn't replace security professionals.

You still need to understand what you're testing, check the results, and make the final decisions.

And most importantly, only test systems you own or have permission to test.

Is PentestCode Worth Trying?

If you're interested in AI and cybersecurity, PentestCode is definitely worth exploring. I find its shared memory approach particularly interesting. Instead of making one AI agent handle everything, it divides the work between different agents. They share information and can continue working with findings from previous sessions. That's a useful idea, especially for larger security assessments. However, it's still a beta project. So don't expect it to replace an experienced penetration tester or handle every situation perfectly. If you want to experiment with AI-powered penetration testing, start with a local lab or CTF environment. You can explore the source code and installation instructions on its GitHub page: Explore PentestCode on GitHub

FAQ

Is PentestCode free to use?

Yes. It's free and open source under the MIT license. However, paid AI providers may charge for API usage.

Does PentestCode support Ollama?

Yes. You can connect Ollama and use locally running AI models.

How many AI agents does PentestCode have?

It has 13 agents, each with different responsibilities, such as scanning, reconnaissance, web security, and reporting.

Can beginners use PentestCode?

Yes, but some basic knowledge of networking and security testing will help. Beginners should start with controlled labs and Guided mode.

Does PentestCode work on Windows?

Its documented binary support covers Linux and macOS on x64 and ARM64. Native Windows support isn't listed in the supplied documentation.

Is PentestCode safe?

It is designed for authorized security testing. However, you should review its actions and permissions carefully. Never use it against systems without permission.

Where can I download PentestCode?

You can find its source code and installation instructions on its official GitHub repository.

Conclusion

AI is changing how developers and security professionals work. PentestCode is one example of that change. It brings multiple AI agents, security tools, and shared memory into one terminal-based application. It's not perfect, and it still needs human supervision. But the idea is worth watching. If you're learning cybersecurity or working with penetration testing tools, give it a try in a safe lab environment. You might find it an interesting addition to your security toolkit. Follow Official PentestCode GitHub repository.

Tags

# PentestCode# AI Security# Penetration Testing# AI Agents# Cybersecurity Tools# Open Source Tools# Ethical Hacking# Developer Tools
Keep Reading

Related Articles

Continue your learning journey