Tuesday, May 20, 2008

iPhone pseudo-GPS code (iLoJack)

This is an iPhone pseudo-GPS. The one that I called iLoJack. You can download it here at http://prokhorenko.us/white/iphonegps.zip.

Yes, it works. ;) There were some issues, but I'll give you a chance to discover them and fix yourself. ;)

I've developed a simple wrapper to run the Erica Sadun's findme-muchbetter to get the location of the phone and send it to Twitter. Also, it uses Erica's pingwifi, however, I didn't find this to be useful for myself (and my iPhone).

Your iPhone has got to be jailbroken and should be running a decent software update. I don't remember which one is the absolute requirement, but as far as I can recall 1.1.3+ was okay. If you are not sure what all this mean, you should better stay away. I don't think you can screw something up with my application, but you definately can end up with full restore. ;)

It's a pretty smart wrapper (with the most of constants left at the top of the script), but you've got to be tech savvy and kind of geeky, too. It knows how to use proxy. So, it'd be helpful if you're using T-Zones and don't want to pay any penny more. ;)

I didn't have any spare minute to provide an Installer.app wrap for it. There were few guys that volunteered to do this, however, I'm not aware of any repository that carries such an application. I also included a small code that allows your iPhone to wake up from the sleeping in specific period of time. (No source code for it, but I will include it upon request. Just leave me a comment here.)

The archive has a .plist file that you need to use for starting the keeper.sh when the iPhone boots up. Everything else would be done by keeper.sh and twee.sh. Make sure that you adjust them for your situation. They are pretty simple, but you still need to understand at least something about /bin/sh. ;)

Here are some notes on installation:
  1. Make sure you have BSD subsystem installed.
  2. Upload all files to your iPhone to some directory.
  3. Use Terminal.app from computer or directly from iPhone.
  4. Change to the directory where you uploaded files.
  5. Run cp -v ./com.qwe3.twee.plist /System/Library/LaunchDaemons/com.qwe3.twee.plist
  6. Run cp -v ./findme-muchbetter /var/root
  7. Run cp -v ./pingwifi /var/root
  8. Run cp -v ./twee.sh /var/root
  9. Run cp -v ./keeper.sh /var/root
  10. Check /var/root/twee.sh for your proxy settings (if you are using T-Zones you may want to use the proxy for curl) and for your Twitter username and password.
  11. Check /var/root/keeper.sh for timing. I found 20 minutes to be good enough. When the phone is sleeping, the updates are coming every 30 minutes (keeping in mind that you set your Mail.app be checked every 15 minutes). When the phone is up, the updates are coming every 20 minutes. You can find the best numbers for yourself.
  12. Launch keeper launchctl load -w /System/Library/LaunchDaemons/com.qwe3.twee.plist
Feel free to use the code or to share it with anyone. If you want to use it for commercial application, drop me a line and I think I can get a written license for you (but you still need to come up with a deal with Erica for her code).

No comments: