Saturday, April 23, 2011

Decoding email attachment

Yesterday, I received an email with an attachment (in gmail), but for some reason it showed the attachment was there, but no download link (though it appears now). Wanting to view the attachment, I did some brute force hackery. In gmail you can hit the link "show original" which shows the original text of the email, including the attachments. So I saved this as a text file, deleted everything but the base64 encoded data (i.e the attachment). Then I used the base64 command line tool (imaginatively called base64), that everyone should have installed already, to decode this data, and to just a little surprise, it all worked. I was quite pleased with that. I also just had a look at the wikipedia page for base64 encoding to see how it works. You should too, it's quite simple, but effective.

No comments:

Post a Comment