ai2pentesttool-installer

v2026.09.24

AI-powered one-click installer for 200+ penetration testing and security tools with intelligent retry and error recovery

GitHub
Install command
npx skhub add reason-machines/ai2pentesttool-installer
Markdown
SKILL.md

AI2PentestTool Installer

Skill by ara.so — Security Skills collection.

AI2PentestTool is an intelligent penetration testing tool installer that uses AI agents to automate the installation of 200+ security tools. It features intelligent retry mechanisms, error recovery, cross-platform support (macOS, Linux, Windows), and works offline with built-in configurations when AI services are unavailable.

Installation

# Clone the repository
git clone https://github.com/penligent/AI2PentestTool.git
cd AI2PentestTool

# Install Python dependencies
pip install -r requirements.txt

# Optional: Set OpenAI API key for AI-powered installation plans
export OPENAI_API_KEY="your-api-key-here"

Core Components

The project consists of four main modules:

  • ai_agent.py - AI agent with retry mechanisms for OpenAI integration
  • config.py - Tool definitions and configuration management
  • tool_installer.py - Installation logic and error handling
  • main.py - Command-line interface

Key Commands

View Available Tools

# Show all 15+ core penetration testing tools
python main.py show-tools

# Check which tools are already installed
python main.py list

Install Single Tool

# Install a specific tool (e.g., nmap)
python main.py install nmap

# Install with sudo if needed (Linux)
sudo python main.py install sqlmap

Batch Installation

# Install all default tools (15 core tools)
python main.py install-default

# Install tools from a custom list file
echo -e "nmap\nsqlmap\ngobuster\nnikto" > my_tools.txt
python main.py install-file my_tools.txt

Supported Tools (15 Core Tools)

Network Scanning

  • nmap - Network discovery and security auditing
  • masscan - Fast TCP port scanner

Information Gathering

  • dig - DNS lookup utility
  • whois - Domain information query
  • amass - Subdomain enumeration
  • theHarvester - Email and domain intelligence

Web Application Testing

  • gobuster - Directory/file brute-forcing
  • sqlmap - Automated SQL injection
  • dirsearch - Web path scanner
  • wfuzz - Web application fuzzer
  • nikto - Web server scanner

Network Tools

  • curl - HTTP client
  • netcat - Network Swiss Army knife
  • traceroute - Network path diagnostics

SSL/TLS Testing

  • sslyze - SSL/TLS configuration analyzer

Configuration

Adding Custom Tools

Edit config.py and add to the TOOLS_INFO dictionary:

TOOLS_INFO = {
    "your_tool": {
        "name": "your_tool",
        "description": "Tool description",
        "macos": "brew install your_tool",
        "linux": "apt update && apt install -y your_tool",
        "windows": "https://download-link.com",
        "verify_command": "your_tool --version",
        "category": "Network Scanning"
    }
}

Environment Variables

# Required for AI-powered installation plans (optional)
export OPENAI_API_KEY="sk-..."

# Optional: Configure proxy for network requests
export https_proxy="http://proxy:port"
export http_proxy="http://proxy:port"

Python API Usage

Using the AIAgent Class

from ai_agent import AIAgent
from config import Config
import os

# Initialize AI agent
api_key = os.getenv("OPENAI_API_KEY")
agent = AIAgent(api_key=api_key)

# Get AI-powered installation plan
tool_info = Config.TOOLS_INFO["nmap"]
plan = agent.get_installation_plan("nmap", tool_info)

if plan:
    print(f"AI Plan: {plan}")
else:
    # Fallback to predefined plan
    import platform
    os_type = platform.system().lower()
    if os_type == "darwin":
        print(f"Fallback: {tool_info['macos']}")
    elif os_type == "linux":
        print(f"Fallback: {tool_info['linux']}")

Using the ToolInstaller Class

from tool_installer import ToolInstaller
import os

# Initialize installer
api_key = os.getenv("OPENAI_API_KEY")
installer = ToolInstaller(api_key=api_key)

# Install a single tool
success = installer.install_tool("nmap")
if success:
    print("Installation successful!")

# Batch install tools
tools = ["nmap", "sqlmap", "gobuster"]
for tool in tools:
    installer.install_tool(tool)

# List installed tools
installed = installer.list_installed_tools()
print(f"Installed tools: {installed}")

Programmatic Installation with Error Handling

from tool_installer import ToolInstaller
from config import Config
import os
import logging

# Set up logging
logging.basicConfig(
    level=logging.INFO,
    format='%(asctime)s - %(levelname)s - %(message)s'
)

# Initialize installer
installer = ToolInstaller(api_key=os.getenv("OPENAI_API_KEY"))

# Install tools with error handling
tools_to_install = ["nmap", "sqlmap", "nikto", "gobuster"]
results = {}

for tool in tools_to_install:
    try:
        print(f"\n Installing {tool}...")
        success = installer.install_tool(tool)
        results[tool] = "SUCCESS" if success else "FAILED"
    except Exception as e:
        logging.error(f"Error installing {tool}: {e}")
        results[tool] = "ERROR"

# Summary report
print("\n=== Installation Summary ===")
for tool, status in results.items():
    print(f"{tool}: {status}")

Common Patterns

Creating Custom Tool Lists

