You are not logged in.

#1 2008-11-21 05:12:27

oxoxo
Member
Registered: 2008-10-31
Posts: 66

Reading attachment files

Greetings,

When i do a 'ls -l mbox' all the messages in my inbox will appear as one big chunk of text.

I can write a script to limit what is read by finding a certain string specification in the subject feild.

But lets say these files that i need come with attachments and I cant see the attachment by just ls -l mbox.

I need to be able to read the files that are attached to my messages!

Help!

Offline

#2 2008-11-21 06:01:49

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: Reading attachment files

Have you thought about a mail client, perhaps, to parse the messages for you? Mutt would be a good command line client. Takes a bit to configure, but can deal with mbox and maildir mailboxes. The wiki has a good section on basic configuration, and there's plenty of other online info about getting it to view your various messages and attachments.

Good luck!
Scott

Offline

#3 2008-11-21 06:15:11

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

Re: Reading attachment files

The 'mail' command has a lot of commands that can be passed to it via the command line for dealing with e-mails.

Offline

#4 2008-11-21 07:17:54

oxoxo
Member
Registered: 2008-10-31
Posts: 66

Re: Reading attachment files

I've searched the net in and out to try and find some example relevent to my question.

I think my problem might involve decryption.

With this code:

cat mbox | sed -r 's/From /END====From /' | sed -n 'H; ${g;s/\n/+=+/g;p}' |\
sed 's/END====From/END\nFrom /g' |\
egrep ".*Subject: *hello*" |\
sed 's/+=+/\n/g' > helloFile

I can then go to emacs and view the contents of what i just appened to the helloFile file.
I can read the actual message, then further down in the text i get eennncryption, and i know that is the contents of the attachment .txt file

How can i decode this?

Content-Disposition: ATTACHMENT; FILENAME=wow.txt

KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq
KioqKioqKioqKioqKioqKioqKioqKioqKioqKioNCiAgICAgICAgICAgICBH
UkFESU5HIEZPUiBDUzE0MFUgTEFCMw0KICAgIE9TIHVzZWQgZm9yIGdyYWRp
bmc6IExpbnV4DQpTeXN0ZW0gdXNlZCBmb3IgZ3JhZGluZzogc3ljY3V4ZnMw
MQ0KICAgICAgICAgICAgIEluc3RydWN0b3I6IERvdWcgSm9uZXMNCiAgICAg
ICAgICAgICBBc3NpZ25tZW50OiBMQUIzDQogICAgICAgICAgICAgICAgU3R1
ZGVudDogam9zZXBoLmhvZGdlcw0KICAgICAgICAgICAgICAgICAgRW1haWw6
IGpvc2VwaC5ob2RnZXNAbG9jYWxob3N0DQogICBUb3RhbCBQb2ludHMgQXdh
cmRlZDogNTANCg0KICAgR2VuZXJhbCBDb21tZW50czoNCgkJVGhpcyBhc3Np
Z25tZW50IGlzIHdvcnRoIHVwIHRvIDc1IHBvaW50cy4NCg0KCSAgICAgICAg
SW4gdGhlIGxpc3RpbmcgYmVsb3cgSSBhbSBzaG93aW5nIG9ubHkgdGhlIC5j

Any help is very much appreciated

-Thanks

Last edited by oxoxo (2008-11-21 07:18:59)

Offline

#5 2008-11-21 22:32:31

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

Re: Reading attachment files

That's base64 encoded. It says:

**************************************************************************
             GRADING FOR CS140U LAB3
    OS used for grading: Linux
System used for grading: syccuxfs01
             Instructor: Doug Jones
             Assignment: LAB3
                Student: joseph.hodges
                  Email: joseph.hodges@localhost
   Total Points Awarded: 50

   General Comments:
        This assignment is worth up to 75 points.

            In the listing below I am showing only the .c

Offline

#6 2008-11-22 01:29:11

oxoxo
Member
Registered: 2008-10-31
Posts: 66

Re: Reading attachment files

i knew someone was going to do that.

So..How'd you do that?

I did email my instructor asking about the encryption and he said that it wasnt involved.

What im trying to do is use the same technique as before to search for a line pattern. Only insted of just finding that pattern, save the value, and keep doing that for each of the lab assignments

Last edited by oxoxo (2008-11-22 01:40:21)

Offline

#7 2008-11-22 01:58:25

elmer_42
Member
From: /na/usa/ca
Registered: 2008-10-11
Posts: 427

Re: Reading attachment files

oxoxo wrote:

So..How'd you do that?

I imagine he searched base64 decoder on Google, then used the first one that came up to decode your message into plain text.


[ lamy + pilot ] [ arch64 | wmii ] [ ati + amd ]

Offline

#8 2008-11-22 02:57:22

oxoxo
Member
Registered: 2008-10-31
Posts: 66

Re: Reading attachment files

Aha, what i actually needed to do is to save the attachments to the home directory, as prompted.

Now i can read the file, without having to decrypt.

smile

Offline

#9 2008-11-22 08:19:04

bluewind
Administrator
From: Austria
Registered: 2008-07-13
Posts: 172
Website

Re: Reading attachment files

elmer_42 wrote:
oxoxo wrote:

So..How'd you do that?

I imagine he searched base64 decoder on Google, then used the first one that came up to decode your message into plain text.

Or maybe just `base64 -d`. You can find it in coreutils.

Offline

#10 2008-11-23 05:12:34

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

Re: Reading attachment files

oxoxo wrote:

I did email my instructor asking about the encryption and he said that it wasnt involved.

Just to clarify, it's encoding, not encrypting... Encryption involves some kind of protection of the data. Base64 encoding is just used in order to transfer bianry data over an ASCII protocol (email / smtp)

Offline

Board footer

Powered by FluxBB