Skip to content

Instantly share code, notes, and snippets.

@AlbertVeli
Created July 7, 2020 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlbertVeli/3a2983e16e173c894e4d39e84cd3992c to your computer and use it in GitHub Desktop.
Save AlbertVeli/3a2983e16e173c894e4d39e84cd3992c to your computer and use it in GitHub Desktop.
CorrectHorseBatteryStaple
# Create xkcd hash
echo -n "CorrectHorseBatteryStaple" | md5sum | awk '{ print $1 }' > md5.hash
cat md5.hash
f6f9b174745fa4651f750c36957d674c
# Get 20k wordlist (containing all 4 words)
wget https://raw.githubusercontent.com/first20hours/google-10000-english/master/20k.txt
# Pick 2k top words to speed up attack:
head -2000 20k.txt > 2k.txt
grep correct 2k.txt
correct
grep horse 2k.txt
horse
grep battery 2k.txt
battery
grep staple 2k.txt
# Add the missing word so this will work
echo staple >> 2k.txt
# Capitalize words
cat 2k.txt | hashcat --stdout -j c > capitalized_2k.txt
# Double words
hashcat -a 1 --stdout capitalized_2k.txt capitalized_2k.txt > double.txt
ls -lh double.txt
-rw-r--r-- 1 albert albert 49M Jul 7 15:21 double.txt
# Crack it with hashcat
hashcat -O --potfile-path hc.pot -m 0 md5.hash -a 1 double.txt double.txt
p
...
Time.Estimated...: Tue Jul 7 19:17:29 2020 (*3 hours, 53 mins*)
Speed.#1.........: 1142.8 MH/s (13.52ms)
@AlbertVeli
Copy link
Author

Hmm, markdown didn't work. Let's see if it works in the comments.

Create xkcd hash

echo -n "CorrectHorseBatteryStaple" | md5sum | awk '{ print $1 }' > md5.hash
cat md5.hash
f6f9b174745fa4651f750c36957d674c

Get 20k wordlist (containing all 4 words)

wget https://raw.githubusercontent.com/first20hours/google-10000-english/master/20k.txt

Pick 2k top words to speed up attack:

head -2000 20k.txt > 2k.txt
grep correct 2k.txt
correct
grep horse 2k.txt
horse
grep battery 2k.txt
battery
grep staple 2k.txt

Add the missing word so this will work

echo staple >> 2k.txt

Capitalize words

cat 2k.txt | hashcat --stdout -j c > capitalized_2k.txt

Double words

hashcat -a 1 --stdout capitalized_2k.txt capitalized_2k.txt > double.txt
ls -lh double.txt
-rw-r--r-- 1 albert albert 49M Jul  7 15:21 double.txt

Crack it with hashcat

hashcat -O --potfile-path hc.pot -m 0 md5.hash -a 1 double.txt double.txt

p
...
Time.Estimated...: Tue Jul 7 19:17:29 2020 (3 hours, 53 mins)
Speed.#1.........: 1142.8 MH/s (13.52ms)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment