Hacking your pot in Apple’s Texas Holdem for iPhone
In Apple’s Texas Holdem app, there are several venues where you can play, with different buy-in amounts. I’m not very good, so it takes me a long time to build up enough money to play the later venues. Since my iPhone is jailbroken, I can just manually adjust the amount of money in my Texas Holdem pot. Here’s how I do this.
User installed apps on the iPhone live at /User/Applications/sandbox_dir/appname.app, where appname is the name of the app in question, and sandbox_dir is a random string of 37 hex digits and hyphens. This string is an example of salt, and it is how Apple implements a per-app sandbox. For one app to interact with another’s data, it would have to guess the name of its sandbox directory, which is a statistical impossibility.
To discover which sandbox directory Holdem lives in, I run ls -d /User/Applications/*/* | grep -i holdem, which on my device yields /User/Applications/6FFC1F30-3ECB-45F2-9A26-6473B554A360/HoldEm.app/. The file /User/Applications/6FFC1F30-3ECB-45F2-9A26-6473B554A360/Documents/data is where all your game data are stored. How many games played, how many games won, how much money, etc. I had hoped for an Apple .plist, but it seems to be a straight-up binary file. With a little trial and error, one finds that the amount of winnings is stored in bytes 51 through 53 of this file. Note that they’re in reverse order. So if you want 0×123456 dollars, byte 51 should be 56, byte 52 should be 34, and byte 53 should be 12.
In summary, with a jailbroken iPhone named iphone_name, with OpenSSH installed:
- From a computer on the same LAN as the iPhone, copy the data file to the local computer:
scp root@iphone_name.local:/User/Applications/'`ls -d /User/Applications/*/* | grep -i holdem | cut -f 4 -d \/`'/Documents/data . - Edit the data file on your computer with a hex edit program, adding your desire money to bytes 51 through 53. FF FF FF to max out your money.
- Copy the file back to your iPhone with:
scp data root@iphone_name.local:/User/Applications/'`ls -d /User/Applications/*/* | grep -i holdem | cut -f 4 -d \/`'/Documents/data
And that’s it. That’s my killer app justification for all the hassle of jailbreaking; cheating at poker. You get $16,777,215 dollars. Plenty of money to lose at Dubai 160 times.