Created
November 28, 2023 01:12
-
-
Save santrancisco/f2dd662310a3c1ff93e38ce477f04bc6 to your computer and use it in GitHub Desktop.
Simple bash script to bruteforce Mac dmg file password with a password list - only useful for when you have a list of passwords that you often use
This file contains 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 | |
if [ "$#" -ne 2 ]; then | |
echo "Usage: ./bruteforce.sh <dmg file> <password list>" | |
exit | |
fi | |
dmgfile="$1" | |
passfile="$2" | |
function TryPassword | |
{ | |
r=$(echo -n "$1" | hdiutil verify -stdinpass "$dmgfile" 2>&1) | |
if ! [[ $r =~ "Authentication error" ]]; then | |
echo "" | |
echo "Found! The password is: $1" | |
exit | |
fi | |
} | |
for i in $(cat $2); do | |
TryPassword "$i" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment