
Vollständige Suite für Credential-Angriffe für autorisierte Sicherheitstests — SSH, FTP, Web-Login, Brute-Force, Wörterbuchangriffe
# CredAttack — Toolkit für Credential-Angriffe
<p align="center">
<img src="https://img.shields.io/badge/release-v1.3.0-brightgreen?style=for-the-badge" alt="Release">
<img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue?style=for-the-badge&logo=python" alt="Python">
<img src="https://img.shields.io/badge/protocols-17-orange?style=for-the-badge" alt="Protocols">
<img src="https://img.shields.io/badge/tests-passing-success?style=for-the-badge&logo=pytest" alt="Tests">
<img src="https://img.shields.io/badge/license-SEE--LICENSE-lightgrey?style=for-the-badge" alt="License">
</p>
> **⚠️ RECHTSHINWEIS — NUR für autorisierte Sicherheitstests.**
> Die Verwendung dieses Tools gegen Systeme, die Sie nicht besitzen oder für die Sie keine **ausdrückliche schriftliche Genehmigung** zum Testen haben, ist nach dem Computer Fraud and Abuse Act (USA), dem Computer Misuse Act (UK) und entsprechenden Gesetzen weltweit illegal. Siehe [SECURITY.md](https://github.com/amibhai/credential-attacks-toolkit/blob/main/SECURITY.md).
---
## Inhaltsverzeichnis
- [Was ist CredAttack?](#was-ist-credattack)
- [Angriffsmodi](#angriffsmodi)
- [Unterstützte Protokolle](#unterstützte-protokolle)
- [Architektur](#architektur)
- [Schnellstart](#schnellstart)
- [Installation](#installation)
- [CLI-Referenz](#cli-referenz)
- [Passwort-Mutations-Engine](#passwort-mutations-engine)
- [Datenbank für Standard-Anmeldedaten](#datenbank-für-standard-anmeldedaten)
- [Proxy-Rotation](#proxy-rotation)
- [HTML-Berichte](#html-berichte)
- [Konfiguration & Umgebungsvariablen](#konfiguration--umgebungsvariablen)
- [Docker](#docker)
- [Tests](#tests)
- [Projektstruktur](#projektstruktur)
- [Mitwirken](#mitwirken)
---
## Was ist CredAttack?
CredAttack ist eine **modulare, produktionsreife Suite für Credential-Tests** für autorisierte Penetrationstest-Einsätze. Sie deckt den gesamten Lebenszyklus von Credential-Angriffen ab:
| Phase | CredAttack-Fähigkeit |
|-------|----------------------|
| **Aufklärung** | Standard-Anmeldedaten-DB (200+ Paare), intelligente benutzernamebasierte Mustererzeugung |
| **Angriff** | 17 Protokoll-Angreifer, 6 Angriffsmodi, Multi-Target-Kampagnen |
| **Umgehung** | Lockout-Erkennung, konfigurierbares Rate-Limiting, Jitter, Proxy-Rotation |
| **Berichterstattung** | JSONL-Audit-Log, Jinja2-HTML-Bericht, Banner + Datei-Dump für gefundene Anmeldedaten |
---
## Angriffsmodi
| Modus | Befehl | Beschreibung |
|-------|--------|--------------|
| **Wörterbuch** | `ssh`, `ftp`, `smb`, … | Wortliste gegen einen Benutzer |
| **Spray** | `spray` | Ein Passwort über eine Benutzerliste (lockout-sicher) |
| **Kombination** | `combo` | Jeder Benutzer × jedes Passwort |
| **Smart** | `smart` | Benutzer-/Firmenbasierte Mustererzeugung |
| **Standardwerte** | `defaults` | 200+ bekannte Dienst-Standardwerte ausprobieren |
| **Multi-Target** | `multi` | Gleicher Angriff über eine Liste von Hosts |
| **Vollständige Pipeline** | `full` | Alle Protokolle, ein Bericht |
---
## Unterstützte Protokolle
| # | Protokoll | Modul | Standard-Port | Hinweise |
|---|-----------|-------|---------------|----------|
| 1 | SSH | `ssh.py` | 22 | paramiko, Schlüssel-/Passwort-Authentifizierung |
| 2 | FTP | `ftp.py` | 21 | Aktiver & passiver Modus |
| 3 | HTTP-Formular | `http_form.py` | 80/443 | Automatische CSRF-Token-Erkennung |
| 4 | HTTP Basic | `http_basic.py` | 80 | RFC 7617 |
| 5 | HTTP Digest | `http_digest.py` | 80 | RFC 7616 |
| 6 | SMB | `smb.py` | 445 | impacket, NTLM |
| 7 | RDP | `rdp.py` | 3389 | impacket NLA |
| 8 | SMTP | `smtp.py` | 587 | STARTTLS |
| 9 | POP3 | `pop3.py` | 110 | APOP-Unterstützung |
| 10 | IMAP | `imap.py` | 143 | STARTTLS |
| 11 | MySQL | `mysql.py` | 3306 | mysql-connector-python |
| 12 | MSSQL | `mssql.py` | 1433 | pymssql |
| 13 | Redis | `redis_proto.py` | 6379 | AUTH-Befehl |
| 14 | MongoDB | `mongodb.py` | 27017 | pymongo |
| 15 | WinRM | `winrm.py` | 5985 | NTLM, pywinrm |
| 16 | LDAP | `ldap_proto.py` | 389 | ldap3, rootDSE-Auto-Erkennung |
| 17 | Telnet | `telnet.py` | 23 | Raw TCP |
| 18 | VNC | `vnc.py` | 5900 | Raw-DES-Challenge-Response |
---
## Architektur
```
credattack.py ← dünner Shim: `python credattack.py ...` aus einem Checkout
│
├── credattack/cli.py ← CLI (Typer) — 8 Unterbefehle für Angriffsmodi; auch das
│ `credattack`-Konsolenskript bei pip-Installation
├── credattack/core/
│ ├── config.py ← Pydantic-v2-Einstellungen, CREDATTACK_*-Env-Var-Overrides
│ ├── engine.py ← AttackEngine (ThreadPoolExecutor + Rich-Fortschritts-UI)
│ ├── lockout.py ← LockoutDetector (gleitendes Fenster, threadsicher)
│ ├── proxy.py ← ProxyRotator (Round-Robin, Health-Check, Herabstufung)
│ ├── mutator.py ← PasswordMutator (Leetspeak, saisonal, Suffix, Tastaturlauf…)
│ ├── result.py ← AttemptResult- + SessionReport-Dataclasses
│ ├── report.py ← Jinja2-HTML-Berichtsgenerator
│ └── logger.py ← Rich-Logging + JSONL-Audit-Writer
│
├── credattack/protocols/
│ └── *.py ← 18 ProtocolAttacker-Implementierungen
│
├── credattack/data/
│ ├── default_creds.json ← 200+ echte Standard-Anmeldedaten-Paare
│ ├── smart_patterns.json ← 140+ Enterprise-Passwortvorlagen
│ └── wordlists/ ← Standard-Passwortlisten pro Dienst
│
└── tests/ ← 50+ pytest-Tests (Unit + Protokoll-Mocks)
```
---
## Schnellstart
```bash
# Klonen und einrichten
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
# Version prüfen
python credattack.py --version
# Trockenlauf (keine Verbindungen — Wortlisten verifizieren)
python credattack.py ssh -t 192.168.1.100 -u admin -P wordlists/common_passwords.txt --dry-run
# Echter SSH-Wörterbuchangriff
python credattack.py ssh -t 192.168.1.100 -u admin -P /path/to/rockyou.txt
# Passwort-Spray (ratenbegrenzt, lockout-sicher)
python credattack.py spray -t 192.168.1.100 --protocol ssh -U users.txt -p "Summer2024!" --delay 30
# Smart-Modus — Muster aus Benutzername + Firma erzeugen
python credattack.py smart -t 192.168.1.100 --protocol ssh -u john.doe --company ACME
# Dienst-Standardwerte ausprobieren
python credattack.py defaults -t 192.168.1.100 --protocol mysql
# Multi-Target-Kampagne
python credattack.py multi --targets hosts.txt --protocol ssh -U users.txt -P passes.txt
```
---
## Installation
### Option A — pip + virtualenv (empfohlen)
```bash
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install --upgrade pip
pip install -r requirements.txt
```
### Option B — Makefile-Verknüpfungen
```bash
make install # Kern-Abhängigkeiten
make install-dev # + pytest-cov, ruff, mypy
```
### Option C — pip-Installation (editierbar oder aus einem Wheel)
```bash
pip install -e . # nur Kern-Abhängigkeiten
pip install -e .[full] # + SMB/RDP/MySQL/MSSQL/Redis/MongoDB/WinRM/LDAP
pip install -e .[dev] # + pytest/ruff/mypy
credattack --version # Konsolenskript, entspricht `python credattack.py`
```
### Option D — Docker
```bash
docker build -t credattack -f docker/Dockerfile .
docker run --rm credattack --help
# Wortlisten einbinden und Ausgabe sammeln
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-Referenz
### Globale Optionen
```
python credattack.py [OPTIONS] COMMAND [ARGS]...
Options:
-V, --version Version anzeigen und beenden.
--help Hilfe anzeigen.
```
### Gemeinsame Flags (verfügbar bei allen Protokoll-Befehlen)
| Flag | Kurzform | Standard | Beschreibung |
|------|----------|----------|--------------|
| `--target` | `-t` | — | Ziel-Host / IP |
| `--port` | | 0 (Proto-Standard) | TCP-Port überschreiben |
| `--username` | `-u` | — | Einzelner Benutzername |
| `--user-file` | `-U` | — | Datei mit zeilenweise getrennten Benutzernamen |
| `--pass-file` | `-P` | — | Datei mit zeilenweise getrennten Passwörtern |
| `--password` | `-p2` | — | Einzelnes Passwort |
| `--threads` | `-n` | 10 | Parallele Worker |
| `--timeout` | `-T` | 5.0 | Timeout pro Versuch (s) |
| `--delay` | `-d` | 0.0 | Feste Verzögerung zwischen Versuchen (s) |
| `--jitter` | | 0.0 | Maximaler zufälliger Jitter (s) |
| `--stop-on-first` | | True | Pro Benutzer nach erstem Treffer stoppen |
| `--proxy-file` | | None | HTTP/SOCKS5-Proxy-Liste |
| `--output-dir` | `-o` | `./output` | Ergebnisverzeichnis |
| `--verbosity` | `-v` | 1 | Protokollierungsstufe (0-3) |
| `--dry-run` | | False | Paare zählen ohne Verbindung |
### Unterbefehle
```bash
# Protokollspezifisch (jeder ist einem dedizierten Angreifer zugeordnet)
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 (Formular / Basic / Digest)
python credattack.py http -t http://target/login --mode form \
--form-user-field username --form-pass-field password --success-string "Dashboard"
# Spray — ein Passwort, viele Benutzer, lange Verzögerung
python credattack.py spray -t HOST --protocol ssh -U users.txt -p "Password1" --delay 30
# Kombination — kartesisches Produkt Benutzer × Passwörter
python credattack.py combo -t HOST --protocol smb -U users.txt -P passes.txt
# Smart — OSINT-basierte Erzeugung
python credattack.py smart -t HOST --protocol ssh -u firstname.lastname --company TargetCorp
# Standardwerte — Hersteller-Standard-Anmeldedaten ausprobieren
python credattack.py defaults -t HOST --protocol mysql
# Multi — gleicher Angriff über mehrere Hosts
python credattack.py multi --targets hosts.txt --protocol ssh -U users.txt -P passes.txt
# Full — alle Protokolle in Sequenz
python credattack.py full -t HOST -U users.txt -P passes.txt
```
---
## Passwort-Mutations-Engine
`PasswordMutator` in `credattack/core/mutator.py` unterstützt kombinierbare Strategien:
| Strategie | Methode | Beispiel-Ausgabe |
|-----------|---------|------------------|
| Leetspeak | `leet_speak(word)` | `p@ssw0rd`, `p455w0rd` |
| Großschreibung | `capitalise_variants(word)` | `PASSWORD`, `Password`, `pAsSwOrD` |
| Suffix | `suffix_append(word)` | `password123`, `password@2025` |
| Präfix | `prefix_append(word)` | `!password`, `mypassword` |
| Tastaturlauf | `keyboard_walk(word)` | `qassword` (a→q) |
| Benutzermuster | `username_patterns(user, company)` | `john123`, `Doe1!`, `ACME2024!` |
| **Saisonal** (v1.1) | `seasonal_patterns(company)` | `Summer2024!`, `Winter25` |
| **Sonderzeichen-Umhüllung** (v1.1) | `special_char_wrap(word)` | `!@Password`, `Password!@` |
| Kombinieren | `combine(word, strategies)` | verknüpft beliebige der obigen |
| Smart (All-in-One) | `smart_generate(user, company)` | deduplizierter, begrenzter Stream |
```python
from credattack.core.mutator import PasswordMutator
m = PasswordMutator(max_mutations=5000)
# Alle Strategien kombiniert
for pw in m.smart_generate("john.doe", company="ACME"):
print(pw)
# Nur saisonale Muster
for pw in m.seasonal_patterns(company="Contoso"):
print(pw)
```
---
## Datenbank für Standard-Anmeldedaten
`credattack/data/default_creds.json` enthält **200+ echte Standard-Anmeldedaten-Paare** über:
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
```bash
# Alle Standardwerte für einen Dienst anzeigen
python credattack.py defaults -t HOST --protocol mysql --dry-run
# Gegen Ziel ausführen
python credattack.py defaults -t 10.0.0.1 --protocol ssh
```
---
## Proxy-Rotation
Eine Proxy-Datei übergeben (ein Proxy pro Zeile, Format `host:port`):
```
# proxies.txt
192.168.1.10:1080
192.168.1.11:1080
socks5://10.0.0.5:9050
```
```bash
python credattack.py ssh -t TARGET -u admin -P passes.txt --proxy-file proxies.txt
```
Der `ProxyRotator` führt beim Start Health-Checks durch und stuft Proxys herab, die einen Fehlerraten-Schwellenwert überschreiten. Tote Proxys werden automatisch ausgeschlossen.
---
## HTML-Berichte
Nach jedem Nicht-Trockenlauf-Angriff wird automatisch ein HTML-Bericht in `./output/` erzeugt:
- **Statistik-Karten**: Gesamtversuche, Erfolgsrate, Dauer, Versuche/Sekunde
- **Tabelle gefundener Anmeldedaten**: Host · Protokoll · Benutzername · Passwort (in Zwischenablage kopierbar)
- **Dunkles Theme**-Jinja2-Vorlage
```bash
# Nach einem Lauf öffnen
start output/report_*.html # Windows
open output/report_*.html # macOS
```
---
## Konfiguration & Umgebungsvariablen
Alle Einstellungen in `credattack/core/config.py` können über `CREDATTACK_*`-Umgebungsvariablen überschrieben werden:
```bash
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
```
Oder auf CLI-Ebene mit den Standard-Flags (`--threads`, `--timeout`, usw.).
---
## Docker
```bash
# Image erstellen
docker build -t credattack -f docker/Dockerfile .
# Mit Docker Compose ausführen
cd docker
docker compose run credattack ssh -t 192.168.1.100 -u admin -P /app/wordlists/common_passwords.txt
# Konfiguration über Umgebung setzen
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
```
---
## Tests
```bash
# Alle Tests ausführen
pytest -q
# Mit Abdeckung
pytest --cov=credattack --cov-report=term-missing -q
# Makefile-Verknüpfung
make test-cov
```
**Aktuelle Suite: 50+ Tests**, die Folgendes abdecken:
| Bereich | Tests |
|---------|-------|
| Lockout-Erkennung (gleitendes Fenster, Thread-Sicherheit) | `test_lockout.py` |
| Passwort-Mutator-Strategien | `test_mutator.py` |
| Neue Mutator-Strategien (saisonal, Sonderzeichen) | `test_mutator_extended.py` |
| Proxy-Rotator (Health-Check, Herabstufung) | `test_proxy.py` |
| Result- & SessionReport-Dataclasses | `test_result.py` |
| SSH-Protokoll-Mock | `test_protocols_ssh.py` |
| FTP-Protokoll-Mock | `test_protocols_ftp.py` |
| HTTP-Basic- & Digest-Mocks | `test_protocols_http.py` |
---
## Wortlisten
> **⚠️ Die gebündelten `wordlists/`-Dateien sind minimale Smoke-Test-Stubs.** Für echte Bewertungen eigene Listen bereitstellen.
### Empfohlene Quellen
| Wortliste | Größe | Am besten geeignet für |
|-----------|-------|------------------------|
| `rockyou.txt` | ~14 M | Allgemeines Wörterbuch |
| `SecLists/Passwords/` | Verschieden | Protokollspezifisch |
| `kaonashi.txt` | ~64 M | Erweiterte Abdeckung |
| OSINT-basiert | Variabel | Gezielte Angriffe |
```bash
# Beliebige externe Wortliste verwenden
python credattack.py ssh -t TARGET -u admin -P /opt/wordlists/rockyou.txt
```
---
## Projektstruktur
```
credential-attacks-toolkit/
├── credattack.py # Dünner Shim -> credattack.cli:app (Quellcode-Checkout-Nutzung)
├── pyproject.toml # PEP 517/518-Build- & Tool-Konfiguration
├── requirements.txt # Laufzeit-Abhängigkeiten
├── Makefile # Entwickler-Verknüpfungen
├── VERSION # Einzige Quelle der Versionswahrheit
├── CHANGELOG.md
├── SECURITY.md
├── .github/
│ └── workflows/ci.yml # GitHub Actions: Lint + Test-Matrix + mypy
├── docker/
│ ├── Dockerfile
│ └── docker-compose.yml
├── credattack/
│ ├── cli.py # CLI (Typer) — gepackt, unterstützt das Konsolenskript
│ ├── core/
│ │ ├── config.py # Pydantic-v2-Einstellungen
│ │ ├── engine.py # AttackEngine (ThreadPoolExecutor)
│ │ ├── lockout.py # LockoutDetector (gleitendes Fenster)
│ │ ├── proxy.py # ProxyRotator
│ │ ├── mutator.py # PasswordMutator
│ │ ├── result.py # AttemptResult, SessionReport
│ │ ├── report.py # HTML-Berichtsgenerator
│ │ └── logger.py # Rich-Logger + JSONL-Writer
│ ├── protocols/ # 18 ProtocolAttacker-Implementierungen
│ │ └── base.py # Abstrakter ProtocolAttacker
│ └── data/
│ ├── default_creds.json # 200+ Hersteller-Standardwerte
│ ├── smart_patterns.json # 140+ Enterprise-Vorlagen
│ └── wordlists/ # Startlisten pro Dienst
├── attacks/ # Eigenständige Einzeldatei-Tools (stammen aus der Zeit vor credattack/;
│ └── *.py # für Skripte behalten, die noch nicht portiert wurden: JWT-Cracking,
│ # WAF-Erkennung, zeitbasierte Benutzer-Enumeration)
├── utils/
│ └── credential_utils.py # Gemeinsame Helfer für die attacks/-Skripte
├── tests/
│ ├── conftest.py # Gemeinsame 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/ # Minimale Smoke-Test-Stubs
└── output/ # Erzeugte Logs & Berichte (git-ignoriert)
```
---
## Angriffs-Erfolgsraten (Richtwerte)
| Passworttyp | Wörterbuch | Smart-Modus | Spray (häufig) |
|--------------|------------|-------------|----------------|
| 4 Zeichen | ~90 % | ~95 % | ~60 % |
| 6 Zeichen | ~65 % | ~75 % | ~25 % |
| 8 Zeichen gemischt | ~15 % | ~25 % | ~5 % |
| 10+ Zeichen komplex | <5 % | <5 % | <1 % |
---
## Mitwirken
Siehe [CONTRIBUTING.md](https://github.com/amibhai/credential-attacks-toolkit/blob/main/CONTRIBUTING.md).
Bitte öffnen Sie vor dem Einreichen großer Pull-Requests ein Issue.
Alle Beiträge müssen der Richtlinie zur ethischen Nutzung in [SECURITY.md](https://github.com/amibhai/credential-attacks-toolkit/blob/main/SECURITY.md) entsprechen.
---
**Verantwortungsvoll nutzen. Ethisch testen. Legal bleiben.**