> For the complete documentation index, see [llms.txt](https://capcap-1.gitbook.io/capcap/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://capcap-1.gitbook.io/capcap/readme/ctf-modules/exploitation/password-attacks/tools/hashcat.md).

# Hashcat

GPU-accelerated password cracker. Faster than JtR for raw hash cracking due to GPU parallelism. Use JtR for file cracking (`*2john`), use Hashcat when speed matters.

#### General Syntax

```bash
hashcat -a <attack_mode> -m <hash_type_id> <hash_or_file> <wordlist/mask>
```

| Flag      | Purpose                         |
| --------- | ------------------------------- |
| `-a`      | Attack mode                     |
| `-m`      | Hash type ID                    |
| `--show`  | Display cracked results         |
| `--force` | Ignore warnings (use carefully) |

***

#### Identifying Hash Type ID

```bash
# List all supported hash types
hashcat --help

# Auto-identify hash and get hashcat mode number
hashid -m '$1$FNr44XZC$wQxY6HHLrgrGX0e1195k.1'
```

**Key hash IDs to memorize:**

| ID     | Hash type                        |
| ------ | -------------------------------- |
| `0`    | MD5                              |
| `100`  | SHA1                             |
| `1400` | SHA2-256                         |
| `1700` | SHA2-512                         |
| `1000` | NTLM                             |
| `5600` | NTLMv2                           |
| `2100` | DCC2 (Domain Cached Credentials) |
| `500`  | MD5crypt / Cisco / FreeBSD       |
| `1800` | sha512crypt — Linux shadow `$6$` |
| `3200` | bcrypt `$2*$`                    |

***

#### Attack Mode 0 — Dictionary

```bash
# Basic dictionary attack
hashcat -a 0 -m 0 e3e3ec5831ad5e7288241960e5d4fdb8 /usr/share/wordlists/rockyou.txt

# With rules (mutations — append numbers, leet substitutions, etc.)
hashcat -a 0 -m 0 1b0556a75770563578569ae21392630c /usr/share/wordlists/rockyou.txt -r /usr/share/hashcat/rules/best64.rule
```

Rule files location:

bash

```bash
ls /usr/share/hashcat/rules/
```

**Key rules to know:**

| Rule file            | Use case                                  |
| -------------------- | ----------------------------------------- |
| `best64.rule`        | 64 common mutations — go-to first attempt |
| `rockyou-30000.rule` | Aggressive, larger ruleset                |
| `dive.rule`          | Most exhaustive, slowest                  |
| `leetspeak.rule`     | l33t substitutions                        |

***

#### Attack Mode 3 — Mask Attack

Targeted brute-force using a defined password pattern. Much faster than pure brute-force because you constrain the keyspace.

**Built-in character sets:**

| Symbol | Charset                    |
| ------ | -------------------------- |
| `?l`   | `a-z` lowercase            |
| `?u`   | `A-Z` uppercase            |
| `?d`   | `0-9` digits               |
| `?s`   | Special chars `!@#$...`    |
| `?a`   | All of `?l?u?d?s` combined |
| `?h`   | `0-9a-f` hex lowercase     |
| `?H`   | `0-9A-F` hex uppercase     |

```bash
# Pattern: Capital + 4 lowercase + digit + symbol (e.g. Apple3!)
hashcat -a 3 -m 0 1e293d6912d074c0fd15844d803400dd '?u?l?l?l?l?d?s'

# Custom charset: define with -1, reference with ?1
hashcat -a 3 -m 0 <hash> -1 '?l?d' '?1?1?1?1?1?1?1?1'
# ^ 8-char password using only lowercase + digits
```

> **Pentest rule:** Use mask attack when you know the password policy (e.g. "must have uppercase, number, symbol, 8 chars"). Narrows billions of combos down to millions.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://capcap-1.gitbook.io/capcap/readme/ctf-modules/exploitation/password-attacks/tools/hashcat.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
