Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: mikee93 on April 03, 2021, 02:34:06 PM

Title: hidden marking
Post by: mikee93 on April 03, 2021, 02:34:06 PM
Hi!

How can I make the systen to put some sort of tracking in a file that was downloaded (user name, or something like that) ?

Thanks in advance for the reply

Title: Re: hidden marking
Post by: shadav on April 03, 2021, 02:45:51 PM
um....pretty sure that's unethical....but, for what purpose? and version of smf? and which mod are you using for downloads?
Title: Re: hidden marking
Post by: mikee93 on April 03, 2021, 03:15:27 PM
Workplace website. Files are constantly leaking and I want to know who it was. I don't use any way
. 2.0.17
Title: Re: hidden marking
Post by: shawnb61 on April 03, 2021, 03:26:59 PM
The practice is called dynamic watermarking.  There are a lot of commercial products that help you do that.  I'm not aware of any SMF mod to integrate with any of them.

Pretty common in highly competitive businesses for things like pricebooks, pre-release marketing materials.  At the very least, if you find a sensitive doc in the wild, you know which logon was used to download the doc.

The watermarks can even be hidden & imperceptable. 
Title: Re: hidden marking
Post by: Sir Osis of Liver on April 03, 2021, 03:56:01 PM
Do you want to track only attachment downloads?
Title: Re: hidden marking
Post by: mikee93 on April 03, 2021, 04:06:23 PM
Quote from: Sir Osis of Liver on April 03, 2021, 03:56:01 PM
Do you want to track only attachment downloads?

The point is, if something comes out of the forum, I know who it was. That's why I wanted some kind of solution so that when someone downloads something, they put in some signal for each member
Title: Re: hidden marking
Post by: Sir Osis of Liver on April 03, 2021, 04:09:05 PM
You didn't answer my question, are we talking about attachment files?
Title: Re: hidden marking
Post by: mikee93 on April 03, 2021, 04:10:44 PM
Quote from: Sir Osis of Liver on April 03, 2021, 04:09:05 PM
You didn't answer my question, are we talking about attachment files?

Yes!
Title: Re: hidden marking
Post by: Sir Osis of Liver on April 03, 2021, 04:14:44 PM
Display.php



// Download an attachment.
function Download()
{
global $txt, $modSettings, $user_info, $scripturl, $context, $sourcedir, $topic, $smcFunc;

log_error('Attachment download');

// Some defaults that we need.



Every download attempt will log an error, giving you username, ip, timestamp, and id_attach.
Title: Re: hidden marking
Post by: mikee93 on April 03, 2021, 04:35:20 PM
Quote from: Sir Osis of Liver on April 03, 2021, 04:14:44 PM
Display.php



// Download an attachment.
function Download()
{
global $txt, $modSettings, $user_info, $scripturl, $context, $sourcedir, $topic, $smcFunc;

log_error('Attachment download');

// Some defaults that we need.



Every download attempt will log an error, giving you username, ip, timestamp, and id_attach.

syntax error, unexpected end of file
Title: Re: hidden marking
Post by: Sir Osis of Liver on April 03, 2021, 04:38:28 PM
You just add the one line as shown, don't change anything else.
Title: Re: hidden marking
Post by: shadav on April 03, 2021, 05:07:47 PM
sorry I thought you meant as in placing something on their system....not as in for your end to know who downloaded the file

to show who downloaded attachments: https://custom.simplemachines.org/mods/index.php?mod=4146

though this isn't going to really help if you find it uploaded somewhere else...but you could always send a DMCA to where it's uploaded at.
Title: Re: hidden marking
Post by: mikee93 on April 04, 2021, 04:57:23 AM
Thank you all for help but you might have misunderstood me. I want the mark on the file itself. If a person downloads them and it gets out on the net, i could see who was it. I want to see a solution for this.
Title: Re: hidden marking
Post by: @rjen on April 04, 2021, 05:23:38 AM
That would require some sort of watermark being automatically applied to a file on download. Pretty sure no such solution exists. Mind you: you did not mention a file format, so theoretically a download could be anything: pdf jpg doc xls exe zip etc....

How do you expect any tool to watermark any file type ?
Title: Re: hidden marking
Post by: mikee93 on April 05, 2021, 06:48:34 AM
i ended up solving it with this code:

Quote$filename = getAttachmentFilename($real_filename, $_REQUEST['attach'], $id_folder, false, $file_hash);

$h=fopen($filename,"r");
      $tartalom = fread($h, filesize($filename));
      fclose($h);
      //$file["type"] = "application/pdf";
      
      $file["name"] = $real_filename;
      $file["content"] = $tartalom."*".$context['user']['id'];
      
      pushfile($file);

}

But if they convert the file, the ID disappears. Is there any idea to sove this?