# Create a tool list file programmatically
tools = ["nmap", "masscan", "sqlmap", "nikto", "gobuster"]

with open("custom_tools.txt", "w") as f:
    f.write("\n".join(tools))

# Install from the file
import subprocess
subprocess.run(["python", "main.py", "install-file", "custom_tools.txt"])

Checking Tool Installation Status

from tool_installer import ToolInstaller
import subprocess

installer = ToolInstaller()

# Check if a specific tool is installed
def is_tool_installed(tool_name):
    try:
        result = subprocess.run(
            ["which", tool_name],
            capture_output=True,
            text=True
        )
        return result.returncode == 0
    except Exception:
        return False

# Verify installation
tools = ["nmap", "sqlmap", "gobuster"]
for tool in tools:
    status = "✓" if is_tool_installed(tool) else "✗"
    print(f"{status} {tool}")

Batch Installation with Progress Tracking

from tool_installer import ToolInstaller
from config import Config
import os

installer = ToolInstaller(api_key=os.getenv("OPENAI_API_KEY"))

# Get all available tools
all_tools = list(Config.TOOLS_INFO.keys())
total = len(all_tools)

# Install with progress
for idx, tool in enumerate(all_tools, 1):
    print(f"\n[{idx}/{total}] Installing {tool}...")
    success = installer.install_tool(tool)
    status = "✓" if success else "✗"
    print(f"{status} {tool} - {'Success' if success else 'Failed'}")

Workflow Examples

AI-Powered Installation (Recommended)

from ai_agent import AIAgent
from tool_installer import ToolInstaller
from config import Config
import os

# 1. Set up AI agent
api_key = os.getenv("OPENAI_API_KEY")
if not api_key:
    print("Warning: No API key set, using offline mode")

installer = ToolInstaller(api_key=api_key)

# 2. AI analyzes environment and generates plan
# 3. Executes installation commands
# 4. Verifies installation
# 5. Records results to tools_config.json

success = installer.install_tool("sqlmap")

Offline Mode (No API Key)

from tool_installer import ToolInstaller

# Works without OPENAI_API_KEY
installer = ToolInstaller()

# Uses predefined installation commands from config.py
installer.install_tool("nmap")

Troubleshooting

AI Query Failures

from ai_agent import AIAgent
import os

agent = AIAgent(api_key=os.getenv("OPENAI_API_KEY"))

# The agent automatically retries 3 times with 2-second intervals
# If all retries fail, it returns None and falls back to predefined plans
plan = agent.get_installation_plan("nmap", tool_info)

if plan is None:
    print("AI unavailable, using predefined installation plan")

Permission Issues

# Linux: Use sudo for system-wide installation
sudo python main.py install nmap

# macOS: Homebrew usually doesn't need sudo
python main.py install nmap

# Check logs for permission errors
tail -f logs/installation_*.log

Network Connection Issues

import subprocess
import os

# Set proxy if needed
os.environ["https_proxy"] = "http://proxy:8080"
os.environ["http_proxy"] = "http://proxy:8080"

# Test connectivity
def test_network():
    try:
        subprocess.run(
            ["curl", "-I", "https://api.openai.com"],
            timeout=5,
            check=True
        )
        return True
    except Exception:
        return False

if not test_network():
    print("Network issue detected, check proxy settings")

Package Manager Issues

# macOS: Update Homebrew
brew update && brew doctor

# Linux: Update APT
sudo apt update && sudo apt upgrade

# Check package manager lock
ps aux | grep -i apt

Viewing Logs

import glob
import os

# Find latest log file
log_files = glob.glob("logs/installation_*.log")
if log_files:
    latest_log = max(log_files, key=os.path.getctime)
    print(f"Latest log: {latest_log}")
    
    # Read last 20 lines
    with open(latest_log, "r") as f:
        lines = f.readlines()
        print("".join(lines[-20:]))

Configuration Files

tools_config.json

Automatically generated file tracking installed tools:

{
  "nmap": {
    "name": "nmap",
    "description": "Network discovery and security audit tool",
    "path": "/usr/local/bin/nmap",
    "installed_at": "2025-01-15T10:30:00",
    "version": "7.94"
  }
}

Custom Installation Plans

# Modify config.py to customize installation behavior
from config import Config

# Add new tool category
Config.TOOLS_INFO["custom_tool"] = {
    "name": "custom_tool",
    "description": "My custom security tool",
    "macos": "brew install custom_tool",
    "linux": "apt install -y custom_tool",
    "windows": "https://custom-tool.com/download",
    "verify_command": "custom_tool --version",
    "category": "Custom Category"
}

Best Practices

  1. Use AI Mode: Set OPENAI_API_KEY for intelligent installation plans
  2. Check Logs: Monitor logs/installation_*.log for detailed diagnostics
  3. Verify Installation: Always check tool versions after installation
  4. Backup Configuration: Save tools_config.json before major changes
  5. Network Stability: Ensure stable connection; the system handles temporary failures
  6. Permission Management: Use sudo only when prompted by the installer
Discovery
Tags

No tags published for this skill.

Version
Latest version metadata

Version

v2026.09.24

Published

Sep 24, 2026

Category

Uncategorized

License

NOASSERTION

Source path

skills/ai2pentesttool-installer

Default branch

main

Latest commit

304c245

Tree SHA

010f47d