Skip to main content

Posts

Showing posts from 2020

How to create unique mach-o binaries with different file hash on mac

Sometimes you wonder you might want to create several Mach-O executable files on macOS for any fun or test purpose where each Mach-O has different hash such as ( MD5, SHA1, or SHA256 ) from one another. The following script will help you in achieving that. Pre-requisites: 1. Command-line tools for macOS need to be installed on mac prior to executing the below script. How to Run: 1. Copy the following code snippet to a file and save it with the name randomMachoGenerator.sh. 2. Run the bash script as sh randomMachoGenerator.sh in Terminal. 3. The following script will compile and execute unique Mach-O binaries inside the directory. #!/usr/bin/env bash START=1 END=10 echo 'Generating random Mach-O binaries' for ((n=$START; n<=$END; n++)) do  #Generating 12 letter random string      STATEMENT=$(dd if=/dev/urandom count=1 2> /dev/null | uuencode -m - | sed -ne 2p | cut -c-12)     cat > randomMachoGenerator.cpp << EO