At 11:52 2002-04-10 -0500, Justin Shore wrote:
parse the assorted spools full of this spam, munge every instance of my
users' addresses (replacing it with munged(_at_)mydomain(_dot_)net), prepend a string
to the subject line, and send it off to two address (FTC and NANAS).
Write a perl script and pipe it on through.
Or, a sed script:
:0f
| sed -e
"s/myaddress(_at_)domain\(_dot_)tld/munged(_at_)fakedomain(_dot_)faketld/gi"
You can repeat the -e "expression" several times in the same invocation for
coverage of multiple addresses, or:
:0f
| sed -e
"s/\<[-+_a-zA-Z0-9]*(_at_)domain\(_dot_)tld/munged(_at_)fakedomain(_dot_)faketld/gi"
examine the results for leftover addresses and adjust as necessary. You
may wish to purge extra headers such as "X-Envelope-To:" (use formail for
that, on the original message BEFORE you do your forward
operation). Addresses in X-Envelope-To: may be _local_ references (sans
domain).
Some message-ids and return addresses (say, from mailing lists) may have an
encoded variant of the address in them. Figure it out on a case-by basis.
After the munging has been performed (inline within the one recipe, no need
to make it separate manual steps), you forward and handle as you see fit:
:0
| (cat $AUTOREPLY/$BOUNCEMSG - | \
formail -I "Subject: [SPEW ADVISORY] $SUBJECT" \
-I "To: use(_at_)ftc(_dot_)gov" \
-I "X-Loop: $BOUNCER" \
-I "From: $BOUNCER")| $SENDMAIL -t -f $BOUNCER
BOUNCEMSG would be the name of a text file that is prepended to the body of
the message. Or it could just be a blank line (which will make the
previous message appear in the BODY). $AUTOREPLY is what I use to hold the
dir where autoreply texts are stored. $BOUNCER is the address your
advisory would be sent from - From: address AND envelope from (if the
account this is running under is a sendmail "trusted" user, there won't be
a warning about the -f option -- I'd avise you to use a trusted account
that is allowed to "forge" itself in this fashion without generating a
warning, just because it makes the message that much less fake, and needn't
come from an otherwise valid account).
Set variables as appropriate, duplicate recipe (and add the 'c' flag to
each one except the last) as necessary for delivery to different addresses
and with different subject syntax, etc. As per my disclaimer, I extract
$SUBJECT early on in my recipes, so it's just always available - very handy
for stuff like this for example. You can obtain it by:
:0
* ^Subject:[ ]*\/[^ ].*
{
SUBJECT=$MATCH
}
You should write your recipe, and then run it under a sandbox config first
to make sure it is doing what it should before you actually have it spew
forth loads of messages. See my disclaimer for info on sandboxes.
You now owe me a beer.
---
Sean B. Straw / Professional Software Engineering
Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
Please DO NOT carbon me on list replies. I'll get my copy from the list.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail