Created
April 17, 2023 11:16
-
-
Save singe/008f0174d2496149dbc5d4412f8cc536 to your computer and use it in GitHub Desktop.
Generate a list of hashcat masks from a wordlist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# hashcat mask generator | |
# by @singe | |
infile="$1" | |
outfile="$1.freq.masks" | |
outfile2="$1.length.masks" | |
tmp=$(mktemp) | |
cp $infile $outfile | |
sed -i .bak "s/[[:punct:]]/##SS##/g" $outfile # prevent the lowercase replace changing from ?s to ??l | |
sed -i .bak "s/[a-z]/?l/g" $outfile | |
sed -i .bak "s/##SS##/?s/g" $outfile # put the ?s back after the lowecase replace | |
sed -i .bak "s/[A-Z]/?u/g" $outfile | |
sed -i .bak "s/[0-9]/?d/g" $outfile | |
rm $outfile.bak | |
# Reduce masks to uniques sorted by frequency (i.e. most common at the top) | |
sort $outfile | uniq -c | sort -rn | sed "s/^[\ 0-9]* //" > $tmp | |
mv $tmp $outfile | |
# Reduce masks to uniques sorted by length (i.e. shortest/fastest at the top) | |
cat $outfile | awk '{ print length, $0 }' | sort -ns | cut -d" " -f2- > $outfile2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment