procmail
[Top] [All Lists]

Re: Back to filtering out attachments

2002-07-30 01:28:07
On Tue, 30 Jul 2002, Colin J. Raven wrote:

Greetings all,
[...]
################################################################

SHELL=/bin/sh
LOGFILE=/home/log/procmaillog
#changed to /home/log/procmaillog to avoid filling up /var partition
#/var is slightly undersized on Cobalt devices typically
LOGABSTRACT=ALL
VERBOSE=ON

        We put the  "SHELL=/bin/bash" here.

#################################################################

:0
*^Content-type: (multipart/mixed|application/octet-stream)

        If you work only on "Content-type: ..." you miss the uucode
        format.

{
    :0 HB
    *^Content-Disposition: (attachment|inline);

*filename=".*\.(vbs|wsf|eml|shs|exe|nws|chm|pif|vbe|hta|scr|com|lnk)"
    {
       SHELL=/bin/bash
       :0 fhbw
       |/bin/sed -e \
's/\([nN][aA][mM][eE]=".*\.[vV][bB][sS]\)"/\1.txt"/' \

        Procmail ignores UPcase by default:
's/\(name=".*\.vbs\)"/\1.txt"/'

[...]
       {

        What about this extra "{"?   Did you try the script before?

        :0:
        /home/tmp/crap
         }
        }


        In my old procmailrc I did the same (I trust our antivirus now)
        The recipe:

EXTN="vbs|wsf|eml|shs|exe|nws|chm|pif|vbe|hta|scr|com|lnk"
:0 Bfw:
*$ ^([  ]+.*name[  ]*=|begin[  ]+[0-9]+[  ]+|Content-).*\/[.](${EXTN})\>
*$ MATCH ?? ()\/(${EXTN})
| sed -e            "/^Content-.*\.$MATCH\>/s/\.$MATCH\>/_txt/g" \
          -e             "/^begin\>.*\.$MATCH\>/s/\.$MATCH\>/_txt/g" \
          -e "/^.*name[  ]*=[  ]*\".*\.$MATCH\>/s/\.$MATCH\>/_txt/g"

        NOTE:  The "[  ]"  is "[ + space + tab + ]"

Bye,
 Udi

###############################################################
[...]

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>