procmail
[Top] [All Lists]

Stripping bad attachments

2005-01-20 10:27:53
Hi all,

I posted this in another list but no one could answer the question so
I'm posting it here.

I have a procmail filter that renames bad file extention to something
less dangerous but the file is still attached. Here is the filter:

:0
*^Content-type: (multipart/mixed|application/octet-stream)
{
    :0 HB
    *^Content-Disposition: (attachment|inline);
    *filename=".*\.(vbs|wsf|shs|exe|chm|pif|vbe|hta)"
    {
       SHELL=/bin/sh
       :0 fhbw
       |/usr/bin/sed \
- -e 's/\([nN][aA][mM][eE]=".*\.[vV][bB][sS]\)"/\1.virus"/' \
- -e 's/\([nN][aA][mM][eE]=".*\.[wW][sS][fF]\)"/\1.virus"/' \
- -e 's/\([nN][aA][mM][eE]=".*\.[sS][hH][sS]\)"/\1.virus"/' \
- -e 's/\([nN][aA][mM][eE]=".*\.[eE][xX][eE]\)"/\1.virus"/' \
- -e 's/\([nN][aA][mM][eE]=".*\.[cC][hH][mM]\)"/\1.virus"/' \
- -e 's/\([nN][aA][mM][eE]=".*\.[pP][iI][fF]\)"/\1.virus"/' \
- -e 's/\([nN][aA][mM][eE]=".*\.[hH][tT][aA]\)"/\1.virus"/' \
- -e 's/\([nN][aA][mM][eE]=".*\.[vV][bB][eE]\)"/\1.virus"/' \
- -e 's/^Subject:/Subject: **VIRUS ATTACHMENT**/'
    }
}

While that works fine I'd prefer to remove the file entirely. I've tried
substituting an empty value and substituting all spaces for the file
name, but the file is still attached and shows up as an attachment.

Is there an easy way to do that without destroying the message part of
the original email? If not an easy way is there a hard way to do it? :)

Thanks for any help.

Paul Pettit
CTO and IS Manager
Consistent Computer Bargains Inc.


____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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