A simple way to track your macbook using the isight
These instructions are for how to implement a simple laptop tracking script on any Mac laptop. With OS X > 10.5. All of the files for this can be found in the following github repository. Download the following:
Download isightcapture and mount the image once the download is complete. Copy the ‘isightcapture’ executable to either /usr/sbin or /bin/ (I placed it into /bin). Download sleepwatcher to your Desktop and extract the archive. After it’s extracted, fire up terminal.app and enter the following:
You'll then need to add a bash script to be executed when your laptop wakes.
You'll want to save this file as
/etc/rc.wakeup. You can use
the following replacing the relevant parts:
Don't forget to make sure that the rc.wakeup file has the appropriate read/write attributes. Once you've saved it in the appropriate directory, enter terminal, navigate to the directory the script is saved in and enter the following command:
You'll notice that the ip is obtained by the 'get_geoip_data' python script. Create a file in the directory specified in the bash script, with the filename get_geoip_data.py and fill it with:
In order to use this script, you'll need to have the Beautiful Soup python package
installed. If you have easy_install, you can install it with
easy_install BeautifulSoup, or you can install it from source
by going to the website
Finally, you need to set up the configuration file that is going to be handled by the LaunchDaemon. Create a file called sleepwatcher.plist and fill it with the following:
You'll then need to copy the configuration file to
/Library/LaunchDaemons/ and enable the LaunchDaemon
by entering the following command:
You should now be good to test that everything is working by closing the lid on your laptop and then reopening it. You should find a photo of your face in your photos directory. To make sure that you get the most value out of it make sure to use it with Dropbox and ensure your photos directory is being synced or alternatively, change the relevant directories in the bash script for the appropriate directory in your Dropbox folder.
For additional fun, you can sync these photos with your Facebook, Flickr or Picassa albums through their REST APIs, or use a different cloud storage solution so you can see who is using your device.
If you get stuck, feel free to email me.