| name | guardian-cli-ai-pentest |
| description | AI-powered penetration testing automation CLI using Google Gemini, Claude, or GPT-4 with LangChain for intelligent security assessments |
| triggers | ["set up Guardian penetration testing framework","run an AI-powered security scan with Guardian","configure Guardian with multiple AI providers","create a custom Guardian workflow for pentesting","automate vulnerability scanning with Guardian","generate penetration test reports using Guardian","integrate security tools with Guardian AI","troubleshoot Guardian pentest automation"] |
Guardian CLI - AI-Powered Penetration Testing
Skill by ara.so — Devtools Skills collection.
Guardian is an enterprise-grade AI-powered penetration testing automation framework that combines multiple AI providers (OpenAI GPT-4, Claude, Google Gemini, OpenRouter) with 19+ security tools to deliver intelligent, adaptive security assessments with comprehensive evidence capture.
Installation
Prerequisites
- Python 3.11 or higher
- AI Provider API Key (OpenAI, Anthropic, Google AI Studio, or OpenRouter)
- Git
Basic Installation
git clone https://github.com/zakirkun/guardian-cli.git
cd guardian-cli
python3 -m venv venv
source venv/bin/activate
pip install -e .
Verify Installation
python -m cli.main --help
python -m cli.main models
python -m cli.main workflow list
Configuration
AI Provider Setup
Guardian supports four AI providers. Configure in config/guardian.yaml:
ai:
provider: openai
openai:
model: gpt-4o
api_key: ${OPENAI_API_KEY}
claude:
model: claude-3-5-sonnet-20241022
api_key: ${ANTHROPIC_API_KEY}
gemini:
model: gemini-2.5-pro
api_key: ${GOOGLE_API_KEY}
openrouter:
model: anthropic/claude-3.5-sonnet
api_key: ${OPENROUTER_API_KEY}
temperature: 0.2
max_tokens: 8000
Environment Variables
export OPENAI_API_KEY="sk-your-key-here"
export ANTHROPIC_API_KEY="sk-ant-your-key-here"
export GOOGLE_API_KEY="your-gemini-key"
export OPENROUTER_API_KEY="your-openrouter-key"
Complete Configuration
ai:
provider: openai
temperature: 0.2
max_tokens: 8000
pentest:
safe_mode: true
require_confirmation: true
max_parallel_tools: 3
max_depth: 3
tool_timeout: 300
output:
format: markdown
save_path: ./reports
include_reasoning: true
verbosity: normal
scope:
blacklist:
- 127.0.0.0/8
- 10.0.0.0/8
- 172.16.0.0/12
- 192.168.0
[, , ]
Key Commands
Workflow Management
python -m cli.main workflow list
python -m cli.main workflow run --name web_pentest --target example.com
python -m cli.main workflow run --name web_pentest --target example.com --provider claude
python -m cli.main workflow run --name network --target 192.168.1.0/24
python -m cli.main workflow run --name recon --target example.com
python -m cli.main workflow run --name autonomous --target example.com
Report Generation
python -m cli.main report --session 20260203_175905 --format markdown
python -m cli.main report --session 20260203_175905 --format html
python -m cli.main report --session 20260203_175905 --format json
python -m cli.main sessions list
AI Provider Commands
python -m cli.main models
python -m cli.main test-ai --provider openai
python -m cli.main workflow run --name web_pentest --target example.com --provider gemini
Custom Workflows
Creating a Custom Workflow
Create a YAML file in workflows/custom/:
name: API Security Assessment
description: Comprehensive API penetration testing
category: custom
parameters:
httpx:
threads: 100
timeout: 15
nuclei:
severity: ["critical", "high"]
tags: ["api", "auth", "injection"]
steps:
- name: API Discovery
tools:
- httpx
- whatweb
ai_instructions: |
Discover all API endpoints and identify authentication mechanisms.
Focus on REST, GraphQL, and SOAP endpoints.
- name: Authentication Testing
tools:
- nuclei
- arjun
ai_instructions: |
Test authentication endpoints for common vulnerabilities:
- Broken authentication
- JWT vulnerabilities
- API key exposure
-
Using Custom Workflows
python -m cli.main workflow run --name api_security --target https://api.example.com
Custom Tools Integration
Creating a Custom Tool
Create a Python file in tools/custom/:
from typing import Dict, Any, List
from tools.base import BaseTool
class CustomScanner(BaseTool):
"""Custom security scanner tool."""
name = "custom_scanner"
description = "Custom security scanning tool"
category = "vulnerability"
def __init__(self):
super().__init__()
self.capabilities = [
"scan_endpoint",
"detect_vulnerabilities",
"generate_report"
]
async def execute(
self,
target: str,
options: Dict[str, Any] = None
) -> Dict[str, Any]:
"""
Execute the custom scanner.
Args:
target: Target URL or IP
options: Scanner options
Returns:
Dict containing scan results
"""
options = options or {}
cmd = [
"custom-scanner",
"--target", target
]
if options.get("deep_scan"):
cmd.append("--deep")
options.get():
cmd.extend([, (options[])])
result = ._run_command(cmd)
findings = ._parse_output(result.get(, ))
{
: result.get() == ,
: findings,
: result.get(),
: .join(cmd)
}
() -> [[, ]]:
findings = []
line output.split():
line:
findings.append({
: ,
: line.strip(),
: ,
: line
})
findings
() -> :
._check_command_exists()
Registering Custom Tools
from tools.custom.custom_scanner import CustomScanner
CUSTOM_TOOLS = {
"custom_scanner": CustomScanner
}
Common Usage Patterns
Web Application Penetration Test
python -m cli.main workflow run \
--name web_pentest \
--target https://testsite.example.com \
--provider openai
Network Infrastructure Assessment
python -m cli.main workflow run \
--name network \
--target 192.168.1.0/24 \
--provider claude
Subdomain Enumeration and Scanning
python -m cli.main workflow run \
--name recon \
--target example.com \
--provider gemini
Autonomous AI-Driven Pentest
python -m cli.main workflow run \
--name autonomous \
--target example.com \
--provider openai
Python API Usage
Programmatic Workflow Execution
import asyncio
from guardian.core.orchestrator import Orchestrator
from guardian.core.config import Config
async def run_pentest():
"""Run programmatic penetration test."""
config = Config.load("config/guardian.yaml")
orchestrator = Orchestrator(config)
target = "https://example.com"
workflow_name = "web_pentest"
results = await orchestrator.run_workflow(
workflow_name=workflow_name,
target=target,
options={
"provider": "openai",
"safe_mode": True,
"max_depth": 2
}
)
print(f"Scan completed: {results['session_id']}")
print(f"Findings: {len(results['findings'])}")
for finding in results['findings']:
print(f"[{finding['severity']}] {finding['title']}")
print(f" Tool: {finding['tool']}")
()
asyncio.run(run_pentest())
Custom AI Agent Implementation
from langchain.agents import AgentExecutor
from langchain_openai import ChatOpenAI
from guardian.agents.planner import PlannerAgent
from guardian.agents.analyzer import AnalyzerAgent
async def create_custom_agent():
"""Create custom AI agent for security analysis."""
llm = ChatOpenAI(
model="gpt-4o",
temperature=0.2,
api_key="${OPENAI_API_KEY}"
)
planner = PlannerAgent(llm=llm)
analyzer = AnalyzerAgent(llm=llm)
target = "https://example.com"
plan = await planner.create_plan(
target=target,
scope=["web", "api"],
available_tools=["httpx", "nuclei", "sqlmap"]
)
print("Generated Plan:")
for step in plan.steps:
print(f"- {step.name}: {step.tools}")
findings = [
{
"severity": "high",
"title": "SQL Injection Found",
"tool": "sqlmap",
"evidence": "Parameter 'id' is vulnerable"
}
]
analysis = analyzer.analyze_findings(findings)
()
asyncio.run(create_custom_agent())
Tool Integration Example
from tools.registry import ToolRegistry
from guardian.core.executor import ToolExecutor
async def execute_custom_scan():
"""Execute tools programmatically."""
registry = ToolRegistry()
httpx_tool = registry.get_tool("httpx")
executor = ToolExecutor(timeout=300)
result = await executor.execute_tool(
tool=httpx_tool,
target="https://example.com",
options={
"threads": 50,
"tech_detect": True,
"status_code": True
}
)
if result["success"]:
print(f"Command: {result['command']}")
print(f"Output:\n{result['output']}")
for finding in result.get("findings", []):
print(f"Finding: {finding['title']}")
else:
print(f"Error: {result.get('error')}")
asyncio.run(execute_custom_scan())
Report Generation
Generate Reports Programmatically
from guardian.reporting.generator import ReportGenerator
from guardian.core.session import SessionManager
async def generate_custom_report():
"""Generate pentest report programmatically."""
session_mgr = SessionManager()
session_id = "20260203_175905"
session_data = session_mgr.load_session(session_id)
report_gen = ReportGenerator()
markdown_report = report_gen.generate(
session_data=session_data,
format="markdown",
options={
"include_evidence": True,
"include_reasoning": True,
"severity_threshold": "medium"
}
)
output_path = f"reports/{session_id}_report.md"
with open(output_path, "w") as f:
f.write(markdown_report)
print(f"Report saved to: {output_path}")
html_report = report_gen.generate(
session_data=session_data,
format="html",
options={
"include_evidence": True,
"template": "professional"
}
)
html_path = f"reports/{session_id}_report.html"
with (html_path, ) f:
f.write(html_report)
()
asyncio.run(generate_custom_report())
Troubleshooting
AI Provider Issues
echo $OPENAI_API_KEY
cat config/guardian.yaml | grep api_key
python -m cli.main test-ai --provider openai
Tool Not Found Errors
python -m cli.main tools list
sudo apt install nmap
brew install nmap
choco install nmap
Workflow Parameter Priority
parameters:
httpx:
threads: 200
timeout: 5
Session and Report Issues
python -m cli.main sessions list
python -m cli.main sessions show --id 20260203_175905
python -m cli.main sessions cleanup --days 30
Permission and Scope Errors
scope:
blacklist:
- 127.0.0.0/8
- 10.0.0.0/8
- 172.16.0.0/12
- 192.168.0.0/16
whitelist:
- 192.168.1.100/32
Performance Optimization
pentest:
max_parallel_tools: 5
tool_timeout: 600
tools:
httpx:
threads: 100
rate_limit: 150
nuclei:
bulk_size: 50
rate_limit: 150
Debug Mode
python -m cli.main workflow run \
--name web_pentest \
--target example.com \
--verbosity debug
tail -f logs/guardian.log
output:
include_reasoning: true
verbosity: debug
Common Error Messages
pentest:
max_parallel_tools: 2
request_delay: 1
tools:
nmap:
timeout: 900
export OPENAI_API_KEY="sk-new-key-here"
python -m cli.main test-ai --provider openai