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.
bs98909Asked:
Who is Participating?
 
Adam314Connect With a Mentor Commented:
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.pl?file=/the/file/to/download.txt">download</a>


##### In perl
#!/usr/bin/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>;
close($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
binmode(STDOUT);
print $data;

Open in new window

0
 
bs98909Author 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??

0
 
Adam314Commented:
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.
0
 
bs98909Author 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 "download2.pl.jpeg" rather than "image001.jpg"
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.