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

Implementation:0xSteph Pentest ai Tool Installer

From Leeroopedia
Knowledge Sources
Domains Tool_Management, Installation, Dependency_Management
Last Updated 2026-10-23 00:00 GMT

Overview

Concrete tool for detecting, installing, and validating external security tools with tiered install profiles, provided by the pentest-ai engine.

Description

The tool_installer module manages the lifecycle of external security tools (nmap, nuclei, sqlmap, etc.). It defines a TOOL_CATALOG of 60+ tools across three tiers (CORE ~200MB, RECOMMENDED ~500MB, FULL ~2GB+), each with install method (apt, go, pip, cargo, manual) and size metadata. Key functions include audit_installed to check what's on PATH, install_tool to install a single tool, install_tier to install all tools up to a tier, and install_tool_by_name for the smart-install flow at engagement start.

Usage

Import this module when you need to audit, install, or validate external security tools. Used by the CLI (ptai doctor, ptai install), the install wizard, and the MCP server's security tools surface.

Code Reference

Source Location

Signature

class InstallTier(str, Enum):
    CORE = "core"
    RECOMMENDED = "recommended"
    FULL = "full"

class InstallMethod(str, Enum):
    APT = "apt"
    GO = "go"
    PIP = "pip"
    CARGO = "cargo"
    SNAP = "snap"
    MANUAL = "manual"

@dataclass(frozen=True)
class ToolSpec:
    name: str
    command: str
    tier: InstallTier
    method: InstallMethod
    install_cmd: tuple[str, ...]
    category: str
    size_mb: int = 0
    description: str = ""
    est_install_time_s: int = 60

def audit_installed() -> dict[str, Any]: ...
def audit_named(names: list[str]) -> dict[str, list[str]]: ...
def install_tool(tool: ToolSpec, sudo_password: str | None = None) -> tuple[bool, str]: ...
def install_tool_by_name(name: str, sudo_password: str | None = None) -> tuple[bool, str]: ...
def install_tier(tier: InstallTier, sudo_password: str | None = None, skip_tools: tuple[str, ...] = ()) -> dict[str, Any]: ...
def print_audit(audit: dict[str, Any]) -> None: ...

Import

from engine.tool_installer import ToolSpec, InstallTier, InstallMethod, audit_installed, audit_named, install_tool, install_tool_by_name, install_tier, print_audit, TOOL_CATALOG

I/O Contract

Inputs

Name Type Required Description
tool ToolSpec Yes Tool specification from TOOL_CATALOG
tier InstallTier Yes Target install tier (CORE, RECOMMENDED, FULL)
names list[str] Yes (audit_named) Tool names to audit
sudo_password None No Password for apt-based installs

Outputs

Name Type Description
audit dict installed/missing lists with total_missing_mb
install result tuple[bool, str] (success, message)
install_tier result dict installed/failed/skipped counts

Usage Examples

Audit Installed Tools

from engine.tool_installer import audit_installed, print_audit

audit = audit_installed()
print(f"Installed: {len(audit['installed'])}")
print(f"Missing: {len(audit['missing'])}")
print(f"Missing ~{audit['total_missing_mb']}MB")
print_audit(audit)

Install a Single Tool

from engine.tool_installer import install_tool_by_name

success, msg = install_tool_by_name("nuclei", sudo_password="my-sudo-pass")
print(f"nuclei: {msg}")

Install All Core Tier Tools

from engine.tool_installer import install_tier, InstallTier

result = install_tier(InstallTier.CORE, sudo_password="my-sudo-pass")
print(f"Installed: {result['installed']}, Failed: {result['failed']}")

Audit Named Tools (Smart Install)

from engine.tool_installer import audit_named

# At engagement start, planner predicted these tools
result = audit_named(["nmap", "nuclei", "sqlmap", "ffuf", "unknown-tool"])
print(f"Installed: {result['installed']}")
print(f"Missing: {result['missing']}")
print(f"Unknown: {result['unknown']}")

Related Pages

Page Connections

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