Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Some perl scripts to help track stolen computers' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Some perl scripts to help track stolen computers
Authored by: wsdr on Aug 29, '06 05:11:04PM
A laundry list of ideas for those who tinker in this kind of stuff:

A simple mod to something like this to keep it from needlessly emailing all the time, assuming you have your own website or server, is to have the unit check-in to a particular page on a regular interval, where the page is normally empty. The script would check for the presence of a keyword, or 1 or True (whatever), like so:

#!/bin/sh
if( curl http://mysite.com/mypage.html|grep 'True' )
then
... run my scripts...
fi


I set this up to run as a cron job as root so that it runs regardless of the state of the system (short of erasure).

That way, if your unit is stolen (assuming you have access to another), you change the page to have your keyword (in this case True), and your script executes. You also get the benefit of your webserver logging the IP address.


Also, to get around the whole firewall/dialup issue, because I have ssh access to my server, I take this one step further, and add to my script a reverse tunnel setup, like so:

ssh -C -f -N -R 45322:127.0.0.1:22 root@myserver.com &

It's clunky, but it works. The -R 45322:127.0.0.1:22 tells the computer to create a tunnel at the remote server on port 45322 back to itself to port 22 (the ssh port) -- this MUST be run as root, or you can't attach to port 22. This also assumes you have set up passwordless logins to the remote server using a hint like this Remote connections without passwords .

Then, once you activate your script, you monitor the logins on your web site logs (or perhaps have your webpage trigger an email to your phone or pager), and you can log in to your remote computer via the tunnel. To do so, you first log in to your server, then from your server you use the following (assuming you used the same ports as above):

ssh -p 45322 your_user@127.0.0.1

Lastly, I use mostly PHP scripts triggered by the cron job shell script. PHP has great mail support, and with the right mods and setup for postfix (ie: setting it up to relay to your mail server over a high numbered, unprotected port), you can be almost certain that if your stolen unit connects to the internet, your message will get through.

[ Reply to This | # ]