Hashcat is a powerful password recovery tool that supports various hashing algorithms and cracking methods. Here are some essential Hashcat commands and concepts that can help you be successful:
The general syntax for running Hashcat:
hashcat -m [hash_type] -a [attack_mode] -o [output_file] [hash_file] [wordlist_or_rules]-m: Hash type (e.g., MD5, SHA1, bcrypt).-a: Attack mode (e.g., dictionary, brute-force).-o: Output file for cracked hashes.[hash_file]: File containing the hashes.[wordlist_or_rules]: Wordlist or rules file (depends on the mode).
-
-m(Hash Type): Defines the type of hash to crack.
Example:0for MD5100for SHA13200for bcrypt
Full list: Hashcat Hash Types
-
-a(Attack Mode): Defines the cracking method:0: Dictionary attack1: Combination attack3: Brute-force attack6: Hybrid dictionary + mask7: Hybrid mask + dictionary
-
--force: Forces Hashcat to run on unsupported devices (use cautiously). -
--session [name]: Saves the current session so you can resume later. -
--restore: Resumes a saved session. -
--show: Displays cracked hashes from the output file.
hashcat -m 0 -a 0 -o cracked.txt hashes.txt rockyou.txt-m 0: MD5 hash type.-a 0: Dictionary attack.hashes.txt: File with hashes.rockyou.txt: Wordlist file.
hashcat -m 0 -a 3 -o cracked.txt hashes.txt ?a?a?a?a?a: Represents any printable ASCII character.- You can adjust the length (e.g.,
?a?a?a?a?afor 5 characters).
hashcat -m 0 -a 1 -o cracked.txt hashes.txt wordlist1.txt wordlist2.txt- Combines words from
wordlist1.txtandwordlist2.txt.
hashcat -m 100 -a 6 -o cracked.txt hashes.txt rockyou.txt ?d?d?d- Appends three digits (
?d?d?d) to each word in the dictionary.
hashcat -m 100 -a 7 -o cracked.txt hashes.txt ?d?d rockyou.txt- Prepends two digits (
?d?d) to each word in the dictionary.
Mask characters allow you to specify the charset:
?l: Lowercase letters (a-z).?u: Uppercase letters (A-Z).?d: Digits (0-9).?s: Special characters.?a: All of the above.- Example:
?u?l?l?l?d?d(e.g.,Aaaa11).
--optimized-kernel-enable: Speeds up attacks on simpler hash algorithms.-w: Workload profile:-w 1: Low power (used for multitasking).-w 4: High power (max performance).
Rules modify the words in your wordlist dynamically:
hashcat -m 0 -a 0 -o cracked.txt hashes.txt -r rules/best64.rule- Popular rule files include
best64.ruleandd3ad0ne.rule.
- Save session:
hashcat --session mysession -m 0 -a 3 hashes.txt ?a?a?a
- Restore session:
hashcat --restore --session mysession
Test your system's performance with different hash types:
hashcat -bEnsure GPU acceleration is enabled:
hashcat -I- Use
-Dto select the device type:-D 1: Use CPU.-D 2: Use GPU.
Generate your own hashes using Python:
import hashlib
# MD5 hash
print(hashlib.md5(b'test').hexdigest())
# SHA1 hash
print(hashlib.sha1(b'test').hexdigest())- Use the right hash type for your target.
- Experiment with attack modes based on the scenario.
- Leverage wordlists and rules for better results.
- Use session management for long-running jobs.
- Test your setup using the benchmark mode.
- Keep your Hashcat updated for new features and improved performance.