Skip to content

Instantly share code, notes, and snippets.

@joanbono
Last active January 7, 2024 11:12
Show Gist options
  • Select an option

  • Save joanbono/5ff72891cf37cf2f81f6f3cc346f7df4 to your computer and use it in GitHub Desktop.

Select an option

Save joanbono/5ff72891cf37cf2f81f6f3cc346f7df4 to your computer and use it in GitHub Desktop.
mac-torrent-download DMG brute-forcer
#!/bin/bash
# Title: Macdown.sh
# Description: Bruteforce DMG files downloaded from mac-torrent-download.net
# Author: Joan Bono (@joan_bono)
# Version: 1.1.0
# Last Modified: jbono @ 20211129
RED='\033[0;31m'
GREEN='\033[0;32m'
NOCOLOR='\033[0m'
BOLD='\033[1m'
DMG=$1
if [ "${DMG}" == "" ]; then
echo "[-] No DMG provided."
exit 0
else
for x in {{a..z},{0..9}}; do
for y in {{a..z},{0..9}}; do
for z in {{a..z},{0..9}}; do
echo -n "mac-torrent-download.net_${x}${y}${z}" | hdiutil attach -stdinpass "${DMG}" > /dev/null 2>&1
if [ "$?" -eq 0 ]; then
echo -ne "${GREEN}${BOLD}[+] Found password:${NOCOLOR} mac-torrent-download.net_${x}${y}${z}\n"
exit 0
fi
echo -ne "${RED}${BOLD}[-] Tested password:${NOCOLOR} mac-torrent-download.net_${x}${y}${z}\n"
done
done
done
fi
@L0STD0G

L0STD0G commented Jan 27, 2021

Copy link
Copy Markdown

I'm really sorry for this question, but how do I provide the dmg?

@joanbono

Copy link
Copy Markdown
Author

Hi @L0STD0G no need to be sorry for asking.

As you can see in line 13:

DMG=$1

So, it's the first argument when executing the command. Therefore, you'll need to execute the command like this:

$> bash macdown_brute.sh NAME_OF_DMG_FILE.dmg

So, in case you have a DMG file for VLC media player, you'll do it as follows:

$> bash macdown_brute.sh vlc.dmg

@L0STD0G

L0STD0G commented Jan 27, 2021

Copy link
Copy Markdown

It's Working!!! Thanks so much! This is the first ever code-related thing I've ever done. Had to do a bit of research to even understand the littlest part of this seemingly simple set of words. Thanks so much again. Have a great day.

@NullARCn11

Copy link
Copy Markdown

Hi! Ive been trying for hours to try to get this to work but I keep getting the "no DMG provided" error. Any chance you could give me the dummies version of how to get this running? I don't understand the instructions you gave the previous gentleman. Thank you so much for your help, Its truly appreciated!

@L0STD0G

L0STD0G commented Jan 31, 2021

Copy link
Copy Markdown

Ok, this is how I got it working, I don't know if it's the easiest or most efficient method but it worked:

first, put both the .sh file and .dmg in the same folder (I used desktop). I also changed the name of the dmg to something simple like asd123.dmg

now open the terminal and execute the cd command like this to go there (where the files are located):
cd desktop
now execute:
bash macdown_brute.sh asd123.dmg

@L0STD0G

L0STD0G commented Jan 31, 2021

Copy link
Copy Markdown

Question to joanbono: Can i run multiple instances of this at the same time?
notice line 19:
for x in {{a..z},{0..9}}; do

can I just change to something like:
for x in {{a..d},{0..9}}; do and for x in {{e..h},{0..9}}; do

and run them at the same time to save time?
Thanks a lot again. It did a marvelous job.

@NullARCn11

NullARCn11 commented Jan 31, 2021

Copy link
Copy Markdown

@L0STD0G THANK YOU!! It finally works!! And thank you @joanbono for making this available!

@joanbono

joanbono commented Feb 1, 2021

Copy link
Copy Markdown
Author

Question to joanbono: Can i run multiple instances of this at the same time?
notice line 19:
for x in {{a..z},{0..9}}; do

can I just change to something like:
for x in {{a..d},{0..9}}; do and for x in {{e..h},{0..9}}; do

and run them at the same time to save time?
Thanks a lot again. It did a marvelous job.

I guess you refer to run it against multiple DMG files.

You should be able to do so by opening a new terminal for each job

@huds0nx

huds0nx commented Jul 26, 2021

Copy link
Copy Markdown

I've tried this, but it doesn't seem to end up finding the password. Like it never finds the correct password, it just says they are all wrong. Would it have something to do with me on an M1 mac or that I use zsh?

@rjdevries1

Copy link
Copy Markdown

The one I try to go for has periods in the file name so it states 'no .dmg has been provided'.
Can I run it just by copy/pasting the code in the terminal?

@joanbono

joanbono commented Aug 9, 2021

Copy link
Copy Markdown
Author

I've tried this, but it doesn't seem to end up finding the password. Like it never finds the correct password, it just says they are all wrong. Would it have something to do with me on an M1 mac or that I use zsh?

Hi @huds0nx Maybe yes, or maybe the password format has changed. Can you confirm which is the current format?

The one I try to go for has periods in the file name so it states 'no .dmg has been provided'.
Can I run it just by copy/pasting the code in the terminal?

Hi @rjdevries1 Can you paste here the steps you are following? Thanks in advance

@huds0nx

huds0nx commented Aug 9, 2021 via email

Copy link
Copy Markdown

@marcfusch

Copy link
Copy Markdown

Hi, i got it working by putting the ${DMG} variable in quotation marks. hdiutil returned an error about the dmg input because the filename likely contains spaces. Here's the fixed version (that also runs slower but it's normal since it actually checks the password : )

#!/bin/bash
# Title: Macdown.sh
# Description: Bruteforce DMG files downloaded from mac-torrent-download.net
# Author: Joan Bono (@joan_bono)
# Version: 1.0.0
# Last Modified: jbono @ 20200102
# Fixed version

RED='\033[0;31m'
GREEN='\033[0;32m'
NOCOLOR='\033[0m'
BOLD='\033[1m'

DMG=$1

if [ "${DMG}" == "" ]; then
    echo "[-] No DMG provided."
    exit 0
else
    for x in {{a..z},{0..9}}; do
        for y in {{a..z},{0..9}}; do
            for z in {{a..z},{0..9}}; do
                echo -n "mac-torrent-download.net_${x}${y}${z}" | hdiutil attach -stdinpass "${DMG}" > /dev/null 2>&1
                if [ "$?" -eq 0 ]; then
                    echo  -ne "${GREEN}${BOLD}[+] Found password:${NOCOLOR} mac-torrent-download.net_${x}${y}${z}\n"
                    exit 0
                fi
                echo -ne "${RED}${BOLD}[-] Tested password:${NOCOLOR} mac-torrent-download.net_${x}${y}${z}\n"
            done
        done
    done
fi

@af1

af1 commented Nov 23, 2021

Copy link
Copy Markdown

@marcfusch Thank you, that worked for me.

@joanbono

Copy link
Copy Markdown
Author

@marcfusch Thanks, I have updated the Gist.

@hobb7t

hobb7t commented Jan 7, 2024

Copy link
Copy Markdown

Thx for the code m8!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment