procmail
[Top] [All Lists]

Re: Hard one for the gurus - Extracting files from a uuencoded mess age

2002-08-14 12:52:14
* Don Hammond <procmail(_at_)tradersdata(_dot_)com> [20020814 21:57]: wrote:
On 14 Aug, Odhiambo Washington wrote:
| 
| Just teasing - I know this is like ice cream for the gurus ;-)
| 
| Hello there,
| 
| I would like to request your help: 
| 
| I do receive virus definition files updates from the address
| subscribe(_at_)drweb(_dot_)ru on a weekly basis.
| 
| The only difficulty I am facing is that the files are UUENCODED into
| the come as the body of the message...something like this:
| 
| begin 644 drw42814.zip
| M4$L#!!0````(`(`C"RW445!KT0P``&`.```,````1%)7-#(X,30N5D1"G9$'
| M4!-:FX9#8(_at_)$C14H0I,0"H80:;'1""46D(T7$8$(+!!**=$(7D(X4I440D-Y"
| M:*%7$11!F(_at_)6EB87>+J!DN;/N[-W9_]][9]^9,^>9]_U.^XX&4?(6U(_at_)[JC25Z
| <snip>
| ...
| ...
| </snip>
| end
| 
| 
| There is exactly one empty line before "begin", then there is one empty
| line after "end", afterwhich there is some text that I would not want.
| 
| 
| I would like to use procmail to automatically extract the files for me
| into some directory. How do I extract the relevant part of the body, pass
| it to uudecode and get the files saved??
| 
| :0B
| * ^From:(_dot_)*subscribe(_at_)drweb(_dot_)ru
||uudecose some_args
| somedir/
| 

You shouldn't need to do anything special because uudecode will igonore
everything before and after the relevant section. It doesn't need to be
stripped down to just the attachment. I don't know what it'll do if
there's more than one attachment, and don't have time to test it, but
that's probably not an issue here.

:0b:uue.lock
* ^From:(_dot_)*subscribe(_at_)drweb(_dot_)ru
*     B ?? ^begin [0-7][0-7][0-7] \/.*
*     B ?? ^end$
* 1^3 B ?? ^M
|uudecode >"/path/to/final/destination/$MATCH"

Hello Don,

This recipe gives me a zero-sized zipped file.

I could do better if it could also unzip the file , in case the recipe
can get some facelift ;-)

Thanks in advance


-Wash

-- 
                       /"\
Odhiambo Washington    \ /     ASCII Ribbon Campaign
Wananchi Online Ltd.,   X      Against HTML Mail,
PO Box 10286,          / \     HTML News Too, and
00100 NAIROBI, KE.             MS WORD docs.
++


They can take our lives, but they can never take our freedom! 
-William Wallace (Mel Gibson), "Braveheart" 
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail