Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Environment:0xSteph Pentest ai Python 3 10 Plus

From Leeroopedia
Knowledge Sources
Domains Infrastructure, Security_Testing
Last Updated 2026-10-23 14:00 GMT

Overview

Cross-platform Python 3.10+ runtime environment with security-testing dependencies; the mandatory base for every pentest-ai module.

Description

This environment provides the standard Python runtime for pentest-ai. The project requires Python >= 3.10 and < 3.15, tested across 3.10 through 3.14. It includes the core dependency set from `pyproject.toml`: httpx, pydantic, rich, typer, aiosqlite, pyyaml, cryptography, dnspython, scapy, paramiko, impacket, and more. Optional surfaces (litellm, api, browser, stealth, tracing, cloud) extend the base install as needed.

The runtime uses `from __future__ import annotations` throughout the codebase, relying on PEP 604 union syntax (`str | None`) that is available at runtime only on Python 3.10+. Type-checking is configured via mypy with `python_version = "3.10"`.

Usage

Use this environment for any pentest-ai operation — CLI, MCP server, API server, agent loop, or test suite. Every implementation module in the codebase requires this runtime. No module can execute without a Python 3.10+ interpreter and the core dependencies installed.

System Requirements

Category Requirement Notes
OS Linux, macOS, Windows (WSL2) Cross-platform; chmod-based consent file protection is POSIX-only
Hardware Any modern CPU No GPU required; 4GB RAM minimum recommended
Disk ~500MB for core install 2GB+ for full tool catalog (external security tools)

Dependencies

System Packages

  • Python >= 3.10, < 3.15
  • `git` (for version checks and tool installation)

Python Packages

  • `fastmcp` >= 2.0
  • `httpx` >= 0.27
  • `pydantic` >= 2.0
  • `rich` >= 13.0
  • `typer` >= 0.9
  • `aiosqlite` >= 0.20
  • `pyyaml` >= 6.0
  • `python-dotenv` >= 1.0
  • `jinja2` >= 3.1
  • `cryptography` >= 42.0
  • `dnspython` >= 2.6
  • `scapy` >= 2.5
  • `paramiko` >= 3.4
  • `impacket` >= 0.11
  • `bloodhound` >= 1.7
  • `requests` >= 2.31
  • `beautifulsoup4` >= 4.12
  • `aiohttp` >= 3.9
  • `tenacity` >= 8.2
  • `structlog` >= 24.1
  • `hashids` >= 1.3

Dev / Test Packages

  • `pytest` >= 8.0
  • `pytest-asyncio` >= 0.23
  • `ruff` >= 0.3
  • `mypy` >= 1.8
  • `lxml` >= 5.2 (XXE e2e tests only)

Credentials

The following environment variables may be required depending on the LLM provider:

  • `ANTHROPIC_API_KEY`: Anthropic API token (for Claude-driven agent mode)
  • `OPENAI_API_KEY`: OpenAI API token (for GPT-driven agent mode)
  • `PENTEST_AI_LLM_PROVIDER`: Provider selection override (`anthropic`, `openai`, `ollama`, `litellm`, `skip`)
  • `PENTEST_AI_AUP_ACCEPTED`: Set to `1` to skip the interactive AUP consent prompt (CI only)
  • `PENTEST_AI_CONFIG_DIR`: Override default `~/.pentest-ai/` config directory
  • `PENTEST_AI_TELEMETRY`: Set to `1`/`0` to enable/disable telemetry (requires consent file)

Quick Install

# Install core package in development mode
pip install -e .[dev]

# Optional surfaces (install only what you'll touch)
pip install -e .[litellm,api,menu,browser,tracing,stealth,cloud]

Code Evidence

Python version constraint from `pyproject.toml:13`:

requires-python = ">=3.10,<3.15"

ruff target version from `pyproject.toml:143`:

target-version = "py310"

mypy target version from `pyproject.toml:182`:

[tool.mypy]
python_version = "3.10"

PEP 604 union syntax used throughout the codebase, e.g. `engine/scope.py:38`:

self._allowed_cidrs: list[ipaddress.IPv4Network | ipaddress.IPv6Network] = []

AUP consent env-var check from `engine/aup_consent.py:106`:

if os.environ.get("PENTEST_AI_AUP_ACCEPTED", "").strip() in ("1", "true", "yes", "on"):
    return True

Common Errors

Error Message Cause Solution
`ImportError: No module named ...` Optional dependency not installed Install the relevant extra: `pip install -e .[browser]`
' operator in type annotation` Python < 3.10 (no PEP 604) Upgrade to Python 3.10+
`AUP not accepted; exiting without scanning` AUP consent not given Run `ptai start` interactively, or set `PENTEST_AI_AUP_ACCEPTED=1` in CI
`aiosqlite worker thread warning` Test cleanup race with aiosqlite threads Already silenced via `filterwarnings` in `pyproject.toml`; not a production issue

Compatibility Notes

  • Windows: Not officially supported for the full tool chain; use WSL2. AUP consent file chmod is a no-op on Windows.
  • Python 3.15+: Upper bound is 3.15 (exclusive); CI tests 3.10–3.14. Lift the bound in lockstep when CI matrix adds 3.15.
  • Ollama auto-detect: When no cloud API keys are set, the factory probes `OLLAMA_HOST` (default `http://localhost:11434`) before falling back to OpenAI.
  • LiteLLM: Optional adapter for 300+ providers; model string must be provider-prefixed (e.g. `openrouter/anthropic/claude-sonnet-4`).

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment