Mailing List Archive

Need someone to write a simple script for me - will share results
ok - I'm not muck of a programmer - but this should be easy for someone
who is. Basically - what I'm trying to do is build a rule generator.

The source file will look like a regulare rules file - except it will
have the ability to reference flat text files. The output file will have
the contents of the text file inserted in place of the special tag as a
giant "or" statement.

A source rule would contain {*/filename*} to indicate the file
insertion. The text file is read and blank lines - trailing spaces - and
lines starting with # are removed and it is folded into a giant OR
expression.

In this example:

header SUBJ_PHRASE Subject =~
/(?re:){*/etc/spamassassin/subjphrase*}/i
describe SUBJ_PHRASE Subject contains spam phrase

File /etc/spamassassin/subjphrase contains:

back guar
big money
# comment string
boink
boost size
borrow up to

The resulting file would be:

header SUBJ_PHRASE Subject =~ /(?re:(back guar|big
money|boink|boost size|borrow up to)/i
describe SUBJ_PHRASE Subject contains spam phrase

-------

As you can see - the file is read - white space, comments, blank lines
removed, ever newline is replaced by a "|" and parens are added on both
ends.

The reason I want this is to be able to build huge rules out of flat
text files that are easy to maintain.

If someone write this I will share the rules and lists I've created with
everyone. I'm currently using a nasty Exim trick to do this - but the
resultes are very impressive. Anyone interested?
Re: Need someone to write a simple script for me - will share results [ In reply to ]
Marc,

Marc Perkel said:
> ok - I'm not muck of a programmer - but this should be easy for someone
> who is. Basically - what I'm trying to do is build a rule generator.
>
> The source file will look like a regulare rules file - except it will
> have the ability to reference flat text files. The output file will have
> the contents of the text file inserted in place of the special tag as a
> giant "or" statement.
>
> A source rule would contain {*/filename*} to indicate the file
> insertion. The text file is read and blank lines - trailing spaces - and
> lines starting with # are removed and it is folded into a giant OR
> expression.
>
> In this example:
>
> header SUBJ_PHRASE Subject =~
> /(?re:){*/etc/spamassassin/subjphrase*}/i
> describe SUBJ_PHRASE Subject contains spam phrase
>
> File /etc/spamassassin/subjphrase contains:
>
> back guar
> big money
> # comment string
> boink
> boost size
> borrow up to
>
> The resulting file would be:
>
> header SUBJ_PHRASE Subject =~ /(?re:(back guar|big
> money|boink|boost size|borrow up to)/i
> describe SUBJ_PHRASE Subject contains spam phrase
>


Not quite what you asked for but hey, it's just line noise I created by
lifting the telephone receiver while the modem was connected to a BBS.

Remove the line breaks (because of email formatting) I put in if you want.

cat /etc/spamassassin/subjphrase | perl -e 'my @stuff; while (<>) {
s/$\s*//; s/\s*$//; s/^#.*$//;
push(@stuff, $_) if $_;
}
print "header SUBJ_PHRASE\tSubject =~ /(" . join("|", @stuff) .
")/i\ndescribe SUBJ_PHRASE\tSubject contains spam phrase\n";'




> -------
>
> As you can see - the file is read
Sort of...
- white space, comments, blank lines
> removed,
Check
> ever newline is replaced by a "|" and parens are added on both
> ends.
Check
>
> The reason I want this is to be able to build huge rules out of flat
> text files that are easy to maintain.
>
> If someone write this I will share the rules and lists I've created with
> everyone. I'm currently using a nasty Exim trick to do this - but the
> resultes are very impressive. Anyone interested?
>
--
Chris Thielen

Easily generate SpamAssassin rules to catch obfuscated spam
phrases(0BFU$C/\TED SPA/\/\ P|-|RA$ES): http://www.sandgnat.com/cmos/
Keep up to date with the latest third party SpamAssassin Rulesets:
http://www.exit0.us/index.php/RulesDuJour