| | Stumble It! | Add to Mixx! | | diigo it | | Slashdot |

Saturday, September 6, 2008

How I Roll - EeePC Security System

It's been a while since my last installment of the "How I Roll" series and following the completion of my EeePC Security System I thought it would be a good time to break that silence.

A few days ago I read an article on Lifehacker about how to set up your laptop with a security system to help you prevent it from being stolen and how to recover it if it is stolen. Unfortunately for me, the article only addressed solutions as they relate to Windows & Mac OS machines. Since I run Ubuntu on mine I was out of luck, but I really liked the idea so I set out to use the same methods described in the article on my EeePC.

Step 1 - Prevent theft.
No matter how many tricks you play or traps you set, no piece of software is better than common sense. Don't leave your lappy unattended.

Step 2 - Recover it.
So for one reason or another your lappy has grown legs and made off with itself. Now you need to get it back. The Lifehacker article mentioned one solution that sounded an audible alarm when certain physical actions occured like closing the lid or unplugging the power. While I didn't favor the noisy car alarm solution, I could appreciate detecting physical actions triggering something. In another part of the article, a Windows solution was mentioned that would use the webcam to detect motion and start recording. Again, a bit extensive for my lappy since I've only got a 4GB hard drive and I didn't want to leave my webcam on all the time.

My solution was to use the same physical actions to trigger the webcam to take a picture.
The triggers I decided to use were unplugging the power, booting the lappy, and hourly. Below is the core code I used to actually snap the pics:
fswebcam -d /dev/video0 -S 14 -F 1 --set brightness=75% --bottom-banner --title "this is what I saw at" --timestamp "%d-%m-%Y %H:%M:%S (%Z)" --font /usr/share/fonts/truetype/msttcorefonts/arial.ttf --jpeg 95 --save /home/bandit36/www/.hourly-user.jpg

fswebcam = the application that takes the pic
-d /dev/video0 = my webcam
-S 14 -F 1 = skip the first 14 frames, take 1 frame (it takes about 14 frames for the webcam to normalize the picture
--set-brightness=75% = duh
--bottom-banner = puts the following text on the bottom of the pic
--title "this is what I saw at" = to distinguish which trigger keyed the photo
--timestamp "%d-%m-%Y %H:%M:%S (%Z)" = shows the full time/date/zone that the pic was taken
--font /usr/share/fonts/truetype/msttcorefonts/arial.ttf = the font for the banner text
--jpeg 95 = sets the quality of the picture
--save ~/www/.hourly-user.jpg = saves the picture as a hidden file (the leading .) to a www directory in my personal folder
By slipping this code into the scripts that already ran when my triggering events occured I was able to save the picture as captured by the webcam at that moment. The next trick was getting the pictures off the computer automatically. I struggled with various email & FTP automation methods for a couple days. The closest I came was using ncftpput, but I don't have FTP space anywhere. The solution that I came up with was to use Conduit to upload the photos to a Picasa account created specifically for the purpose. And it worked!

*** Update 1 - after initial success with Conduit I ran into problems overwriting the same file automatically. Conduit unfortunately requires user intervention to upload and has issues overwriting files. Keeping with the theme of uploading to a photo hosting site I looked into the extensibility of Flickr and found gold again at Lifehacker.
*** Using the script mentioned here, I figured out how to auto upload photos to Flickr, but again ran into problems because the Python script differentiated new pictures by filename, not date. After digging through the code for a bit I found a file called uploadr.history. I added this line to my hourly script to delete the .history file before taking the next picture and uploading the pictures.

w00t!

Now my lappy takes pictures whenever it loads the boot screen, gets unplugged, and every hour and uploads the pictures to a Picasa account so that I can view them anywhere. This solution is great, but doesn't address locating where the lappy is, only who has it. Solving that part of the problem was pretty straight forward - DynDNS. Using DynDNS I just have to ping a certin URL and I'll get the IP address for where ever it's logged in. Combining that information with the photos I should be able to collect enough information to track down someone who steals (finds) my sweet little lappy.

0 comments: