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!')
@BartmanEH

This comment has been minimized.

Copy link

@BartmanEH BartmanEH commented Feb 16, 2020

Does this work? After editing this python script to actually work on my Catalina system, the resulting executable doesn't run. In fact, using a hex editor to change one byte to invalidate the URL for testing doesn't work. Maybe it breaks code signing or app integrity? Trying this on AltServer v1.2.1

@hirakujira

This comment has been minimized.

Copy link
Owner Author

@hirakujira hirakujira commented Feb 16, 2020

Please do not use this script anymore. There's some patched AltServer which is already build for custom URLs.

@BartmanEH

This comment has been minimized.

Copy link

@BartmanEH BartmanEH commented Feb 16, 2020

AltServer Patcher is only for Windows

@hirakujira

This comment has been minimized.

@BartmanEH

This comment has been minimized.

Copy link

@BartmanEH BartmanEH commented Feb 16, 2020

Thank you but I'm not trying to do Jailbreak. I'm trying to add my own custom URL. Instead of using this script, I'm now trying to compile from source but I'm not an Xcode developer so it's going to be a slow process. [edit] I see your version also let's you use a custom IPA but it's several versions behind the main developer release now.

@BartmanEH

This comment has been minimized.

Copy link

@BartmanEH BartmanEH commented Feb 17, 2020

I git cloned the source code for your patched AltServer but a search for "Custom Link" returns no results--is your git source updated? I would expect search for "Custom Link" to show me the code you added for the dialog box for choosing a jailbreak ipa or custom link.

@hirakujira

This comment has been minimized.

Copy link
Owner Author

@hirakujira hirakujira commented Feb 17, 2020

It's updated. You must checkout jailbreak branch. It's not in master branch.
It doesn't matter that my version is behind the latest version. Because most of the new changes are focused on the iOS App code. Not the server itself.

@BartmanEH

This comment has been minimized.

Copy link

@BartmanEH BartmanEH commented Feb 17, 2020

Thank you! I'm not a git expert--is there an easy way to pull changes from AltStore master/develop and merge them into my local cloned repository of your jailbreak branch?

@hirakujira

This comment has been minimized.

Copy link
Owner Author

@hirakujira hirakujira commented Feb 17, 2020

If you go to this page https://github.com/hirakujira/AltStore-Jailbreak/tree/jailbreak and click "Download Zip", it will download my source code which is already in jailbreak branch. You can find my hacks in AppDelegate.swift

And.. No, there's no easy way to merge that because I "removed" a lot of code which is not related with my approach (sideloading an IPA). If you are not an expert, I don't recommend you use the latest code, because it includes more codes / builds, which also means you have more issue need to fix.

@BartmanEH

This comment has been minimized.

Copy link

@BartmanEH BartmanEH commented Feb 17, 2020

I've successfully modified your version to add my URL as an option and I have also successfully modified the AltStore original to use my URL hardcoded instead of the default AltStore URL so I have two ways to get this done. Now that I can compile and build these, I have lots of options. Thanks for your help.

@santiargy

This comment has been minimized.

Copy link

@santiargy santiargy commented Feb 20, 2020

I have not been able to get the new altdeploy patcher to work. When I put the URL of where the ipa is hosted, it says it cannot find it. Did sideloading work for you?

@BartmanEH

This comment has been minimized.

Copy link

@BartmanEH BartmanEH commented Feb 20, 2020

I have not been able to get the new altdeploy patcher to work. When I put the URL of where the ipa is hosted, it says it cannot find it. Did sideloading work for you?

Some patchers are limited to 55 character URLs. Try using a URL shortener like Rebrandly.

@hirakujira

This comment has been minimized.

Copy link
Owner Author

@hirakujira hirakujira commented Feb 20, 2020

I have not been able to get the new altdeploy patcher to work. When I put the URL of where the ipa is hosted, it says it cannot find it. Did sideloading work for you?

Your URL should can be reached without any requirement of login/verification. One option is using one drive.
https://www.reddit.com/r/jailbreak/comments/ejtw9x/release_install_jailbreak_via_patched_altserver/

@santiargy

This comment has been minimized.

Copy link

@santiargy santiargy commented Feb 20, 2020

@santiargy

This comment has been minimized.

Copy link

@santiargy santiargy commented Feb 21, 2020

Hi again. I am adding a few pictures showing that I am using Redbrandly, File is on OneDrive with Viewing Allowed (link works, file starts downloading when you use the link), and the different messages that I get until the last one saying The app could not be found. I would appreciate if you can give me any clues. Or maybe even test the URL if I were to share it...? Thanks!!!

IMG_7781
IMG_7776
IMG_7777
IMG_7778
IMG_7779
IMG_7780

@BartmanEH

This comment has been minimized.

Copy link

@BartmanEH BartmanEH commented Feb 23, 2020

@santiargy, it's not really practical for us to test your URL. If you followed the thread above, you'll see that the author and I are on MacOS and merely mentioned AltServer Patcher (for Windows) in passing as an alternative to the work we were doing on MacOS. In the end I'm modifying the source code for MacOS and compiling my own version of AltServer for my purposes. Maybe post in the AltServer Patcher Reddit thread and ask for help there. Alternatively you may have better luck trying a newer version of the patcher. This new version has a more user-friendly interface and may work better for you.

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.