Repository navigation
User Guide
Complete guide from installation to reporting. Divided by level: junior, mid, and advanced.
- Installation
- First Configuration
- Core Concepts
- First Session — Junior Mode
- Real Engagement — Mid Mode
- Senior Workflow — Advanced Mode
- Full Command Reference
- Common Scenarios
Works on Linux and macOS. Requires Python 3.11+.
git clone https://github.com/blackbuble/pentestai.git
cd pentestai
bash setup.shWhat setup.sh does:
- Checks Python 3.11+ is installed
- Creates a virtual environment (
.venv/) - Installs 12 core dependencies (~30 seconds)
- Adds
pentestai-activatealias to your shell
After setup:
source .venv/bin/activate
pentestai guided # interactive wizard
pentestai autopilot http://target.com --report report.htmlAdd extras later without reinstalling:
pip install -e ".[ai]" # LLM-powered analysis
pip install -e ".[full]" # everything (38 deps)Available extras: ai, memory, api, browser, infra, tui, full.
Use this if you want Metasploit, Neo4j, and Qdrant included — no Python setup needed.
git clone https://github.com/blackbuble/pentestai.git
cd pentestai
cp .env.example .env # set ANTHROPIC_API_KEY
docker compose --profile msf up -d
docker attach pentestai-pentestai-1 # detach: Ctrl-p Ctrl-qThe image ships nmap, sqlmap, nikto, gobuster, ffuf, hydra, whatweb, msfconsole, Node.js, and Python.
Full Docker guide (reset, rebuild, update, API mode): Deployment.
pentestai # interactive CLI shell
pentestai autopilot URL # autonomous scan
pentestai guided # step-by-step wizard
pentestai --api # API server on :8080export ANTHROPIC_API_KEY=sk-ant-...
python3 __main__.pyPentestAI automatically detects the available providers from env vars. No additional configuration is needed.
For WorkBuddy or other custom endpoints:
export CUSTOM_LLM_BASE_URL=https://api.workbuddy.ai/v1
export CUSTOM_LLM_API_KEY=<key>
export CUSTOM_LLM_MODEL=<model>See LLM_AGENTS.md for the full list of all supported providers.
cp .env.example .env
nano .envMinimum contents:
ANTHROPIC_API_KEY=sk-ant-...
REPORT_AUTHOR=Your Name
REPORT_COMPANY=CompanyPentestAI> llm
Expected output:
Model: Claude Sonnet (anthropic)
Tier: complex
Status: ✅ configured
If it is empty, run llm add for the interactive wizard.
PentestAI has three modes that change how the AI behaves:
| Mode | Suitable for | Behaviour |
|---|---|---|
junior |
Learning pentest, first time using a tool | Verbose, guided, explanation of every step |
mid |
Already familiar with tools, learning methodology | Balanced, explanations of the important parts |
advanced |
Senior pentester, tools memorized | Silent except findings, autonomous |
PentestAI> mode junior # switch to junior
PentestAI> mode advanced # switch to advanced
PentestAI> mode # show current mode
Default: junior. Override via env: export PENTESTAI_MODE=advanced
Every engagement is one session. A session stores: target, findings, services, credentials, notes, evidence, and history.
PentestAI> session new htb-lame # start a new session
PentestAI> session save # save progress
PentestAI> session load htb-lame # resume the previous session
PentestAI> session list # list all sessions
Must be set before testing begins. PentestAI blocks every action outside the scope.
PentestAI> scope add 10.10.10.0/24
PentestAI> scope add 10.10.10.3
PentestAI> scope add htb.local
PentestAI> scope show
Set at the start of an engagement to enforce client-specific rules:
PentestAI> brief set
The wizard will ask: client name, engagement type, emergency contact, no brute force?, notify before exploit?, production systems?
Suitable for: learning, practice on DVWA/HTB.
PentestAI> mode junior
PentestAI> session new practice-dvwa
PentestAI> scope add 127.0.0.1
PentestAI> target 127.0.0.1
PentestAI> recon
In junior mode, PentestAI will:
- Run nmap and show the output with explanations
- Probe HTTP and detect technologies
- Analyze the results with AI and explain what was found
- Suggest the next steps
PentestAI> services # all discovered services
PentestAI> findings # discovered vulnerabilities
PentestAI> pending # what has not been followed up
PentestAI> ask "which service from the earlier scan looks most interesting?"
PentestAI> ask "how do I exploit Samba 3.0.20?"
PentestAI> report quick # without AI, straight from the data
PentestAI> report # with AI analysis (requires an LLM)
Suitable for: internal pentest, bug bounty, client engagements.
PentestAI> mode mid
PentestAI> session new engagement-acme-2026
PentestAI> brief set
Fill in the brief:
Client name: AcmeCorp
Type: external
Emergency contact: 081234567890
No brute force: y
Notify before exploit: y
Report deadline: 2026-11-30
PentestAI> scope add 203.0.113.0/24
PentestAI> scope add acme.com
PentestAI> scope add *.acme.com
PentestAI> recon 203.0.113.10
PentestAI> scan web http://203.0.113.10
PentestAI> enum dirs http://203.0.113.10
PentestAI> expand 203.0.114.5 "trust relationship discovered during AD enumeration"
# → Request created with an ID, e.g. [a3f8e2b1]
# Contact the client for approval
PentestAI> scope approve a3f8e2b1
PentestAI> findings
# → [HIGH] SQLi in /login.php (id: 8f3a)
PentestAI> evidence attach 8f3a sqlmap_output
# → Paste output, Ctrl+D
# → ✅ Evidence attached. Hash: a3f8e2b1c9d4f7e0
PentestAI> validate # mark candidates vs validated findings
PentestAI> poc # generate PoC for all findings
PentestAI> report # HTML with AI analysis
PentestAI> report docx # Word for the client
PentestAI> report sarif # SARIF for CI / code scanning
PentestAI> report all # every format, including PDF
PentestAI> evidence export # ZIP bundle of all evidence
Suitable for: senior pentester, red team, complex engagements.
export PENTESTAI_MODE=advanced
export ANTHROPIC_API_KEY=sk-ant-...
python3 __main__.pyPentestAI> session new htb-lame
PentestAI> scope add 10.10.10.0/24
PentestAI> target 10.10.10.3
PentestAI> brief set
Advanced mode: the agent runs silently, reporting only findings.
PentestAI> react 10.10.10.3 "find entry points, prioritize RCE"
Minimal output — only findings appear:
[CRITICAL] CVE-2007-2447 Samba 3.0.20 usermap_script — 10.10.10.3:445
PentestAI> chain 10.10.10.3
Runs 6 phases: RECON → ENUMERATION → WEB_TESTING → EXPLOITATION → POST_EXPLOIT → REPORTING. In advanced mode there are no phase gates — the agent proceeds directly.
PentestAI> pending
Check what has not been followed up: suspicious services not yet enumerated, interesting endpoints not yet tested, credentials not yet tried on other services, Critical findings without evidence.
If you need a custom tool:
PentestAI> plugin list
PentestAI> plugin enable my_custom_scanner
target <ip|host> Set the session's main target
scope add <ip/cidr|domain> Add to scope
scope show Show active scope
scope off / on Disable/enable enforcement
expand <target> <reason> Formal scope expansion request
scope approve <ref> Approve pending expansion
scope deny <ref> [reason] Deny pending expansion
recon [target] [deep] Nmap + HTTP + AI analysis
scan web [url] Nikto web scan
scan sql [url] SQLMap injection test
enum dirs [url] Gobuster directory enumeration
auto ["objective"] AI-planned scan with an objective
findings List all findings
findings add Add a finding manually
services List discovered services
endpoints List discovered endpoints
pending What has not been followed up
evidence attach <id> [label] Attach evidence to a finding
evidence verify [id] Verify integrity hash
evidence export Export ZIP bundle of all evidence
evidence fp <id> Mark finding as false positive
note <text> Add a session note
brief Show the current brief
brief set Interactive setup wizard
brief no-brute-force Add a no brute force constraint
brief production <ip> Mark an IP as production
brief contact <name/phone> Set emergency contact
report HTML + AI analysis
report quick HTML without AI
report docx Word (.docx) for the client
report sarif [all] SARIF 2.1.0 (validated only by default)
report pdf HTML → PDF (Playwright/Chromium)
report all HTML + Markdown + SARIF + DOCX + PDF
poc Generate PoC for all findings
validate Run the exploit-validation gate
validate <id> Approve one finding manually
browser <url> Open a page in headless Chromium
browser shot <url> [path] Full-page screenshot
browser text|html <url> Extract rendered text/HTML
browser login <url> [sel...] Log in using TEST_ACCOUNT_A_*
browser close Close the browser
mcp list Configured MCP servers
mcp tools <server> Tools exposed by a server
mcp call <server> <tool> <json> Invoke an MCP tool
mcp close [server] Stop one server or all
session Current session info
session new [name] Start a new session
session save [name] Save to disk
session load <name> Load a saved session
session list List all sessions
history Command history
tools Binary tools status
llm Status and active model
llm add Add a model (wizard)
llm remove <model> Remove a model
llm routing on|off Toggle tier-based routing
llm tier <model> <tier> Change tier (simple/medium/complex/all)
llm test Test connection for all models
mode Show current mode + comparison table
mode junior Verbose, guided, phase gates ON
mode mid Balanced
mode advanced Silent, autonomous, phase gates OFF
autonomy [guided|semi|auto] Get/set autonomy level
react [target] ["objective"] ReAct agent loop
chain [target] Full kill chain (6 phases)
bizlogic <url> Business logic tests
benchmark [profile] CTF/HTB benchmark (junior/mid mode)
memory status Memory system status
memory graph [ip] Attack graph for host
search <query> Search the knowledge base
ask <question> Ask the AI about the current session
orchestrate [target] [--seq] Multi-agent: recon+web+infra+report parallel
ptes Generate PTES report (JSON + Markdown)
iso27001 Generate ISO 27001 risk register (JSON)
marketplace [search|install|info|...] Plugin marketplace
plugin list List available plugins
plugin enable/disable <name> Toggle plugin
clear Clear screen
help Show help
quit / exit Save and exit
export ANTHROPIC_API_KEY=sk-ant-...
export PENTESTAI_MODE=advanced
# Connect the VPN first: openvpn lab.ovpn
python3 __main__.pyPentestAI> session new htb-machine-name
PentestAI> scope add 10.10.10.0/24
PentestAI> target 10.10.10.3
PentestAI> react "enumerate all services, find RCE vector"
docker run -d -p 18080:80 vulnerables/web-dvwa
export ANTHROPIC_API_KEY=sk-ant-...
python3 __main__.pyPentestAI> mode junior
PentestAI> session new dvwa-practice
PentestAI> scope add 127.0.0.1
PentestAI> target http://localhost:18080
PentestAI> recon
PentestAI> scan web http://localhost:18080
PentestAI> scan sql http://localhost:18080/vulnerabilities/sqli/?id=1
PentestAI> mode mid
PentestAI> session new bugbounty-target-2026
PentestAI> scope add target.com
PentestAI> scope add *.target.com
PentestAI> brief no-brute-force # usually prohibited in bug bounties
PentestAI> recon target.com
PentestAI> auto "find XSS, IDOR, and auth bypasses in target.com"
PentestAI> mode mid
PentestAI> session new internal-acme-2026-10
PentestAI> brief set # fill in complete client data
PentestAI> scope add 192.168.0.0/16 # internal network
PentestAI> brief production 192.168.1.1 # router, do not touch
# After testing is complete:
PentestAI> poc # capture all evidence
PentestAI> report docx # Word report for the client
PentestAI> evidence export # ZIP bundle for the attachment
python3 __main__.py --api
# → http://localhost:8080
# → Docs: http://localhost:8080/docs# Create an API key
curl -X POST http://localhost:8080/api/v1/auth/keys \
-H "Content-Type: application/json" \
-d '{"name": "my-automation"}'
# Create a session and start a scan
curl -X POST http://localhost:8080/api/v1/sessions \
-H "X-API-Key: psk_..." \
-H "Content-Type: application/json" \
-d '{"name": "automated-scan", "target": "10.0.0.1"}'orchestrate runs four sub-agents in parallel (or sequentially with --seq):
PentestAI> orchestrate 10.10.10.3
Execution order:
- ReconSubAgent — nmap + http probe + subdomain + cert scan (sequential, provides data for the other agents)
- WebSubAgent + InfraSubAgent — run in parallel in advanced/mid mode
- ReportSubAgent — tag all findings + generate HTML + Word report
In junior mode: there is a phase gate approval before every transition. In advanced mode: fully autonomous, no interruptions.
PentestAI> orchestrate 10.10.10.3 # parallel (default)
PentestAI> orchestrate 10.10.10.3 --seq # sequential
Report format follows the Penetration Testing Execution Standard:
PentestAI> ptes
Output: two files in reports/output/:
-
*_ptes.json— machine-readable, can be imported into SIEM/ticketing -
*_ptes.md— Markdown ready to send to the client
Contains: per-finding phase mapping (Phase 2/4/5/6), business impact, overall risk rating, executive summary.
Export findings as an ISO 27001 Annex A risk register:
PentestAI> iso27001
Output: *_iso27001.json with risk scoring (likelihood × impact), ISO Annex A control mapping, treatment status, residual risk.
Discover and install community plugins:
PentestAI> marketplace # list all plugins
PentestAI> marketplace search active # search "active directory"
PentestAI> marketplace install ad-suite # install the plugin
PentestAI> marketplace info ad-suite # plugin details
PentestAI> marketplace installed # already installed
PentestAI> marketplace fetch # refresh from GitHub
Plugins are installed into the plugins/ directory and their checksum is verified before execution.
Test before an engagement:
PentestAI> llm test # make sure the LLM is connected
PentestAI> tools # check which binaries are available
Save often:
PentestAI> session save
Sessions are saved automatically on quit, but a manual save is safer.
If you get stuck:
PentestAI> pending # check what has not been followed up
PentestAI> ask "at this point, what should I try?"
Change mode mid-engagement: The mode can be changed at any time without losing session data.
PentestAI> mode advanced # switch to autonomous
PentestAI> react # let the AI continue
PentestAI> mode mid # return to manual afterwards