Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Replace IPA url of AltStore to jailbreak IPAs
#! /usr/local/bin/python3
import os, shutil, time
import binascii
os.system("killall AltServer")
print ('Please choose jailbreak you want to install')
print ('1. Unc0ver\n2. Chimera\n3. Pangu\n4. Phoenix\n5. Home Depot\n6. h3lix\n')
jailbreak = input("")
# and use with statement (always do this to avoid leaked file descriptors, unflushed files)
with open('/Applications/AltServer.app/Contents/MacOS/AltServer', 'rb') as f:
# Slurp the whole file and efficiently convert it to hex all at once
hexdata = str(binascii.hexlify(f.read()))
replace_str = ""
original_str = '663030302E6261636B626C617A6562322E636F6D2F66696C652F616C7473746F72652F616C7473746F72652E697061'
if os.path.exists('/Applications/AltServer.app/Contents/MacOS/AltServerPatch'):
with open('/Applications/AltServer.app/Contents/MacOS/AltServerPatch', 'r') as patch:
original_str = patch.read()
patch.close()
# unc0ver
if jailbreak == 1:
replace_str = '732E686972616B752E74772F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F324F32744C416E'
elif jailbreak == 2:
replace_str = '6368696D6572612E73682F646F776E6C6F6164732F696F732F2F2F2F312E332E392D31322E302D31322E342E697061'
elif jailbreak == 3:
replace_str = '6767696E696E2E64652F6A622F2F2F2F2F2F2F2F4E76776153746F6E652F4E76776153746F6E655F312E312E697061'
elif jailbreak == 4:
replace_str = '6767696E696E2E64652F6A622F2F2F2F2F2F2F2F2F2F2F2F2F2F2F50686F656E69782F50686F656E6978352E697061'
elif jailbreak == 5:
replace_str = '6767696E696E2E64652F6A622F486F6D654465706F742F2F2F2F2F4D697874617065506C617965725243332E697061'
elif jailbreak == 6:
replace_str = '6767696E696E2E64652F6A622F68336C69782F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F68336C69782D5243362E697061'
else:
print("Please enter the number of jailbreak tool")
hexdata = hexdata.replace(
original_str.lower(),
replace_str.lower()
)
with open('/Applications/AltServer.app/Contents/MacOS/AltServerPatch', 'w') as fo:
fo.write(replace_str)
fo.close()
f.close()
with open('/Applications/AltServer.app/Contents/MacOS/AltServer2', 'wb') as fout:
fout.write(binascii.unhexlify(hexdata))
fout.close()
os.remove("/Applications/AltServer.app/Contents/MacOS/AltServer")
os.chmod('/Applications/AltServer.app/Contents/MacOS/AltServer2', 0755)
shutil.move("/Applications/AltServer.app/Contents/MacOS/AltServer2", "/Applications/AltServer.app/Contents/MacOS/AltServer")
print('All Done!')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.