| name | ai2pentesttool-installer |
| description | AI-powered one-click installer for 200+ penetration testing and security tools with intelligent retry and error recovery |
| triggers | ["install penetration testing tools","set up pentest environment","install security tools automatically","install nmap sqlmap nikto with AI","batch install pentesting tools","manage pentest tool suite","ai penetration testing installer","automate security tools installation"] |
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
git clone https://github.com/penligent/AI2PentestTool.git
cd AI2PentestTool
pip install -r requirements.txt
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
python main.py show-tools
python main.py list
Install Single Tool
python main.py install nmap
sudo python main.py install sqlmap
Batch Installation
python main.py install-default
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
export OPENAI_API_KEY="sk-..."
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
api_key = os.getenv("OPENAI_API_KEY")
agent = AIAgent(api_key=api_key)
tool_info = Config.TOOLS_INFO["nmap"]
plan = agent.get_installation_plan("nmap", tool_info)
if plan:
print(f"AI Plan: {plan}")
else:
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
api_key = os.getenv("OPENAI_API_KEY")
installer = ToolInstaller(api_key=api_key)
success = installer.install_tool("nmap")
if success:
print("Installation successful!")
tools = ["nmap", "sqlmap", "gobuster"]
for tool in tools:
installer.install_tool(tool)
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
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
installer = ToolInstaller(api_key=os.getenv("OPENAI_API_KEY"))
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"
print("\n=== Installation Summary ===")
for tool, status in results.items():
print(f"{tool}: {status}")
Common Patterns
Creating Custom Tool Lists
tools = ["nmap", "masscan", "sqlmap", "nikto", "gobuster"]
with open("custom_tools.txt", "w") as f:
f.write("\n".join(tools))
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()
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
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"))
all_tools = list(Config.TOOLS_INFO.keys())
total = len(all_tools)
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
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)
success = installer.install_tool("sqlmap")
Offline Mode (No API Key)
from tool_installer import ToolInstaller
installer = ToolInstaller()
installer.install_tool("nmap")
Troubleshooting
AI Query Failures
from ai_agent import AIAgent
import os
agent = AIAgent(api_key=os.getenv("OPENAI_API_KEY"))
plan = agent.get_installation_plan("nmap", tool_info)
if plan is None:
print("AI unavailable, using predefined installation plan")
Permission Issues
sudo python main.py install nmap
python main.py install nmap
tail -f logs/installation_*.log
Network Connection Issues
import subprocess
import os
os.environ["https_proxy"] = "http://proxy:8080"
os.environ["http_proxy"] = "http://proxy:8080"
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
brew update && brew doctor
sudo apt update && sudo apt upgrade
ps aux | grep -i apt
Viewing Logs
import glob
import os
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}")
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
from config import Config
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
- Use AI Mode: Set
OPENAI_API_KEY for intelligent installation plans
- Check Logs: Monitor
logs/installation_*.log for detailed diagnostics
- Verify Installation: Always check tool versions after installation
- Backup Configuration: Save
tools_config.json before major changes
- Network Stability: Ensure stable connection; the system handles temporary failures
- Permission Management: Use sudo only when prompted by the installer