News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Decrypt attachment files

Started by side1021, March 03, 2009, 01:53:46 AM

Previous topic - Next topic

side1021

Hello,

Is there any script or mod that can decrypt the files in the attachments folder?  I'm trying to load the attachments in my home page however i just found out that these files are fully encrypted.

Thank you very much!

Dragooon

You can fetch the file's names from DB and then show that name(Or even decrypt them that way).

side1021

thanx for the reply.  Yes, the filename is visible in the database (smf_attachments table) however I'm not sure how useful it is other than renaming the encrypted file back to it's original name.  Once you have renamed it back to its original name you still can't use it (still encrypted). 


Dragooon

You can grab the original filename....get its encrypted form(Should be getAttachmentFilename in Subs.php) and then rename to encrypted version to the decrypted one or another way is to get the attachment's from the database rather then from the file system.

side1021

Hi,

Thanks for further clarifications.  I used the getAttachmentFilename() to get the encrypted name.  I then renamed it back to original name.  However it's not the same anymore.  The problem I'm now facing is how to decrypt this file.

I've looked into Display.php and still can't figure out how SMF decode the file and show it to the user.


Please help!

Dragooon

The file's content are not decrypted...attachment are sent along with the appropiate content-type header and some other headers.

side1021

#6
Thanks Dragoon.  I got it working now.  :D

Short summary of my mistake: 

The files in the attachment folder are renamed with MD5 hash.  These files don't have an extension.  I transferred these files to my computer using ftp client (filezilla).  Afterwards I renamed them with their original file extension (.JPEG).  When I tried to open these files using whatever image viewing program, all didn't work.  However if I give them an file extension by rename it in filezilla before transfer, they all works!  It looks like transfer type plays a role in this kind of behavior.   The ftp client didn't know what I was transferring since it's missing a file extension (in my case a JPEG), thus it was using whatever transfer type other than binary. 


Advertisement: