Introduction: Laptop Recovery

So recently I got a last generation powerbook, my first laptop. Even though I back up my data, I would still rather not have it stolen. Or, if it gets stolen, I'd like to be able to get it back. After looking online for a free solution, I found LoJack for Laptops. Sounds like it would work, but you have to pay a subscription. I don't want to have to pay money to have a 3 in 4 chance (straight from the website) of getting my laptop back if it's stolen! So I rolled my own using python and an ftp server. The program starts running in the background every time you log in, and every two minutes it checks with an ftp server to see if I've flagged it as stolen. If I have, it takes a screenshot and uploads it with the current IP address and a timestamp to the server, and keeps doing it every two minutes until I have it stop. While it won't do remote data deletion, it could pretty easily - I just didn't want to risk accidentally triggering it while testing.

Step 1: Requirements

To make your own copy of the script, you'll need the following:
1. An apple computer running a fairly recent version of OS X

2. Apple developer tools - these are necessary to compile the script into an application that can start running every time you log in. The mac-development only package is fine. Be warned, this is a pretty big download, but it's definitely worth it if you are interested in coding anything on a mac ever.

3. An apple ID - it lets you register and download the developer tools above.

4. Python - it comes pre-installed with the computer

5. Access to an FTP server - it doesn't have to be yours, but you do need the username, password, and address of a server with ftp access.

6. An empty text file called 'yes.rtf' - keep this somewhere on your computer but don't upload it to the server yet
 

Step 2: Getting the Script

You won't need to create the script yourself, but you will need to edit the one attached. Up at the top where it has the variables:

serveraddress
username
password
path_to_screenshots
time_between_screenshots

fill in your information and desired time in seconds (although I would just leave it at two minutes). This is what the program uses to log into your FTP server and check if you want to upload any pictures, and if so, to upload the screenshots.

Step 3: Creating the Application

Once you've finished editing the python script save it and then close xcode. On your desktop, right click or control click the script (ScreenshotTaker.py) and under "Open With >" choose "Build Applet". An app called ScreenshotTaker should appear in the next couple of seconds on your desktop. This is the final app that we're going to have launch at startup.  

Step 4: Automatically Running the Program

Alright, so at this point you should have a ScreenshotTaker application as well as a ScreenshotTaker.py file on your desktop. If you'd like to delete the ScreenshotTaker.py file you may, it won't be a problem unless your FTP server changes. To get the script running every time you login:

1. Open up system preferences, under the apple logo way in the upper left corner of your screen

2. Click on Accounts

3. Move ScreenshotTaker somewhere it won't be so easy to find - like your utilities folder (/Applications/Utilities)

3. Click on the Login Items tab and drag ScreenshotTaker (the app) onto the list

4. Make sure to check the box making it hidden

Bam, you're done. Anytime you want to start taking pictures of your laptop's screen, drag that 'yes.rtf' file onto the server. Make sure that there isn't already one there if you don't want to take screenshots. Once the 'yes.rtf' text file is dragged into your ftp's main directory (/) screenshots will be taken every two minutes and named like so:

IP Address_Year_Month_Day_Hour_Minute.jpg

To stop taking screenshots, delete the 'yes.rtf' file from your ftp directory.