Home » Blog
date 9.Dec.2018

■ DIY anti-theft location tracker for your laptop

We live in a small village in a small island, and until recently we enjoyed a quiet lifestyle, kids playing free in the countryside without a care in the world. We hardly ever locked our house doors. But last month clouds gathered over our little paradise. We lost our kitty, then somebody nicked Vanessa's bike, and finally somebody snatched one of our flower pots from the garden! Whatever next?

Our village thieves — devil take them — seem small time, but what if they go up in the world and start stealing mobile phones and laptops? With smartphones, tracking is easy, The Google knows all your whereabouts (aka Google timeline) and could give you a trace of your smartphone location. So what you lose in privacy at least could help you find your stolen mobile phone.

Laptops and notebooks on the other hand don't usually come with a SIM card or GPS beacon. There (must be) anti-theft software to buy to help track your stolen computer, and on windows 10 there is even a free (Microsoft) Find My Device app to help you find your lost device. I don't understand how this Find My Device app works, but it requires logging in with a microsoft account, and that defeats the anti-theft purpose!?

Anyway, here is another simple laptop computer tracking idea: every time the computer boots, access a website PHP page and log the access (caller's IP address, date and computer name). Obviously you need to have a website for this to work, but I do <g>. Then in case of theft, each time the village idiot thief restarts the laptop, his IP address is logged and could be passed to the police to track him down. If police can use IP addresses to convict people of illegal downloads, it means that it must be possible to track down thieves too!

No special programming skills are required. On the laptop I use the following WSH script that accesses the beacon website PHP page each time the computer starts up:

REM BEACON.VBS runs on each computer boot
Set oShell = CreateObject( "WScript.Shell" )
strComputerName = oShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )
set wbr = CreateObject("InternetExplorer.Application")
wbr.Visible = false
wbr.Navigate("http://yoursite.com/monitor.php?c=" & strComputerName)

Save this BEACON.VBS script wherever you like and use REGEDIT to add it to the list of programs that start automatically each time you reboot the laptop (under registry key HKLM\Software\Microsoft\Windows\CurrentVersion\Run — storing in HKCU\run is probably not a good idea because the thief will not have your login password). All it does is use a hidden internet explorer window to touch our MONITOR.PHP page, passing the name of the computer as an argument. This lets you track multiple computers if need be.

Server-side, all the PHP script is doing is updating a text file with the caller's IP address as such:

# MONITOR.PHP log the IP address of this access, trace of laptop location
$log = date("Y-m-d H:i:s") ."\t". $_SERVER[REMOTE_ADDR] ."\t". $_GET['c'] . "\r\n";
file_put_contents ( "beacon.log", $log, FILE_APPEND );

So there you have it, laptop anti-theft monitor with location tracker on a shoe-string to keep petty criminals at bay <g>

Post a comment on this topic »

Share |

©2002-2018 ZABKAT LTD, all rights reserved | Privacy policy | Sitemap