Wednesday, December 10, 2008

How to get your lost pen drive returned to you

Pen drives are so small that they can be easily misplaced and even lost. How do you make sure that your lost drive is returned to you by the finder? Leave you name and contact info in the drive? Yes, but we will do it a different way. First we will look at a software that displays a message when a pen drive is accessed, and then we will implement the same thing with our own coding.

USB Lost and Found is an interesting piece of software that informs the finder of a lost pen drive about the rightful owner of the drive. The free edition of this software can display a user configured message whenever the USB drive is accessed.

usblafss1

The tool is actually quite simple: it creates an executable application called “setup.exe” on the root of the pen drive, that displays an alert box with the owner’s email or phone number, and then causes this application to auto launch by creating an auto.ini file. The program is basic and does not prevent anybody from keeping the drive. The programs executable along with the autorun file can be simply removed and the thumb drive kept. However, there is a fair chance that a good citizen will return the drive to you.

usblockfound

USB Lost and Found pro version is different and provides a layer of protection to your pen drive by enabling you to password protect it, in addition to the reminder message. A “Locked Down” pen drive is inaccessible without the password and hence useless, and so he or she is likely to contact you and have it returned. At a price of $3.5 it is quite cheap. (Thanks gHacks)

Now the fun part: let’s make a pen drive display a message whenever it is plugged into the computer without using USB Lost and Found or any software.

Copy the following code, paste it in Notepad and save it with the extension .HTA.

<HEAD>
<HTA:APPLICATION
border="thin"
borderStyle="normal"
caption="no"
maximizeButton="no"
minimizeButton="no"
showInTaskbar="no"
WindowState="maximize"
innerBorder="yes"
navigable="no"
scroll="no"
scrollFlat="yes" />
</HEAD>

<body STYLE="filter:progid:DXImageTransform.Microsoft.Gradient

(GradientType=0, StartColorStr='#000000', EndColorStr='#0000FF')">
<script language="VBScript">
    Sub Window_onLoad
        Msgbox "This USB drive is lost. Please contact XXX to have this returned. Thanks"
        self.close()
    End Sub
    </script>

</BODY>

Replace the line within quotes next to Msgbox with your own message. You can also change the background color and even add a background image to it. The parameters inside the <HEAD> and <BODY> tag are self explanatory. It’s all HTML.

Create another file called autorun.ini and paste the following lines. Replace ‘message.hta’ with the file name of the HTA file you created in the previous step.

[autorun]
OPEN=message.hta

Copy both the autorun.ini and the HTA file to the root of the pen drive. Now every time the pen drive is accessed, it will make the complete screen go blue and display your message.

warning

Pretty cool, huh? To make it a little hard for the finder to figure out what’s going on, make both the files hidden. Read more about coding HTA applications.

9 comments:

  1. Nice implementation. But...

    What if finder is a Linux user. What if he or she block autorun-mode of removable devices in Windows.

    But topic is useful. :) I loast my drive in bus a month ago...

    ReplyDelete
  2. Hi , please not that it do not work . Newer! Look this : Q: What must I do to trigger Autorun on my USB storage device?
    The Autorun capabilities are restricted to CD-ROM drives and fixed disk drives. If you need to make a USB storage device perform Autorun, the device must not be marked as a removable media device and the device must contain an Autorun.inf file and a startup application. (from http://www.microsoft.com/whdc/archive/usbfaq.mspx)

    ReplyDelete
  3. This simply does not work!

    ReplyDelete
  4. Not working...... Stupid coding

    ReplyDelete
  5. i forget my key of my pendrive & i lost my pendrive 1 day ago its contains huge important files & the software is asking key can anyone help me through this ...its very important for me please

    ReplyDelete
  6. your dream idea of bringin the pd bac to the user is osum,which dint work practically..:(:(

    ReplyDelete
  7. i lost my pendrive how can i find or corrupt that i dont want to use that others

    ReplyDelete
  8. i lost my pen drive it contains huge data plz help

    ReplyDelete