Skip to content

Instantly share code, notes, and snippets.

@singe
Last active April 19, 2023 17:37
Show Gist options
  • Save singe/b300fbeb9723b06cf882ddb1d66c9466 to your computer and use it in GitHub Desktop.
Save singe/b300fbeb9723b06cf882ddb1d66c9466 to your computer and use it in GitHub Desktop.
Convert clear passwords into slightly more generalised brute force masks for hashcat mode -a3
#!/bin/sh
file="$1"
tmp=$(mktemp)
# change specials & digits to hashcat format
sed -e "s/[[:punct:]]/?s/g" \
-e "s/[[:digit:]]/?d/g" \
$file \
> $tmp \
&& \
# sort them most frequent to least and unique them
sort $tmp \
| uniq -c \
| sort -rn \
| sed "s/^[\ 0-9]* //" \
> $file.singemasks \
&& rm $tmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment