# cracking — hashes in, plaintext out
Hash cracking + password attacks. Hashes usually come from elsewhere first:
`cheat impacket` (secretsdump, GetUserSPNs, GetNPUsers), `cheat nxc` (dumps + spraying),
`cheat ad` for the AD kill-chain. `$ROCKYOU` is the default wordlist everywhere below.
## Identify first (wrong `-m` = no crack)
- **`hid <hash>`** — your hash-id wrapper: `hashid -m` (prints the hashcat mode), falls back to `hash-identifier`.
- **`hash-id <hash>`** — raw `hashid` · **`nth <hash>`** — name-that-hash, better on modern/AD formats.
- **`hashcat --example-hashes | less`** — the ground truth: every mode with a sample. When `hid` guesses wrong, grep this.
- Prefixes tell you cold: `$2y$`=bcrypt · `$6$`=sha512crypt · `$krb5tgs$`=Kerberoast · `$krb5asrep$`=AS-REP · `user::DOMAIN:…`=NetNTLMv2.
## Crack (the fast path)
- **`hcrack <hash|file> [wl]`** — THE star. Auto-detects type by pattern, picks the mode, runs hashcat `--quiet`, then `--show`. Takes a raw hash string OR a file. Reach for this first — it removes the `-m` guesswork.
- **`hc <file> [wl]`** — no idea what it is? Sprays modes `0 100 1000 1800 3200 13100` in sequence, stops at the first hit. Slower but hands-off.
- **`hc-rock <mode> <file>`** — you KNOW the mode: `hashcat -m <mode> <file> $ROCKYOU`. The tightest loop.
- **`hc-show <mode> <file>`** — `hashcat -m <mode> <file> --show` — replays already-cracked results from the potfile (instant, no re-crack).
- **`crack-all`** — bulk: finds `*.hash` / `*hashes*.txt` under `./loot` (or `$HTB_BOXES/loot`) and `hcrack`s each with rockyou. Run after looting a box.
`hcrack` auto-detect → mode: `$krb5asrep$`→18200 · `$krb5tgs$`→13100 · `$2[aby]$`→3200 · `$6$`→1800 · `$5$`→7400 · `::`→5600 · `32hex:32hex`→5500 · 32-hex→1000 (NTLM; try `-m 0` MD5 if it whiffs). Unknown → falls back to `hc`.
## hashcat `-m` modes — the ones you actually meet
| mode | hash | where it comes from |
|---|---|---|
| 1000 | NTLM | secretsdump, SAM, NTDS.dit |
| 5600 | NetNTLMv2 | Responder / ntlmrelayx capture |
| 13100 | Kerberoast (TGS-REP) | GetUserSPNs |
| 18200 | AS-REP roast | GetNPUsers (no-preauth) |
| 3200 | bcrypt `$2*$` | web app DBs (slow — small wl only) |
| 1800 | sha512crypt `$6$` | Linux `/etc/shadow` |
| 0 / 100 | MD5 / SHA1 | generic web hashes |
- Raw call: **`hash-crack <mode> <file> $ROCKYOU`** (alias for `hashcat -m`). Add **`-a 3 ?a?a?a?a?a?a`** for mask/brute, **`-r rules/best64.rule`** for mutations, **`--username`** if the file is `user:hash`.
- `--show` reads the potfile, so cracked hashes are cached forever — re-running is free.
## Extract hashes from files (john side)
- **`john`** — local John (native build → homebrew → docker fallback, transparent). Best for `/etc/shadow`, odd formats, and incremental: `john --wordlist=$ROCKYOU hash.txt`, then **`john-show`** / `john --show hash.txt`.
- **`john_py <script.py> <file>`** — runs any `*2john` **python** helper under `$JOHN_HOME`: `john_py ssh2john.py id_rsa > id_rsa.hash`, `john_py office2john.py secret.docx`, `john_py pdf2john.py doc.pdf`. Pipe the output straight into `hcrack`.
- Binary `*2john` (`zip2john`, `rar2john`, `keepass2john`) are on `$PATH` already — call them directly: `zip2john locked.zip > z.hash && hcrack z.hash`.
- John finds the format itself, hashcat needs `-m`. For encrypted-file hashes John is usually the shorter path.
## Spray & brute over the network (loud — noisy, lockout risk)
- **`brute-ssh <ip> <user> [wl]`** — `hydra -l user -P wl ip ssh -t 4` (ip defaults to `$TARGET`, wl to `$ROCKYOU`). (loud)
- **`brute-web <url> <user> [wl] <form-spec>`** — `hydra … http-post-form`, args 4+ are the raw hydra form spec, e.g.
```
brute-web 10.10.10.5 admin $ROCKYOU '/login:user=^USER^&pass=^PASS^:F=Invalid'
```
- Prefer **spraying over brute** on AD: one password vs many users beats the lockout policy — that's `cheat nxc` (`nxc smb … -u users.txt -p 'Season2026!'`), not hydra. (careful: lockouts)
## Wordlists & tuning
- **`$ROCKYOU`** — the default. **`$PASSWORDS`** — SecLists top-10k (fast triage). **`$USERNAMES`** — name lists for spraying/`--username`.
- **`$SECLISTS`** — the whole tree; `$COMMON`/`$MEDIUM`/`$BIG` are web-content, not password lists.
- GPU crawling? bcrypt/sha512crypt are *slow by design* — use a small targeted list or a mask, never `$BIG`. NTLM/NetNTLMv2 are fast — throw everything.
- Rules multiply a wordlist cheaply: **`-r $(brew --prefix)/share/hashcat/rules/best64.rule`** turns rockyou into ~50× the candidates.
> Order of operations: `hid` (or `nth`) to name it → `hcrack` to crack it. Don't hand-pick `-m` until `hcrack` can't. Cracked once = in the potfile forever, so `hc-show`/`--show` before you ever re-run a job.