Once again, my awesomeness created something cool.
Just kidding, but seriously, i wanted to leard Obj-c a long time ago and now i actually started doing so.
Since i have an iPhone 4 jailbroken on iOS 7 i want to somehow install tweaks.
Maybe you guys know that i managed to install Cydia, but the problem ist that Cydia is almost completely broken. So beside of the UI also the "install paid package" thing is broken. That means obviously i can not buy packages (because of incompatibility with iOS 7) and i also can't install packages i already bought. Of course i linked my device to my Cydia acc and that's actually enough to install all packages i buy. Linking a device to Cydia means actually linking the device's uuid with your acc.
And that was the first thing i realised after having Cydia installed, the uuid is not correct.
Cyida tells me my uuid would be something like FFFFFFFF************* , obviously my uuid does not start with lots of "F" so the problem was found real quick.
Ok i don't need Cydia to install packages, i can use apt-get, the problem is i can't install paid packages with apt-get either. But apt is actually quite usefull, so i thought why not create something to install paid packages via terminal?
So did i.
The first thing was to find out, how Cydia tells the server that the package is bought, so i MiTM my jailbroken iPhone 4s. I found out, that the Header is the important thing, Cydia send the uuid, model (iPhone4,1), iOS, custom useragent to saurik's server. If everything is vaild you get a 302 moved temporarily response redirecting you to a different server with the GET parameter "key" i don't know what that does exactly, as the only important thing is to send the uuid to saurk's server.
So i created a little Python script to test that.
Now knowing how everything works the next step was to create an iPhone command line tool.
As i already had iOSOpenDev installed i just made a new command line tool for iOS.
I decided to create a Foundation tool (Obj-c) and not a C tool, simply because i wanted to practise and learn the language.
After a very long evening i managed to get everything working, using "apt-get -q -y --print-uris install [pkgname]" to get the link for the package and "deviceinfo -u" to get the uuid and finally dpkg to install the package.
For those who might still have the question, yes you need to purchase the tweak first to be able to install it using apt-paid, but if your device is linked to your acc you can purchase the tweak on antoher device too.
Finally having this tool is great, but that actually still didn't solve my problem with my uuid as "deviceinfo -u" also displays the wrong uuid starting with "FFFFFFFF". That's why i decided to build in one little hidden feauture: if you create the file "/var/mobile/Library/Caches/alteruuid" apt-paid will try to get your uuid from reading that file, so finally i connected my iPhone to iTunes, read my uuid and copied it to the alteruuid file.
I know what it means to be able to spoof the uuid with this trick, but i also know that tweaks are pirated anyway and this won't change anything, in fact if you have your friends uuid you can download his tweaks, but if it's your friend you can also simply ask him to link your device to his Cydia acc, as there is no limit for linked devices, so i don't thing apt-paid will change anything here.
apt-paid is made to be able to install paid packages (and free packages too) via terminal or ssh, but it's not limited to that. Propably i will use this tool in a future project, as i want to create remote installation of tweaks, like google play does it.
For everyone who sees benefits from apt-paid and want's to use it, feel free to do so ;)
it's available on my cydia repo "repo.tihmstar.org"
if you want to install it via terminal (like i love to do) the package is called org.tihmstar.apt-paid
Have fun and report bugs on twitter or irc ;D