Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--no-nameless deletes valid attachments named textfile* #11

Open
martinvonwittich opened this issue Feb 12, 2020 · 2 comments
Open

--no-nameless deletes valid attachments named textfile* #11

martinvonwittich opened this issue Feb 12, 2020 · 2 comments

Comments

@martinvonwittich
Copy link

I was hoping to use ripmime to extract only the attachments of an email message while ignoring the plain-text/HTML body itself, so that I could pass the attachments to mraptor.

At first I considered to just delete all textfile* files after running ripmime, but this fails to handle a special case: a mail with the attachments foo.odt and textfile10 would be extracted like this:

host ~ # ripmime -i 885. -d x -v 
Decoding filename=textfile0
Decoding filename=textfile1
Decoding filename=foo.odt
Decoding filename=textfile10

When I now delete textfile*, I'd delete the valid attachment textfile10 too.

Then I discovered --no-nameless and I had hoped that it would correctly skip textfile0 and textfile1 (plain and HTML) while extracting textfile10, but unfortunately it falls for the same thing:

host ~ # ripmime -i 885. -d x -v --no-nameless
Decoding filename=foo.odt
Decoding filename=textfile10
Removed x/textfile10 [status = 0]
Removed x/textfile1 [status = 0]
Removed x/textfile0 [status = 0]
@flolilo
Copy link

flolilo commented Feb 19, 2020

-p : Specify prefix filename to be used on files without a filename (default text)

So I tried this out - I just created some documents (foo.odt and textfile10) and sent a mail with them to myself:

$ ripmime -i ./testmail.mbox -v -d ./ --no-nameless -p toDelete
Decoding filename=foo.odt
Decoding filename=textfile10
Removed ./toDelete1 [status = 0]
Removed ./toDelete0 [status = 0]

So as a workaround, just set -p with some really ridiculous name (e.g. plsripMIMEdeleteThis seems like a name that would never be used in a mail 😏 )

@martinvonwittich
Copy link
Author

@flolilo nice workaround. I've took it one step further and just used a random prefix; that should make it safe enough for malware analysis:

host ~ # ripmime -i 885. -d x -v --no-nameless -p "$(openssl rand -hex 16)"
Decoding filename=foo.odt
Decoding filename=textfile10
Removed x/b0045976613564741b3875b79253dc9d1 [status = 0]
Removed x/b0045976613564741b3875b79253dc9d0 [status = 0]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants