PenTest MCP Server
🏗️ アーキテクチャ
┌──────────────────────────────────────────────────────────┐
│ $ pentest ask --query "scan for SQLi and XSS" \ │
│ --target http://localhost:3000 --consent │
└──────────────────┬───────────────────────────────────────┘
│ Direct Python execution
▼
┌──────────────────────────────────────────────────────────┐
│ GEMINI-POWERED AGENT (Python) │
│ │
│ Phase 1: PLAN → LLM selects tools from query │
│ Phase 2: EXECUTE → Runs tools, collects findings │
│ Phase 3: REPORT → LLM generates professional report │
│ │
│ ┌─────────────┐ ┌──────────────┐ ┌────────────────┐ │
│ │ Session │ │ Scan Mode │ │ Tool │ │
│ │ Manager │ │ Orchestrator│ │ Registry │ │
│ └─────────────┘ └──────┬───────┘ └────────────────┘ │
│ │ │
│ ┌────────────────┼────────────────┐ │
│ ▼ ▼ ▼ │
│ ┌────────────┐ ┌────────────┐ ┌────────────────┐ │
│ │ nmap │ │ sqlmap │ │ ffuf │ │
│ │ nuclei │ │ dalfox │ │ nikto │ │
│ │ sslyze │ │ commix │ │ gobuster │ │
│ │ wafw00f │ │ arjun │ │ subfinder │ │
│ │ ... 30+ │ │ ... │ │ ... │ │
│ └────────────┘ └────────────┘ └────────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────────────┐ │
│ │ GEMINI API │ │
│ │ (Flash Lite) │ │
│ │ Triage · Analysis │ │
│ │ CVSS · Reporting │ │
│ └──────────────────────┘ │
└──────────────────────────────────────────────────────────┘Related MCP server: Pentest-mcp
✨ 機能
機能 | 説明 |
自然言語インターフェース | 平易な英語でセキュリティの質問をすると、AIが適切なツールを選択して実行します |
3つのスキャンモード | クイック(5-10分)、ミディアム(15-30分)、エクステンシブ(45分以上) — それぞれ異なる深さとAI分析を提供 |
30以上のセキュリティツール | nmap, sqlmap, nuclei, ffuf, dalfox, nikto, wafw00f, subfinder, sslyzeなど |
AI搭載分析 | Gemini AI (Flash Lite) が脆弱性のトリアージ、CVSSスコアリング、エグゼクティブレポートの生成を行います |
自動ツール選択 | LLM主導のツール計画と実行を行う |
セッション管理 | 複数のターゲットにわたるセキュリティ評価の追跡、一時停止、再開 |
OWASP Top 10対応 | OWASP 2021カテゴリにマッピングされた体系的なスキャン |
スマートフォールバック | プロフェッショナルツールがインストールされていない場合、Pythonネイティブの実装が補完します |
📋 目次
🚀 クイックスタート
前提条件
Python 3.11+
uv (Pythonパッケージマネージャー)
Gemini API Key (無料枠あり)
1. クローンとインストール
git clone https://github.com/yourusername/pentest-ai-cli
cd pentest-ai-cli
# Install dependencies
uv sync2. 環境設定
cp .env.example .env.env を編集してGemini APIキーを追加します:
GEMINI_API_KEY=your_gemini_api_key_here3. セキュリティツールのインストール (オプション)
サーバーはPythonネイティブのフォールバックで動作しますが、プロフェッショナルレベルのスキャンには外部ツールのインストールを推奨します:
# macOS (Homebrew)
brew install nmap sqlmap
# Install ffuf (Go-based fuzzer)
go install github.com/ffuf/ffuf/v2@latest
# Install nuclei (vulnerability scanner)
go install github.com/projectdiscovery/nuclei/v3/cmd/nuclei@latest
# Install subfinder (subdomain discovery)
go install github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latestヒント:
session_initを実行して、システムで検出されたツールを確認してください。
4. スキャン開始!
pentest ask \
--query "run a quick security scan" \
--target https://example.com \
--consent🎯 スキャンモード
クイックモード (5-10分)
迅速なリスク評価のための高速トリアージ。
テスト | ツール |
WAF検出 | wafw00f / カスタム |
DNS列挙 | dnsrecon / カスタム |
ポートスキャン (上位20) | nmap / カスタム |
ヘッダー分析 | カスタム |
TLS/SSL監査 | sslyze / カスタム |
技術フィンガープリント | whatweb / カスタム |
機密ファイル探索 | ffuf / カスタム |
ミディアムモード (15-30分)
OWASP Top 10を網羅する標準的なペネトレーションテスト。
テスト | ツール |
クイックモードの全項目 | — |
ポートスキャン (上位100) | nmap |
XSSスキャン | dalfox / カスタム |
SQLインジェクション | sqlmap |
ディレクトリ探索 | ffuf / gobuster |
CORS設定ミス | corscanner / カスタム |
パストラバーサル | カスタム |
オープンリダイレクト | カスタム |
CSRFチェック | カスタム |
エクステンシブモード (45分以上)
経営層向けの包括的なセキュリティ評価。
テスト | ツール |
ミディアムモードの全項目 | — |
ポートスキャン (上位1000) | nmap / masscan |
サブドメイン列挙 | subfinder / amass |
高度なファジング | wfuzz / ffuf |
SSRFプローブ | カスタム |
シークレットスキャン | trufflehog |
Git露出 | git-dumper |
JWT分析 | jwt_tool |
GraphQLセキュリティ | graphql-cop |
コマンドインジェクション | commix |
🔧 サポートされているツール
サーバーは30以上のセキュリティツールを自動検出して統合します。ツールがインストールされていない場合でも、Pythonネイティブのフォールバックによりスキャンが実行されます。
ツール | カテゴリ | 必須 |
nmap | ポートスキャン | オプション (フォールバックあり) |
sqlmap | SQLインジェクション | オプション |
ffuf | ファジング / ファイル探索 | オプション (フォールバックあり) |
nuclei | 脆弱性スキャン | オプション |
dalfox | XSSスキャン | オプション |
subfinder | サブドメイン探索 | オプション |
wafw00f | WAF検出 | オプション (フォールバックあり) |
sslyze | TLS/SSL監査 | オプション (フォールバックあり) |
nikto | Webサーバースキャン | オプション |
gobuster | ディレクトリ総当たり | オプション |
whatweb | 技術フィンガープリント | オプション (フォールバックあり) |
wfuzz | 高度なファジング | オプション |
arjun | 隠しパラメータ探索 | オプション |
testssl | SSL/TLSテスト | オプション |
masscan | 高速ポートスキャン | オプション |
amass | OSINT / サブドメイン列挙 | オプション |
dnsrecon | DNS列挙 | オプション (フォールバックあり) |
theHarvester | メール/ドメインOSINT | オプション |
retire.js | JSライブラリCVEスキャン | オプション |
trufflehog | シークレット検出 | オプション |
git-dumper | Gitリポジトリ露出 | オプション |
commix | コマンドインジェクション | オプション |
corscanner | CORS設定ミス | オプション (フォールバックあり) |
jwt_tool | JWT分析 | オプション |
graphql-cop | GraphQLセキュリティ | オプション |
xsstrike | 高度なXSS | オプション |
hydra | 総当たり攻撃 | オプション |
shodan | インターネットインテリジェンス | オプション |
enum4linux-ng | SMB列挙 | オプション |
💬 使用例
pentest ask コマンドはGemini AIを使用して、自然言語のクエリに基づいてセキュリティスキャンを自動的に計画・実行します。
クイック脆弱性スキャン
pentest ask \
--query "scan for SQL injection and XSS vulnerabilities" \
--target http://localhost:3000 \
--consentOWASP Top 10フル監査
pentest ask \
--query "perform a comprehensive OWASP Top 10 security audit" \
--target https://example.com \
--consent偵察のみ
pentest ask \
--query "enumerate subdomains and check for exposed sensitive files" \
--target example.com \
--consentカスタムレポートパス
pentest ask \
--query "check security headers and TLS configuration" \
--target https://example.com \
--consent \
--output security-audit-2024.md📖 完全なドキュメント: 詳細な使用ガイド、例、トラブルシューティングについては CLI_USAGE_GUIDE.md を参照してください。
📁 プロジェクト構造
pentest-ai/
├── pentest_mcp/
│ ├── scan_modes.py # Quick/Medium/Extensive scan orchestration
│ ├── agent.py # Standalone CLI orchestrator
│ ├── session.py # Session state management
│ ├── models.py # Pydantic data models
│ ├── config.py # Environment & settings
│ ├── cli.py # CLI interface (includes "ask" command)
│ ├── cli_ui.py # Beautiful CLI UI components
│ ├── tools/
│ │ ├── __init__.py # Python-native security tools
│ │ ├── professional.py # External tool wrappers (nmap, sqlmap, etc.)
│ │ └── tool_registry.py # Tool execution and result processing
│ └── utils/
│ └── sanitizer.py # Input validation & sanitization
├── tests/
│ └── test_system.py # System tests
├── wordlists/ # Fuzzing wordlists for ffuf/gobuster
├── reports/ # Generated scan reports (Markdown)
├── CLI_USAGE_GUIDE.md # Example prompts and detailed usage guide
├── pyproject.toml # Project dependencies & metadata
├── Makefile # Development shortcuts
├── install_tools.sh # Security tool installer script
└── .env.example # Environment variable template⚙️ 設定
環境変数
変数 | 説明 | デフォルト |
| Gemini APIキー | 必須 |
| 分析用LLMモデル |
|
| 最大応答トークン数 |
|
| LLM温度パラメータ |
|
| セッション保存パス |
|
| ログ出力レベル |
|
|
|
|
AI分析パイプライン
各スキャンモードは、スキャンの深さに合わせて調整された 個別のGemini AIプロンプト を使用します:
クイック: 簡潔なトリアージ — 重大/高リスクの発見事項のみに焦点を当てます
ミディアム: バランスの取れたリスク評価と修正案を含むOWASP Top 10分析
エクステンシブ: CVSSスコア付きの網羅的な発見事項、コンプライアンスマッピング、戦略的推奨事項を含む経営層向けエグゼクティブサマリー
🔍 トラブルシューティング
Read-only file system エラー
レポートは <project_root>/reports/ に保存されます。プロジェクトディレクトリに書き込み権限があることを確認してください。
Gemini APIエラー
APIキーを確認してください:
echo $GEMINI_API_KEYaistudio.google.com でレート制限を確認してください
Geminiが利用できない場合でも、サーバーはスキャンを継続し、生のツール出力を返します
ツールが検出されない
Homebrewやパッケージマネージャーを使用して不足しているツールをインストールしてください。Pythonのフォールバック機能により、外部ツールがなくてもコア機能はカバーされます。
⚠️ セキュリティ上の注意
本ツールは許可されたセキュリティテスト専用です。
ターゲットをスキャンする前に、必ず 明示的な書面による許可 を取得してください
無許可のテストは、コンピュータ不正アクセス禁止法 (CFAA)、IT法 (2000/2008)、および世界中の同様の法律に違反します
consent_confirmedパラメータは倫理的な保護措置として存在します。決してバイパスしないでくださいAPIキーをバージョン管理にコミットしないでください
📝 ライセンス
詳細は LICENSE を参照してください。
Available Tools
29 toolsamassD
Advanced subdomain enumeration
Inputs: domain (required), session_id (required).
arjunD
HTTP parameter discovery
Inputs: url (required), session_id (required).
commixC
Command injection vulnerability scanner
Inputs: url (required), session_id (required).
corscannerC
CORS misconfiguration scanner
Inputs: url (required), session_id (required).
dalfoxD
XSS vulnerability scanner
Inputs: url (required), session_id (required), params, consent.
dnsreconC
DNS enumeration and reconnaissance
Inputs: domain (required), session_id (required).
extensive_scanA
Comprehensive scan (20-45 min): WAF detection, full recon, top-1000 port scan, tech fingerprinting, TLS audit, directory discovery, XSS, SQLi, CSRF, sensitive file discovery
Inputs: target (required), consent (required).
ffufC
Fast web fuzzer for directory/file discovery
Inputs: url (required), session_id (required), mode, consent.
get_reportC
Generate final security assessment report
Inputs: session_id (required).
git_dumperC
Exposed .git directory dumper
Inputs: url (required), session_id (required).
gobusterC
Directory/file brute forcing
Inputs: url (required), session_id (required), mode.
graphql_copC
GraphQL security scanner
Inputs: url (required), session_id (required).
init_sessionC
Initialize new security assessment session
Inputs: target (required).
jwt_toolC
JWT security testing
Inputs: token (required), session_id (required), url.
masscanC
Fast port scanner
Inputs: target (required), session_id (required), ports.
niktoC
Web server vulnerability scanner
Inputs: url (required), session_id (required), consent.
nmapC
Port scanning and service detection
Inputs: host (required), session_id (required), ports, consent.
nucleiC
Fast vulnerability scanner with templates
Inputs: url (required), session_id (required).
quick_scanB
Fast triage scan (10-15 min): WAF detection, subdomain enum, top-port scan, header analysis, TLS audit, tech fingerprinting, sensitive file discovery, SSRF probe, CSRF check
Inputs: target (required), consent (required).
retireC
JavaScript library vulnerability scanner
Inputs: url (required), session_id (required).
sqlmapC
SQL injection detection and exploitation
Inputs: url (required), session_id (required), params, consent.
sslyzeC
TLS/SSL configuration analyzer
Inputs: host (required), session_id (required), port, consent.
subfinderC
Passive subdomain enumeration
Inputs: domain (required), session_id (required), consent.
testsslC
TLS/SSL security testing
Inputs: host (required), session_id (required), port.
theharvesterD
OSINT gathering from public sources
Inputs: domain (required), session_id (required).
trufflehogC
Secret and credential scanner
Inputs: target (required), session_id (required), scan_type.
wafw00fD
Web Application Firewall detection
Inputs: url (required), session_id (required).
wfuzzC
Web application fuzzer
Inputs: url (required), session_id (required), fuzz_param.
whatwebC
Web technology fingerprinting
Inputs: url (required), session_id (required), consent.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 29 tools
Most tools have distinct purposes (e.g., sqlmap vs nmap), but some overlap exists between masscan and nmap for port scanning, and multiple fuzzing tools like ffuf, wfuzz, and gobuster may cause confusion for an agent. Descriptions help differentiate but are not entirely unambiguous.
Tool names are consistently lowercase with underscores for multi-word names, but they do not follow a strict verb_noun pattern. Some are single words (e.g., amass, nikto) while others are compound (e.g., git_dumper, jwt_tool), which is consistent but not highly patterned.
With 29 tools, the server covers a broad range of penetration testing tasks, which is appropriate for a comprehensive tool set. While on the higher end, the count is justified by the diversity of functionality and does not feel excessive.
The tool set covers most key areas of penetration testing: reconnaissance, scanning, web fuzzing, vulnerability detection, and reporting. However, it lacks network vulnerability scanners (e.g., OpenVAS) and exploitation tools, leaving minor gaps. The inclusion of quick_scan and extensive_scan helps cover comprehensive workflows.
Maintenance
Related MCP Connectors
AI pentesting: run scans, triage vulnerabilities, review PRs, manage schedules and assets.
Governed security assessments, findings and signed reports for your domains, from your AI agent.
Pay-per-call cybersecurity for AI agents: vuln scans, threat intel, compliance, code security.
Security scanner for AI agents and MCP servers: injection, jailbreak, tool abuse.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceAn MCP server that integrates various penetration testing tools, enabling security professionals to perform reconnaissance, vulnerability scanning, and API testing through natural language commands in compatible LLM clients like Claude Desktop.7-
- FlicenseNot gradedqualityDmaintenanceUnified penetration testing MCP server for Claude Desktop providing 34 security tools for reconnaissance, web scanning, code analysis, and authenticated testing.1-
- FlicenseNot gradedqualityDmaintenanceAI-powered Attack Surface Intelligence server that exposes industry-standard penetration testing tools via MCP, enabling AI agents to perform comprehensive security assessments.3-
- AlicenseNot gradedqualityDmaintenanceAI-driven penetration testing MCP server that equips Claude with 13 tools for automated reconnaissance, analysis, vulnerability validation, and exploitation.4GPL 3.0