Skip to main content

pentestllm

pipx install pentestllm        # or: pip install pentestllm

ptl (also pentestllm) puts PentestLLM's security models in your terminal. Pipe nmap, a Burp request or a code snippet into it, or run one of the six pentest playbooks. No dependencies beyond Python 3.9+ (Kali included; on Kali use pipx, since its system Python refuses a global pip install). No telemetry: the only network calls go to api.pentestllm.ai, and only when you run a command.

For authorized security testing only: systems you own or have written permission to test (acceptable use).

Key

ptl login                      # paste an sk-ptl- key; saved to ~/.config/pentestllm/config.json, mode 0600
export PENTESTLLM_API_KEY=...  # or this, which wins over the saved key

On Linux and macOS the key file is written as a new 0600 file and renamed into place (a folder it creates is 0700), and a symlinked path is refused. On Windows it goes to %APPDATA%\pentestllm\config.json, and its protection is your user profile's permissions.

Get a key at pentestllm.ai. Credit is prepaid, with no subscription.

Examples

Real runs on 2026-11-29, trimmed where marked with .... The scan is of a Metasploitable 2 VM on a host-only lab network, saved to a file first; the request is OWASP Juice Shop on localhost.

$ ptl ask "does a vsftpd 2.3.4 banner on a lab VM prove the backdoor is there? two sentences"
No — the "vsftpd 2.3.4" banner only reports the version string, and the backdoor (CVE-2011-2523) was
injected into the source tarball rather than baked into the version, so a distro-rebuilt or manually
patched 2.3.4 may carry the same banner without the flaw (and the banner itself is trivially spoofable). ...
$ ptl triage < scan.txt
...
6. 80/tcp Apache 2.2.8 with DAV/2: WebDAV enabled is notable. Check: `OPTIONS` request, `PROPFIND`/PUT
   against writable paths, browse for vulnerable web apps.

7. 22/tcp OpenSSH 4.7p1 (Debian/Ubuntu): very old; Debian OpenSSL PRNG weakness era affects keys, not
   direct SSH exploitation. Check: banner-consistent weak host keys, brute-force only if authorized
   policy allows.
...
$ cat burp-request.txt | ptl ask "Juice Shop on my own laptop. What would you test here? Short list."
That endpoint is the canonical Juice Shop SQLi (the `q` param feeds an unbounded Sequelize query) ...

**1. SQLi in `q` — high confidence**
- `q=apple'` → expect 500 / Sequelize error (confirms injectable)
...

Piping a scan straight in also works, against a target in your scope: nmap -sV -oN - 192.168.56.101 | ptl triage.

Commands

Command What it does
ptl ask "question" Streams an answer. Anything on stdin is added after the question.
ptl recon-triage (ptl triage) Scan output in, the services to check first and the first manual check for each out.
ptl web-finding-triage One scanner or proxy issue: real or false positive, severity, how to confirm by hand.
ptl finding-writer Rough notes in, a report finding out: title, description, impact, remediation.
ptl ctf-hint-coach The next hint for a practice challenge, never the flag.
ptl detection-rule A Sigma rule for behaviour you saw in a lab.
ptl code-review The lines in a snippet that carry a vulnerability class, with the CWE and the fix.
ptl playbooks Lists the playbooks above.
ptl models Lists the model ids the API serves now (no key needed).
ptl login Saves your key.

The playbooks use the same system prompts as pentestllm.ai/tools/pentest-playbooks. ptl ask defaults to red-team-flash and the playbooks to glm-5.3-flash-cybersecurity; -m <model> picks another, --max-tokens caps the answer (default 1500).

When an API or network call fails, ptl prints one line saying how to fix it and exits 1: a rejected key (401) points at ptl login, an empty balance (402) at the billing page, a rate limit (429) at the tier table, and a network failure at your connection or HTTPS_PROXY. A redirect from the API is refused rather than followed, so the key is never sent to another host. Any other failure (a disk that refuses the key file, a connection cut mid-stream) is also one line and exit 1; set PTL_DEBUG=1 to see the traceback for a bug report. Bad arguments, including a --max-tokens or --max-input below 1, exit 2 with the usage line; Ctrl-C exits 130.

Piped input is capped at 1,000,000 bytes (--max-input raises it). Model text and error bodies are printed with terminal control and escape sequences removed, since scan banners and proxy pages are attacker-controlled.

In Python

The package also points the official OpenAI and Anthropic SDKs at https://api.pentestllm.ai/v1:

pip install "pentestllm[openai]"      # or [anthropic], or [all]
import pentestllm

client = pentestllm.openai_client()   # reads PENTESTLLM_API_KEY
reply = client.chat.completions.create(
    model="auto/security",
    messages=[{"role": "user", "content": "Say hi in five words."}],
)
print(reply.choices[0].message.content)

pentestllm.anthropic_client() does the same for the Anthropic SDK, and pentestllm.models() returns every chat model with its price per 1M tokens, no key needed. Without this package, set OPENAI_BASE_URL or ANTHROPIC_BASE_URL to https://api.pentestllm.ai/v1 and use your key.

Metadata

Release files for pentestllm 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pentestllm 0.2.0
File Size Uploaded Provenance Actions
pentestllm-0.2.0.tar.gz 19.1 kB Without provenance Details for pentestllm-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pentestllm 0.2.0
File Interpreter ABI Platform Actions
pentestllm-0.2.0-py3-none-any.whl Python 3 none any Details for pentestllm-0.2.0-py3-none-any.whl

Total release size: 34.3 kB

Release files / pentestllm-0.2.0.tar.gz

Download URL pentestllm-0.2.0.tar.gz
Size 19.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6ffefd4f787d11022854c1d70df3feda504519b056e08046bfe99d928778decb
BLAKE2b-256 checksum
How to use checksums
4ac93b2d295e805063ecc34ac830410453a5af0e932bc6f76b79db496951adfe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / pentestllm-0.2.0-py3-none-any.whl

Download URL pentestllm-0.2.0-py3-none-any.whl
Size 15.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0b0df406025db0581bb3115b25ee3a92494f84699e05833954fd3b4e6ea3c6f0
BLAKE2b-256 checksum
How to use checksums
f61469ae1fe0c2d146dfe26686a470ce3a810b4fb34d9aa56067732be1923da1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for pentestllm 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page