Friday, August 14, 2009

PC Phone Home (Do It Yourself)

Some time ago I downloaded an evaluation copy of the for-sale PC Phone Home, and reviewed it here and here. I did not recommend PCPhoneHome in that review, and some of the comments left by readers are quite interesting too. Bottom line - at that time it seemed to be mostly a scam, because even if it did work there was no way to get a response from the company if your computer was stolen. Your results may vary.

I had never done anything with Windows scripts, but I studied up a little, and it turns out that you can fairly easily create a pc-phone-home batch file to be executed by the Task Scheduler at system startup. This batch file can automatically send you an email describing the computer, time of day, IP address, and whatever else you wish to add. No changes to the registry (except those made by the Task Scheduler), no secret code, no risk of a trojan in the system, everything is done with standard Windows command-line commands plus one well-proven, free, open-source SMTP mail sending program called BLAT. The same batch file runs on Windows Vista Ultimate, Vista Home Premium, XP Professional, and XP Home Edition, probably all Vista and XP systems, and even Windows 7, though testing is not complete on Win 7. It will not work on earlier Windows systems, and has only been tested on XP and Vista systems that are fully up to date, SP3 and SP2 respectively.

On my computer, the batch file is called BootMail.cmd. Its weakness is that it may be easier for a thief to find and uninstall BootMail than PCPhoneHome. But that would require a knowledgable computer thief, which may be an oxymoron. And there are things that you can do, like hiding the BootMail.cmd file somewhere in the operating system and renaming it something innocuous like GoogleHelper.cmd. In addition, if there is no network found at bootup, it will not lurk in the background waiting for one to show up. I may add that someday.

Previous experience with Windows scripts and with the Task Scheduler might be helpful to a person installing this software, but they are probably not required. I got by somehow, and you may be able to make some simple modofications and otherwise use the example code exactly as is.

BootMail is designed to phone home at system start, but it could easily be modified to run on different triggers, such as the network coming back up, or a disk error, or any other event that is logged by Windows. There are lots of those, especially in Vista and Windows 7. Of course a user knowledgable in windows commands can also modify the information that it displays. Click here for an example of the email message that it sends.

To make it work:
  • Copy the code from this page into a file with a .cmd type extension, e.g. bootmail.cmd. Modify it for appropriate email addresses and user names. See code comments.
  • Download the small BLAT program from www.blat.net and put the executables where Windows will find them. See code comments.
  • Use the Task Scheduler to set up bootmail.cmd to run at system startup. See code comments.
  • Set debug=TRUE at first, until you get it working.
The code looks big, but it's mostly documentation (every line beginning with ::). If you prefer not to do the screen copy, you can download both the code and the example email text in a zipped file here. The files are very small.

What I DON'T know is what to do if a computer is stolen and I do get an email. There is enough information in the email to pinpoint the exact IP address from which it was mailed, but how does a person proceed with that? I guess I'd call my local police, or perhaps better yet the cops at the address where the IP address is owned, as determined by WHOIS. Will the police even care about one stolen computer? Anyone have a better idea?

2 comments:

Unknown said...

I like it. Great idea. Thanks.

Gary said...

Anyone have a way of attaching an snapshot from a webcam to the email along with the other information it sends.

I guess it would have to be added to the batch file in some way.