Skip to content

Instantly share code, notes, and snippets.

@suuhm
Created February 7, 2024 00:19
Show Gist options
  • Save suuhm/b806c744766bb720314718d0b87e9d39 to your computer and use it in GitHub Desktop.
Save suuhm/b806c744766bb720314718d0b87e9d39 to your computer and use it in GitHub Desktop.
Extract md5 hashes in text and use hashcat to crack with mask attack
#!/bin/bash
# hashes only:
#grep -Eo "\b[a-f0-9]{32}\b" hashes.txt > md5-hashes.txt
# Mails:Hashes extract from your textfile:
sed -nE "s/.*'([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})'.*'([a-f0-9]{32})'.*/\1:\2/p" your_text_file.txt > mail-md5.txt
# Crack hashes with usernames:
hashcat -a0 -m0 --username --potfile-path mail_md5.potfile mail-md5.txt /usr/share/wordlists/rockyou.txt.gz
# Masked bruteforce attack length 8 , a-zA-Z0-9:
hashcat -a3 -m0 --username --potfile-path mail_md5.potfile mail-md5.txt -i -1 ?l?d?U ?1?1?1?1?1?1?1?1
# Set usernames and plain passwords:
hashcat -a0 -m0 --username --potfile-path mail_md5.potfile --show -o mail_md5_out.txt --outfile-format 2 mail-md5.txt
exit 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment