graph TD
A[用户输入目标与意图] --> B[Gemini 意图解析]
B --> C{"规划下一步动作"}
C -->|"信息收集"| D[调用侦察工具集]
C -->|"漏洞验证"| E[调用验证工具集]
C -->|"需要更多上下文"| F[回读历史输出]
D --> G[解析工具输出]
E --> G
F --> G
G --> H[LangChain 记忆与状态更新]
H --> C
C -->|"任务收敛"| I[生成结构化报告]
Guardian is a production-ready AI-powered penetration testing automation CLI tool that leverages Google Gemini and LangChain to orchestrate intelligent, step-by-step penetration testing workflows while maintaining ethical hacking standards.
Guardian is an enterprise-grade AI-powered penetration testing automation framework that combines multiple AI providers (OpenAI GPT-4, Claude, Google Gemini, OpenRouter, Requesty) with battle-tested security tools to deliver intelligent, adaptive security assessments with comprehensive evidence capture.
❌ Illegal Use: Unauthorized access, malicious activities, any form of cyber attack
You are fully responsible for ensuring you have explicit written permission before testing any system. Unauthorized access to computer systems is illegal under laws including the Computer Fraud and Abuse Act (CFAA), GDPR, and equivalent international legislation.
By using Guardian, you agree to use it only on systems you own or have explicit authorization to test.
✨ Features
🤖 Multi-Provider AI Intelligence
7 AI Providers Supported: OpenAI (GPT-4o), Anthropic (Claude), Google (Gemini), OpenRouter, Requesty, Ollama (local), OpenAI-compatible (vLLM, LM Studio, Together, Groq)
Plugin Provider Contract: Third-party providers ship via [project.entry-points."guardian.providers"] — no fork required
Multi-Agent Architecture: Specialized AI agents (Planner, Tool Selector, Analyst, Reporter) plus debate triage roles (Red Advocate, Blue Advocate, Judge) and Visual Triage
Multi-Agent Debate Triage: Three-role red/blue/judge debate on ambiguous findings — F1 ≥ single-agent baseline +5pp
Vision-LLM Visual Triage: Headless screenshot capture + image-grounded analyst enrichment via gpt-4o / Claude 3.5+ / Gemini 1.5+
Guardian supports multiple AI providers. Configure your preferred provider in config/guardian.yaml:
# config/guardian.yaml
ai:
# Choose your provider: openai, claude, gemini, openrouter, or requesty
provider: openai
# OpenAI Configuration (recommended)
openai:
model: gpt-4o
api_key: sk-your-api-key-here # Or set OPENAI_API_KEY env var
# Claude Configuration
claude:
model: claude-3-5-sonnet-20241022
api_key: null # Or set ANTHROPIC_API_KEY env var
# Gemini Configuration
gemini:
model: gemini-2.5-pro
api_key: null # Or set GOOGLE_API_KEY env var
# OpenRouter Configuration
openrouter:
model: anthropic/claude-3.5-sonnet
api_key: null # Or set OPENROUTER_API_KEY env var
# Requesty Configuration (OpenAI-compatible gateway)
requesty:
model: openai/gpt-4o-mini
api_key: null # Or set REQUESTY_API_KEY env var
# Verify installation
python -m cli.main --help
# Check AI provider status
python -m cli.main models
🎯 Quick Start
Basic Commands
# List available workflows
python -m cli.main workflow list
# View AI providers and models
python -m cli.main models
# Run with specific provider
python -m cli.main workflow run --name web_pentest --target example.com --provider openai
Example Usage Scenarios
1. Quick Web Application Pen Test
# Fast security check with evidence capture
python -m cli.main workflow run --name web_pentest --target https://dvwa.csalab.app
Expected Output:
✅ HTTP discovery with httpx
✅ Vulnerability scan with nuclei
✅ Full evidence linking (commands + outputs)
✅ Markdown report with findings
2. Comprehensive Network Assessment
# Full network penetration test
python -m cli.main workflow run --name network --target 192.168.1.0/24
3. Custom Workflow with Parameters
# Run with workflow-specific parameters
# Parameters in workflow YAML override config defaults
python -m cli.main workflow run --name web_pentest --target example.com
Workflow Parameter Priority:
Workflow YAML parameters (highest priority)
Config file parameters
Tool defaults (lowest priority)
4. Generate Report from Session
# Create HTML report with evidence
python -m cli.main report --session 20260203_175905 --format html
5. Switch AI Providers
# Use OpenAI GPT-4
python -m cli.main workflow run --name web_pentest --target example.com --provider openai
# Use Claude
python -m cli.main workflow run --name web_pentest --target example.com --provider claude
# Use Gemini
python -m cli.main workflow run --name web_pentest --target example.com --provider gemini
# Local Ollama (no cloud)
OLLAMA_HOST=http://localhost:11434 python -m cli.main workflow run --name recon --target scanme.nmap.org --provider ollama
# Any OpenAI-compatible endpoint (vLLM, LM Studio, Together, Groq)
python -m cli.main workflow run --name web_pentest --target example.com --provider openai_compatible
# Workflow YAML uses agent: debate on an analysis step
python -m cli.main workflow run --name web_pentest_with_debate --target https://example.com
Three roles (red advocate, blue advocate, judge) debate ambiguous findings only — confident verdicts skip the debate to bound token cost.
8. Visual Triage (vision-LLM)
# Captures full-page screenshots and feeds them to a vision-capable provider
python -m cli.main workflow run --name web_visual_pentest --target https://example.com --provider openai
Requires playwright: pip install playwright && python -m playwright install chromium. Skipped silently when active provider has no vision support.
# Anonymise sessions into JSONL (no raw targets, no commands, no secrets)
python -m cli.main telemetry export ./reports --out telemetry.jsonl
# Train the offline tool ranker
python -m cli.main telemetry train telemetry.jsonl
# Inspect what the ranker learned
python -m cli.main telemetry status
Enable in config:
ai:
use_learned_ranker: true # ToolAgent calls ranker before LLM selector
Windows Users: Use python -m cli.main instead of guardian
🔧 Configuration
Complete Configuration Reference
Edit config/guardian.yaml to customize Guardian’s behavior:
guardian --help startup time stays <500ms despite 50 tools
New CLI surfaces: guardian kb, guardian telemetry
8 new shipped workflows: web_pentest_with_debate, web_visual_pentest, ad_assessment, mobile_android, llm_redteam, sast_review, api_pentest_v2, plus existing v3 workflows
Version 3.0.0 — Hardening + Engine v2
Prompt-injection delimiters (<UNTRUSTED_TOOL_OUTPUT>) on all tool output
DAG scheduler, Pydantic schemas, atomic checkpoints, --resume
11 new wrappers (cloud/container/SBOM/GraphQL/JWT/OSINT)
CVSS v3.1 recomputation + drift detection
Log rotation, key scrub at write time
Confirmation gate wired for active+ tools
Version 2.0.0
Multi-provider AI (OpenAI, Claude, Gemini, OpenRouter, Requesty)
Evidence linking via execution_id
Workflow parameter priority system
🤝 Contributing
We welcome contributions! Here’s how:
Setting Up Development Environment
# Fork and clone
git clone https://github.com/zakirkun/guardian-cli.git
cd guardian-cli
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest tests/
# Format code
black .
Contribution Areas
🤖 AI Provider Integrations - Add more AI models
🛠️ New Tool Integrations - Add more security tools
🔄 Custom Workflows - Share your workflow templates
评论