Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

How to extract an attachment from an email header?

Writer Andrew Mclaughlin

I recently got an e-mail with an attached JAR file. However, my e-mail client considers it malware and is not letting me open it.

I've opened the actual e-mail, and found the attachment, which seems to be encoded in Base64. How would I take this and turn it back into a Jar file?

2 Answers

Assuming you've isolated the part of the email containing the base64-encoded file, the process for decoding the file is as follows:

base64 --decode < [in_filename] > [out_filename]

...where [in_filename] is the name of the file containing the base64-encoded data and [out_filename] is the name of the file that will contain the decoded results.

For the curious, the base64 command is provided by the coreutils Install coreutils package, which is considered an essential package and therefore should always be available.

3

The uuencode / uudecode sisters are exactly what you want (to install do sudo apt-get install sharutils).

  1. Start by extracting the Base64 text from the attachment. Save it somewhere (for the example, it'll be at ~/attachment.jar.b64).
  2. Open up a shell (and if necessary, cd to the right directory)
  3. Run the below command to actually turn it into a Jarfile:

    uudecode -o attachment.jar attachment.jar.b64
  4. Enjoy!
5

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy