0% found this document useful (0 votes)
115 views

M1 Script

This document contains functions for patching and modifying an application on macOS. The functions replace strings, modify code signatures, and change network domains in a photo editing application. The main patch function calls other functions to replace hexadecimal strings, replace all instances of domains, and re-sign the application with a new code signature.

Uploaded by

jatinyadavblog
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
115 views

M1 Script

This document contains functions for patching and modifying an application on macOS. The functions replace strings, modify code signatures, and change network domains in a photo editing application. The main patch function calls other functions to replace hexadecimal strings, replace all instances of domains, and re-sign the application with a new code signature.

Uploaded by

jatinyadavblog
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

function hex() {

echo ''$1'' | perl -0777pe 's|([0-9a-zA-Z]{2}+(?![^\(]*\)))|\\x${1}|gs'


}

function replaceAll() {
sudo perl -0777pi -e 'BEGIN{$/=\1e8} s|'$2'|'$3'|gs' "$1"
return
}

function replace() {
declare -r dom=$( hex $2 )
declare -r sub=$( hex $3 )
sudo perl -0777pi -e 'BEGIN{$/=\1e8} s|'$dom'|'$sub'|gs' "$1"
return
}

function prep() {
sudo xattr -cr "$1"
sudo xattr -r -d com.apple.quarantine "$1"
sudo codesign --force --deep --sign - "$1"
}

function patch() {
replace "/Applications/Topaz Photo AI.app/Contents/Frameworks/libnetwork.dylib"
'554889E553504889FB488B7F08488B73104885FF7507488B3D'
'B001C3E553504889FB488B7F08488B73104885FF7507488B3D' # x86_64
replace "/Applications/Topaz Photo AI.app/Contents/Frameworks/libnetwork.dylib"
'5FD600604239C0035FD6F657BDA9F44F01A9' '5FD600604239C0035FD620008052C0035FD6' #
arm64
replaceAll "/Applications/Topaz Photo AI.app/Contents/Frameworks/libnetwork.dylib"
'api.topaz-labs.net' 'lololololololololo'
replaceAll "/Applications/Topaz Photo AI.app/Contents/Frameworks/libnetwork.dylib"
'et.topazlabs.com' 'lolololololololo'
}

clear
printf "\e[1;32m > STARTING PATCH, MAC PASSWORD REQUIRED:\e[m %s\n"
patch
printf "\e[1;32m > PATCHING DONE, NOW CODESIGNING (MAY TAKE A FEW LONG
SECONDS)...\e[m %s\n"
prep "/Applications/Topaz Photo AI.app"
printf "\e[1;32m > --- PATCHING COMPLETED ---\e[m %s\n"

You might also like