Phoning Home

Phoning Home

I was looking around the ‘net a few weeks back when I stumbled on a discussion thread about what to do if your Macbook Pro was stolen. The focus was mainly on scripts which would access a website (which would leave an IP address in the log files), emailing certain information to the owner, and taking photos with the built-in iSight. The idea intrigued me, so I wrote a script.

Basically, the idea is this: Assume my MBP gets stolen. I login to my website and change a webpage to signify that the system is stolen. Once the thief gets logged in to the MBP (I make this easy by providing a guest account with no password) and gets network access, the system reads that webpage and sees that it’s been stolen. It then executes a series of commands, takes a photo with the iSight, and emails the results to me. I’ve written the script so that in addition to having the system email me, I can also add a series of commands to the webpage and the script will execute those as well.

I dumped the script into root’s crontab, configured to run every 15 minutes. Since it runs as the root user, there’s no permissions problems. I’ve been playing with it for a couple of days now and it seems to work fine. But I’m sure there’s more than a few bugs which need to be worked out.

This solution isn’t limited only to laptops. It should work with any *nix-based computer. There’s a command line option (-nophoto) you can use for systems that don’t have a camera.

Now, before I tell you how to get the script, let me preface with this warning: This is a very non-Apple, extremely *nix-oriented solution. There are no plists, there is no GUI, and it requires a lot of digging around the command line to get it working. I haven’t written an installation script yet, so if you want it to work, you’ve been warned. It’s all written in Perl and I believe all of the modules it uses come standard with Perl 5.8, so if you’re running OS X 10.4, you should be okay.

You can access the latest version of the script by using the following command:

svn checkout //svn PhoneHome

Most of the documentation is complete, but if you have any problems getting it configured, feel free to drop me a line.

In the package you’ll find an installation guide and the configuration file is completely commented. You can also perldoc ./ or ./ -help for more documentation.

I seriously need to get a life.

Edit: Yes, I am aware of iAlertU and I hope that works out to be an awesome solution. However, I wanted a solution that would work on both OS X and Linux. (Note: If you don’t want to use isightcapture, my solution is flexible enough to use iAlertU’s camcapture utility.)