Need a honey-pot file creator for a web site

I'd like to find a means via html/cgi to create a "honey-pot" so that when members go to our web site and download the file that it can be tagged some how.

I am tried of finding our hard work being stolen by others - so I'd like to have a dynamic link where each member would have the option to follow the link to download a file. This file needs to be marked somehow with their IP and or their member ID since they will have to sign in to get to it.

They are posting anonymous on competitor pages so I don't know who they are -- C&D letters to the vendor are being ignored. But that is another story.
Brian Sretired geekAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You could do something like this in perl:

##### In your HTML, make the link to the file be like so:
<a href="/cgi-bin/">download</a>

##### In perl
use strict; use warnings;

my ($fn) = $ENV{QUERY_STRING} =~ /file=(.*)/;

#Get username here from login info...
my $user='some_username';

#Check that user has permission to download file here
#or, at very minimum, that file is one allowed to be downloaded
# (otherwise, users could use this to download *ANY* file on your server)

#Open file, read in to memory
open(my $in, '<', $fn) or die "Could not open file: $!\n";
local $/;
my $data = <$in>;

#Make change to file, to include users IP or username
#Note that, depending on the file type, you might not be able
#to change the length of the placeholder, so include some blank buffer
#space in it
$data =~ s/PlaceHolderForIP/$ENV{REMOTE_ADDR}/;
$data =~ s/PlaceHolderForUsername/$user/;

#Send modified file to user
print $data;

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Brian Sretired geekAuthor Commented:
Question -- would this type of tagging work if the files were in a zip? Meaning I cannot add any size to it, but I can change XML enocoding??

I'm not familiar enough with zip files to know for sure, but I think they contain checksum data.  If so, it would be incorrect if you did this; you would have to unzip the file, change the file you want to change, then re-zip it.  If it doesn't contain checksum data, then you could do this as long as you maintain the zip structure.
Brian Sretired geekAuthor Commented:
Question on this topic

How can we get the displayed image output to be the name of the file that was input?

Currently when I do a "Saveas" the file name is "" rather than "image001.jpg"
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.