Skip to main content

PentestAI - AI-assisted pentest CLI workflow (recon -> analysis -> scan -> validate -> report)

Project description

PentestAI

PentestAI is a CLI-first, AI-assisted penetration testing framework for Linux. It combines real pentest tools with multiple LLM providers to support analysis, validation, and reporting — without replacing the pentester.

PentestAI is designed to be used from anywhere on your system, not tied to the project directory.

What PentestAI Is (and Is Not)

PentestAI IS

  • A CLI tool for authorized penetration testing
  • AI-assisted analysis, triage, validation, and reporting
  • Built on real tools: subfinder, httpx, nmap, nuclei
  • Safe-by-default, scope-aware

PentestAI IS NOT

  • An auto-exploitation framework
  • A payload generator
  • A replacement for human decision-making

Human-in-the-loop by design.

Requirements

  • Linux (Parrot / Kali / Ubuntu recommended)

  • Python 3.12+

  • Pentest tools in $PATH:

    • subfinder
    • httpx
    • nmap
    • nuclei

Installation

git clone https://github.com/dinhvaren/PentestAI.git
cd PentestAI

python -m venv .venv
source .venv/bin/activate

pip install -e .

After installation, the command pentestai is available globally inside the virtual environment.

Configuration (IMPORTANT)

PentestAI is designed to be run outside the project directory.

1. Set config path via environment variable

export PENTESTAI_CONFIG=/absolute/path/to/PentestAI/config.yaml

(Optional – persist across sessions)

echo 'export PENTESTAI_CONFIG=/absolute/path/to/PentestAI/config.yaml' >> ~/.zshrc
source ~/.zshrc

This allows you to run pentestai from any directory (e.g. ~/, /tmp, /home/user/targets).

2. .env (API keys – private)

Create .env next to config.yaml:

OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
GEMINI_API_KEY=AIza...
DEEPSEEK_API_KEY=sk-...

3. config.yaml (public)

Minimal example:

workspace_root: "workspaces"
safe_mode_default: true

ai:
  default_provider: openai
  fallback_providers: [anthropic, gemini, deepseek]

  routing:
    surface: [openai, anthropic, gemini, deepseek]
    triage:  [anthropic, openai, gemini, deepseek]
    report:  [openai, anthropic, gemini, deepseek]

  providers:
    openai:
      api_key_env: OPENAI_API_KEY
      model: gpt-4.1-mini
      base_url: https://api.openai.com/v1

Usage (Quick Start)

You can now run PentestAI from any directory.

Initialize a target workspace

pentestai init --target example.com --scope "*.example.com"

Reconnaissance

pentestai recon run --target example.com

AI Attack Surface Analysis

pentestai surface analyze --target example.com

Vulnerability Scanning

pentestai scan run --target example.com

Validation & Triage (AI-assisted)

pentestai validate run --target example.com

Report Generation

pentestai report build --target example.com

Reports are written to:

workspaces/example.com/reports/report.md

Commands & Advanced Usage

For full command list, flags, and examples, see:

  • docs/command.md
  • docs/usage.md

These documents cover:

  • All CLI flags
  • Safe / unsafe mode
  • AI provider routing
  • Dry-run usage
  • Advanced scanning options

Legal & Ethical Use

PentestAI must only be used on systems you own or have explicit authorization to test.

By using this tool, you agree that:

  • You are responsible for authorization and scope
  • You will not use this tool illegally
  • You understand AI does not perform exploitation

Contributing

Contributions are welcome.

See:

  • docs/contributing.md
  • docs/security.md

You can contribute by:

  • Adding tool plugins
  • Adding AI providers
  • Improving prompts
  • Improving documentation

License

MIT License See LICENSE.

Why PentestAI?

PentestAI is built for:

  • Students learning real pentest workflows
  • Security interns & junior pentesters
  • Professionals who want faster analysis & cleaner reports
  • Open-source contributors interested in AI + security

If PentestAI helps you, consider starring the project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pentestai_cli-0.1.0.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pentestai_cli-0.1.0-py3-none-any.whl (24.2 kB view details)

Uploaded Python 3

File details

Details for the file pentestai_cli-0.1.0.tar.gz.

File metadata

  • Download URL: pentestai_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pentestai_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cdee84743dfd02e4bf70121fcde42f279ed90d5b062dcef2b839e3e47ee03191
MD5 263db92a7e3a93b5d3130274c9609cab
BLAKE2b-256 4289541deb3a1d63e45ebbbdd7cebfcf637f6186a3056a4e39db86553955d544

See more details on using hashes here.

Provenance

The following attestation bundles were made for pentestai_cli-0.1.0.tar.gz:

Publisher: release.yml on dinhvaren/PentestAI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pentestai_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pentestai_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 24.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pentestai_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ef20c5dde3991e612beadd4fc29a07666b864295d583b9ca3a09d76ee4bbc916
MD5 1b5028d35238381f3260e950d2ec87cd
BLAKE2b-256 be2de260de8627bea68f817d1c75898f6c51301ebcca407cb9ae04e2a6a118cd

See more details on using hashes here.

Provenance

The following attestation bundles were made for pentestai_cli-0.1.0-py3-none-any.whl:

Publisher: release.yml on dinhvaren/PentestAI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page