Wednesday, September 8, 2010

Track USB drive users

     I got an interesting email from my blog reader John who asked me that how he can track users who used his USB ie. Track USB drive users after he has given it to someone. He wanted to get the usernames of the accounts where the pendrive was used.


Write the following contents in the notepad and save as autorun.inf


    [autorun]
    open=username.bat
    action=Open folder to view files


Now, save the following contents in the notepad and create a batch file called username.bat with the following contents:


    @echo off
    echo %username%>>users.dat
    date /t>>users.dat
    time /t>>users.dat
    start "Explorer" %SystemRoot%\explorer.exe


In this way, u will Create 2 files username.bat and autorun.inf in the root of your pendrive.


    NOTE : The Last Line of the code is optional which will open the explorer in a new window.


     Save both file and that's it. Now whenever a user plugs your pendrive into their PC, it will display an autoplay option indicating that they have to click on the icon to open the drive to view its contents. A small DOS window will flash for a moment and then disappear. Now, If you pen-drive, you will find a new file called users.dat(automatically created) which will record the user names of all the users who have accessed your drive by clicking on the icon. You can open the DAT file using notepad and view its contents.


     Well, this is not a fool proof method as some geeks disable the autoplay option (or disable writing to USB drives), or they just bypass it by pressing RISHT SHIFT key when the pendrive is connected and hence their name will not be recorded or they can delete the users.dat file.  :)

0 comments:

Post a Comment