is there any tool for download which is not that hard to understand to go for a BF attack on a .dmg file?

  • This is a product recommendation really, which we try to avoid at all costs here at sec.SE . You may make a better question by arguing what you tried until now (e.g. a script that you wrote). Really, if you just remove "tool for download" from the question it becomes already much better.
    – grochmal
    Commented Oct 11, 2016 at 13:10

1 Answer 1


Theoretically, you could use a tool like Spartan (although I think it's not even around anymore).

Practically, this will bring you absolutely nowhere, unless the .dmg was encrypted with an extremely naive password (like 'admin' or '1234').

Any somewhat decent password will completely rule out the possibility of brute forcing.

(edit) Here's a shell script that will bruteforce passwords following a fixed format:

dmgfile="Your Encrypted File.dmg"

function TryPassword
    echo -n "$1 "
    r=$(echo -n "$1" | hdiutil verify -stdinpass "$dmgfile" 2>&1)
    if ! [[ $r =~ "Authentication error" ]]; then
        echo ""
        echo "Found! The password is: $1"

chars=$(echo {0..9} {A..z})
alphanum=( $(echo $chars | sed -E 's/[^A-Za-z0-9 ]+/ /g') )
letter=( $(echo $chars | sed -E 's/[^A-Za-z ]+/ /g') )
lowercase=( $(echo $chars | sed -E 's/[^a-z ]+/ /g') )
uppercase=( $(echo $chars | sed -E 's/[^A-Z ]+/ /g') )
digit=( $(echo $chars | sed -E 's/[^0-9 ]+/ /g') )

for a in "${letter[@]}"; do
    for b in "${lowercase[@]}"; do
        for c in "${digits[@]}"; do
            TryPassword "$a$b$c"

Save this to bruteforce.sh and from the shell, do chmod +x bruteforce.sh once to make it executable, and then ./bruteforce.sh to run it.

This example bruteforces all passwords consisting of one letter (upper or lower case), followed by one lowercase letter, followed by one digit. Edit accordingly to your scheme.

Test first by creating a test .dmg with a password that is attempted first (e.g. Aa0).

Keep in mind that even for simple (short) passwords this will take a VERY long time. Like I said, it's mostly just theoretical.

  • Thanks for your answer. Are there any other tools around which are able to do that? I have a short password. Like 4 letters and a digit.
    – user284148
    Commented Oct 12, 2016 at 7:08
  • @user284148 I added a script to do some simple brute forcing.
    – RocketNuts
    Commented Oct 12, 2016 at 10:57

Not the answer you're looking for? Browse other questions tagged .