TL;DR: I needed to get an app running on an old iPad that won’t be connected to the internet without forking out money to Apple. The solution: Jailbreak it, install OpenSSH and Python, run a local webserver to serve the web version of the app and pin the webpage to the home screen to get it closer to a native app.
I recently was tasked with getting some app running on an old iPad. I have not touched anything related to Apple for a long time and I have been content with keeping it that way up until recently. The app is pretty simple and originally was developed as a Windows program and now also offers a web version. The problem is that the iPad won’t have an internet connection when using the software, so the web version wouldn’t really work, since Safari refuses to cache the web version properly. So once the internet connection is disabled it’ll just refuse to load parts of the software, even if it could’ve easily cached it. I also couldn’t install any other browsers, because the iPad runs on iOS 9. Now I know that you can probably get a newer version on there if you tried some tricks, but I didn’t want to waste time on that since it might not have helped anyways.
The most straightforward solution would’ve been to just fork out the three dollars and buy the app. It requires at least iOS 9, so it would’ve worked, but I can’t in good concious pay money to Apple, since they take a large cut from those three dollars.
Instead I just pulled out the most retarded hack I could think of to get this piece of shit to run the app. The native app was basically out of question. Apple has done everything in their power to prevent people from side loading even legitimately obtained apps, so the chance of getting a pirated version running aren’t too high. Apparently it is possible, but the apps expire after a while and have to be “refreshed”, which sounds like a huge pain in the ass. That only left me with the web version. Thankfully both the source code for the Windows version as well as the html files for web version are available. Downloading the web version would’ve probably also worked, but this made it easier. Now I was left with displaying the web version somehow. The only browser I had available was Safari, so I had to work with that somehow. The other popular ones all required a newer iOS version, which I didn’t want to deal with.
Here’s what I ended up doing:
- Jailbreak the device and install Cydia
- Install OpenSSH and Python
- Run a webserver with python to host the web version locally
It sounds stupid, it is stupid, but it fucking worked and that’s all I care about.
Jailbreaking
The last time I jailbroke a device was years ago and when I did there really was only one way to do it, so the first few ways I came across where utter garbage. For some reason there now seems to be a full fledged ecosystem around this shit. I managed to install multiple different apps that are supposed jailbreaks and all they offered was a selection of apps and trying to install any of them required you to “donate” 10 dollars or more. While I’m all for getting developers paid, offering legally questionable software for Apple devices for mandatory “donations” doesn’t seem like the best way.
I ended up using Phoenix, which I installed via jailbreaks.app. It works with the ancient iPad and can be installed directly from Safari. Attempts to install the app from a PC didn’t work for me. From there I basically just clicked myself through the app, laughed at the ridiculous license which for some reason specifically excludes some angry German guy, and I finally ended up with Cydia installed. When I opened Cydia I had to let it run a full update.
At last I had a jailbroken device, but the jailbreak will reset whenever the device is restarted. Open the Phoenix app again allows one to “kick-start” the jailbreak again. This iPad is ancient and it’s already a gigantic pain in the ass. I can’t imagine how bad it is for recent devices. I really hope that Apple goes bankrupt.
OpenSSH and Python
Once I had Cydia I could install OpenSSH. Following the instructions in Cydia let me connect to the iPad via PuTTY (the ssh CLI client refused to connect in my case). Now I finally had a shell with root access, home sweet home. Keep in mind that at this point I had no idea how I’d actually get the stupid web version to run. After checking if Cydia had a Python package I was happy to see that it in fact did. However the version is horrendously outdated. Actually everything is outdated. The bash version is from 2009 and the Python version is 2.5, not even 2.7. At that point I was a bit worried since there’s a chance that this ancient port of python wouldn’t be able to run a web server. However after asking ChatGPT to write a simple HTTP server in Python 2.5 I found out that it is capable of doing exactly that.
This is what ChatGPT gave me:
import BaseHTTPServer
class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
self.wfile.write("<html><body>Hello, World!</body></html>")
if __name__ == '__main__':
server_class = BaseHTTPServer.HTTPServer
httpd = server_class(('localhost', 8000), MyHandler)
try:
httpd.serve_forever()
except KeyboardInterrupt:
pass
httpd.server_close()
Now I don’t think ChatGTP was specifically aiming for Python 2.5, I assume this would also work in Python 2.7. I don’t really care, it saved me some googling and that’s all I needed. I then transferred the html files of the web version via SFTP since Safari cannot fucking download a simple zip file and modified the script to host an entire folder. After verifying that everything worked there were some things to finalize:
- The python script should run automatically, while I can just launch it and fork it, I can’t expect others to ssh into the iPad to start the script back up if the iPad ever restarts. Kick-starting the jailbreak is just pressing a button, starting the web server isn’t.
- Some icons didn’t display correctly so I wanted to fix them, if possible
- Ideally the web version should be easily accessible
The last two things were easily doable. I modified the hosts file to redirect an easily memorable domain to localhost. On top of that I also pinned the site to the home screen. This basically makes it look like a native app with a proper icon and you can barely tell that it’s just a website, since it doesn’t open in Safari. Fixing the icons was a bit trickier. For some reason it couldn’t find the SVG files, or rather the web server wasn’t serving them correctly. I just converted them to PNGs and replaced the references int he html files.
Now the last thing was to make the script auto start, once again I saved myself some googling by asking ChatGPT (I know I’m sick of hearing of this PoS as well, but when it does come in handy I think it’s neat, however reading the fifteenth headline about how some dipshit connected X to the ChatGPT API isn’t.). To my surprise I got a functioning answer. Apparently you can auto start scripts similarly to SystemD services via a LaunchDaemon .plist file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.yourcompany.yourapp</string>
<key>Program</key>
<string>/path/to/your/script.sh</string>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
This file needs to go into /Library/LaunchDaemons/
, has to be owned by
root:wheel
and have the permissions 644
. After restarting the device and
kick-starting the jailbreak the server was now running automatically.
With that I now had the web version running locally, without an internet connection and almost no other issues. Some things I did notice are:
- The webserver is fairly slow, whether this is Python’s fault or the fact that the iPad is ancient, I don’t know, but it’s not unbearable and most of the tool takes place on one webpage anyways
- “Kick-starting” the jailbreak doesn’t always work on the first try, it’s annoying and the best solution is to just not fully turn off the device
- Depending on what page you pin to the home screen you might have some issues. The main part of the tool takes place on one single website where you enter scores for a game of Darts. Initially I pinned the screen for configuring a new game. This resulted in the scores being wiped every time you exited out of the “app”. If you however pin the page where you enter the scores to the home screen you will not have that issue and the scores will persist even if you close the app.
Is this really worth three dollars? If you count the time I invested, no, and I’m glad that I don’t have to deal with Apple devices on a regular basis. I felt like I was constantly killing brain cells. However it was nice to ultimately get it to work without paying the apple tax. And just to make it clear that this wasn’t about pirating the app itself (which is freeware anyways) I instead donated the three dollars directly to the developer of it.