Web Design & Development

Catching the Crook Who Stole Your Laptop!

After reading multiple articles, on how people had managed to catch crooks who had stolen their laptops, and reading xkcd. I thought i might as well try creating my own solution.

Before I go any further, this solution is a Mac OSX solution, and requires, that you have some webspace, with FTP access.

I will explain what I wanted the software to do, and how it accomplishes these aims.

  1. Firstly I wanted the software to recognise if the laptop has been stolen.
  2. If the laptop is stolen, take photos of the user, and upload them to my webspace,
  3. As well as uploadinging photos of the user, record their ip, and upload a copy to my webspace.

The above 3 points were the basics of the app. However after reading xkcd, i thought it would be cool to get the application to announce to the world (via its speakers) that it is stolen property, at full volume.

Now i have told you what i wanted the app to be able to do I will explain, how it actually does it.

The way the app works, is firstly trys to access the a page on your webserver, for this example, im using this webserver. The page will contain one of three things. Either

unstolen

or:

stolen

or:

stolen-shout

Depending on what is contained in the file, depends on what the script does.

If the laptop is in either the stolen or stolen-shout states, then steps 2 & 3 will be invoked, whereby the laptop will take photos of the users silently, as well their ip address. However if the laptop is retrieves the stolen-shout state, it will then turn its volume up-to level 5 of a possible 10, and shout out that the laptop has been stolen, and keep doing this until the process is killed, or the laptop is shut down.

The hardest part of the script was, getting my Mac’s webcam to take a photo and save it, but luckily enough i cam across the wacaw script which is released under the GNU/GPL license, which is free to use and distribute.  ( you can get it here). So anyway to cut to the chase the script is below:

#!/bin/bash

# Get Date & Time
DATESTRING=`date “+%Y_%m_%d%.%H_%M_%S”`

# Get status message and save it to status.txt
curl –basic http://www.jhlabs.co.uk/wp-content/uploads/2009/01/laptop-status.txt -o status.txt
# Get a list of all wifi points
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s > $DATESTRING.wifilist.txt
# Get Users IP Address.
curl –basic http://www.jhlabs.co.uk/wp-content/uploads/2009/01/laptop-ip.php -o $DATESTRING.ip.txt

# Read the message
T0=$(cat status.txt)
T1=unstolen
T2=stolen
T3=stolen-shout

# FTP Details
server=ftp.server.com
route=public_html/laptop-stolen-photos/
password=serverpassword
username=serverusername

# Check if the Laptop is Safe
if [ $T0 = $T1 ]; then
# If the laptop is safe, do nothing.
  echo All is well
else
# The laptop has been stolen! Do the following:

# Upload the user’s ip file.
    curl -v -T $DATESTRING.ip.txt ftp://$username:$password@$server/$route

while [ 1 ]; do

# Take a Picture, Say Cheese!

# Take the picture (save it sas buggered underscore date and time . jpeg)
        ./wacaw -n 10 –jpeg  –VGA  gotya/buggered_$DATESTRING

# Shout Out It Has been Stolen?
            if [ $T0 = $T3 ]; then
say -v alex This Laptop Has Been Stolen! | osascript -e set volume 5
fi

# wait 2 seconds, repeat procedure.
        sleep 2

# Upload the photos
        curl -v -T gotya/buggered_$DATESTRING.jpeg  ftp://$username:$password@$server/$route

done

fi

Photo by Grimages


Tags: , , , , , , , , , ,

2 Responses to “Catching the Crook Who Stole Your Laptop!”

  1. Adam Says:

    * Something can’t be “unstolen” - it can be “not stolen” but, unstolen implies that it was stolen and then returned ;)

    * You’d be much better transmitting data over HTTP rather than http://FTP. You can easily use curl to send POST data to a PHP script which will then email it to you.

    * Don’t say anything about it until you’ve got the data - sleeping after telling them they stole your laptop before uploading their picture is unwise.

    * This person just stole your laptop - do you really want to give them the FTP details to your server in plain text? They can quite easily open this up, logon and remove the data. Hence, why an HTTP post would be wise.

  2. jh labs » Blog Archive » Catching the Crook Who Stole Your Laptop! Says:

    […] here to read the rest:  jh labs » Blog Archive » Catching the Crook Who Stole Your Laptop! Categories : Laptops, image, software Tags : crook, development, jh-labs, photos, […]

Leave a Reply