At work, colleagues and I are working on network shared directories. Just like everybody else I guess : you have a personal directory bound to your login username, and you are granted access to various shared directories where various people also have read / write permissions.
I've been doing some fun experiment these past few days at work : creating an Excel document with an appealing name (say, "salary_augmentation.xls", burried deep into "Confidential\HR\Budget\") and silently logging usernames everytime someone loads this file.
Here is how I did this :
Create a silly file
That's the easy step : create a file with a name so sexy that you're sure anyone seeing it will compulsively double-click it everytime they spot it. Any filename related to human resources and budget will surely trawl some fishes.
Then add some irrelevant content. A flashy red box reading something like "Did you really think I was going to tell you something secret" will do the job : you don't need more than people going "pfff moron" and closing the file.
Add the following Visual Basic
Add the following Visual Basic code to your excel document (the menu should be something like Tools / Macro / Visual Basic Editor)
- Private Sub Workbook_Open()
- Dim filenum As Integer
- Dim i As Integer
- Dim fic As String
- filenum = FreeFile
- '// Get a free file number
- logfile = "Z:/path-to/non-appealing/directory/sql.log"
- '// A text file located and named so that it won't be looked at
- Open logfile For Append As filenum
- '// open the file
- Print #filenum, Environ("UserName") & Chr(13)
- '// write username to the file
- Close filenum
- '// Close the file
- End Sub
Be sure to add this macro code to your Excel document and not in your personal Macros (perso.xls). To do so, add the Visual Basic code to ThisWorkBook of your current document.
Create a log text file
Create a blank text file, named and located so that it won't be interesting. Something like sql.log in the most boring directory you'll find. Modify the code above so that logfile points to this file.
Even better, make this file hidden if possible (right click, Properties, check "Hidden file")
From now on, everytime someone loads your sexy Excel document, their username will be appended to your log file. Just check back from time to time and just be amazed by the number of employees who just seem to wander from directory to directory, looking for stuff that are normally not of their business :-)
Want to share or tweet this post? Please use this short URL: http://ozh.in/9n