Mailing List Archive

CRM114 plugin
Hello!
I've created a beta version of crm114 plugin for
SpamAssassin. I didn't implemented config options
(is it possible without hacking SA Conf.pm?), so crm114
command is hardcoded in the module code. Here's my
sample configuration:

loadplugin crm114 /home/jmv/projects/spamassassin/crm114.pm
ifplugin crm114
# This is probably lame, but I've just started using
# crm114 and doesn't fully understand yet how it
# works and what its pR really mean
body CRM114_SPAM_00 eval:check_crm('-10.00', '-0.01')
body CRM114_SPAM_10 eval:check_crm('-50.00', '-10.00')
body CRM114_SPAM_50 eval:check_crm('-100.00', '-50.00')
body CRM114_SPAM_99 eval:check_crm('undef', '-100.00')

body CRM114_HAM_00 eval:check_crm('0.00', '10.00')
body CRM114_HAM_10 eval:check_crm('10.00', '50.00')
body CRM114_HAM_50 eval:check_crm('50.00', '100.00')
body CRM114_HAM_99 eval:check_crm('100.00', 'undef')

score CRM114_SPAM_00 1
score CRM114_SPAM_10 1.5
score CRM114_SPAM_50 3
score CRM114_SPAM_99 4

score CRM114_HAM_00 -1
score CRM114_HAM_10 -1.5
score CRM114_HAM_50 -3
score CRM114_HAM_99 -4

tflags CRM114_SPAM_00 learn
tflags CRM114_SPAM_10 learn
tflags CRM114_SPAM_50 learn
tflags CRM114_SPAM_99 learn
tflags CRM_114_HAM_00 nice learn
tflags CRM_114_HAM_10 nice learn
tflags CRM_114_HAM_50 nice learn
tflags CRM_114_HAM_99 nice learn

describe CRM114_SPAM_00 CRM114 pR from -0.01 to -10.00
describe CRM114_SPAM_10 CRM114 pR from -10.00 to -50.00
describe CRM114_SPAM_50 CRM114 pR from -50.00 to -100.00
describe CRM114_SPAM_99 CRM114 pR from -100.00 to -999.99

describe CRM114_HAM_00 CRM114 pR from 0.00 to 10.00
describe CRM114_HAM_10 CRM114 pR from 10.00 to 50.00
describe CRM114_HAM_50 CRM114 pR from 50.00 to 100.00
describe CRM114_HAM_99 CRM114 pR from 100.00 to 999.99
endif

Module code is in the attachment. Comments are welcome.
Eugene

--
Email: jmv /at/ online.ru
Re: CRM114 plugin [ In reply to ]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Eugene Morozov writes:
>I've created a beta version of crm114 plugin for
>SpamAssassin. I didn't implemented config options
>(is it possible without hacking SA Conf.pm?), so crm114
>command is hardcoded in the module code.

Looks cool.

The config can be parsed by registering a callback for "parse_config";
any unrecognised config lines are passed through that so that
plugins can use them.

- --j.

> Here's my
>sample configuration:
>
>loadplugin crm114 /home/jmv/projects/spamassassin/crm114.pm
>ifplugin crm114
> # This is probably lame, but I've just started using
> # crm114 and doesn't fully understand yet how it
> # works and what its pR really mean
> body CRM114_SPAM_00 eval:check_crm('-10.00', '-0.01')
> body CRM114_SPAM_10 eval:check_crm('-50.00', '-10.00')
> body CRM114_SPAM_50 eval:check_crm('-100.00', '-50.00')
> body CRM114_SPAM_99 eval:check_crm('undef', '-100.00')
>
> body CRM114_HAM_00 eval:check_crm('0.00', '10.00')
> body CRM114_HAM_10 eval:check_crm('10.00', '50.00')
> body CRM114_HAM_50 eval:check_crm('50.00', '100.00')
> body CRM114_HAM_99 eval:check_crm('100.00', 'undef')
>
> score CRM114_SPAM_00 1
> score CRM114_SPAM_10 1.5
> score CRM114_SPAM_50 3
> score CRM114_SPAM_99 4
>
> score CRM114_HAM_00 -1
> score CRM114_HAM_10 -1.5
> score CRM114_HAM_50 -3
> score CRM114_HAM_99 -4
>
> tflags CRM114_SPAM_00 learn
> tflags CRM114_SPAM_10 learn
> tflags CRM114_SPAM_50 learn
> tflags CRM114_SPAM_99 learn
> tflags CRM_114_HAM_00 nice learn
> tflags CRM_114_HAM_10 nice learn
> tflags CRM_114_HAM_50 nice learn
> tflags CRM_114_HAM_99 nice learn
>
> describe CRM114_SPAM_00 CRM114 pR from -0.01 to -10.00
> describe CRM114_SPAM_10 CRM114 pR from -10.00 to -50.00
> describe CRM114_SPAM_50 CRM114 pR from -50.00 to -100.00
> describe CRM114_SPAM_99 CRM114 pR from -100.00 to -999.99
>
> describe CRM114_HAM_00 CRM114 pR from 0.00 to 10.00
> describe CRM114_HAM_10 CRM114 pR from 10.00 to 50.00
> describe CRM114_HAM_50 CRM114 pR from 50.00 to 100.00
> describe CRM114_HAM_99 CRM114 pR from 100.00 to 999.99
>endif
>
>Module code is in the attachment. Comments are welcome.
>Eugene
>
>--
>Email: jmv /at/ online.ru
>
>--=-=-=
>Content-Type: text/x-perl
>Content-Disposition: inline; filename=crm114.pm
>
>package crm114;
>
>use strict;
>use IPC::Open3;
>use Mail::SpamAssassin::Plugin;
>use vars qw(@ISA);
>@ISA = qw(Mail::SpamAssassin::Plugin);
>
>sub new {
> my $class = shift;
> my $mailsaobject = shift;
>
> # the usual perlobj boilerplate to create a subclass object
> $class = ref($class) || $class;
> my $self = $class->SUPER::new($mailsaobject);
> bless ($self, $class);
>
> $self->{crm_command} = "/usr/bin/crm114 -u /home/jmv/crm114 mailfilter.crm";
>
> # then register an eval rule
> $self->register_eval_rule ("check_crm");
>
> # and return the new plugin object
> return $self;
>}
>
>sub check_crm {
> my ($self, $status, $fulltext, $min, $max) = @_;
>
> my $msg = $status->get_message()->get_pristine();
>
> if (!exists($self->{crm114_score})) {
> my $pid;
> eval {
> open3(\*CRM_OUT, \*CRM_IN, \*CRM_ERR, $self->{crm_command});
> };
> if ($@) { printf "\@: %s\n", $@; }
>
> print CRM_OUT $msg;
> close(CRM_OUT);
>
> while(<CRM_IN>) {
> if (/^open3: (.*)/) {
> die $1;
> }
>
> if (/^X-CRM114-Status: \w+\s+\( pR: ([-\d.]+) \)/) {
> $self->{crm114_score} = $1;
> }
> }
>
> close(CRM_OUT);
> close(CRM_IN);
>
> if (!exists($self->{crm114_score})) {
> die "CRM114 didn't return spamicity value.";
> }
>
> dbg(sprintf ("CRM114 score: %3.4f", $self->{crm114_score}));
> }
>
> if (($min eq "undef" || $self->{crm114_score} > $min)
> && ($max eq "undef" || $self->{crm114_score} <= $max))
> {
> return 1
> }
>
> return 0;
>}
>
>sub dbg { Mail::SpamAssassin::dbg (@_); }
>
>1;
>
>--=-=-=--
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Exmh CVS

iD8DBQFAPmTxQTcbUG5Y7woRAqYFAKCZnQ+KKNpInNxVILHh2mu1DT0fUACeNYK+
qN59A4caOY6ew6AVt65l7+Y=
=nJnj
-----END PGP SIGNATURE-----
Re: CRM114 plugin [ In reply to ]
Hi Eugene,

Very interesting. Perhaps you could post this on bugzilla? Seems like a
nice addition.

--
Regards,
Jon


Eugene Morozov said:
> Hello!
> I've created a beta version of crm114 plugin for
> SpamAssassin. I didn't implemented config options
> (is it possible without hacking SA Conf.pm?), so crm114
> command is hardcoded in the module code. Here's my
> sample configuration:
>
> loadplugin crm114 /home/jmv/projects/spamassassin/crm114.pm
> ifplugin crm114
> # This is probably lame, but I've just started using
> # crm114 and doesn't fully understand yet how it
> # works and what its pR really mean
> body CRM114_SPAM_00 eval:check_crm('-10.00', '-0.01')
> body CRM114_SPAM_10 eval:check_crm('-50.00', '-10.00')
> body CRM114_SPAM_50 eval:check_crm('-100.00', '-50.00')
> body CRM114_SPAM_99 eval:check_crm('undef', '-100.00')
>
> body CRM114_HAM_00 eval:check_crm('0.00', '10.00')
> body CRM114_HAM_10 eval:check_crm('10.00', '50.00')
> body CRM114_HAM_50 eval:check_crm('50.00', '100.00')
> body CRM114_HAM_99 eval:check_crm('100.00', 'undef')
>
> score CRM114_SPAM_00 1
> score CRM114_SPAM_10 1.5
> score CRM114_SPAM_50 3
> score CRM114_SPAM_99 4
>
> score CRM114_HAM_00 -1
> score CRM114_HAM_10 -1.5
> score CRM114_HAM_50 -3
> score CRM114_HAM_99 -4
>
> tflags CRM114_SPAM_00 learn
> tflags CRM114_SPAM_10 learn
> tflags CRM114_SPAM_50 learn
> tflags CRM114_SPAM_99 learn
> tflags CRM_114_HAM_00 nice learn
> tflags CRM_114_HAM_10 nice learn
> tflags CRM_114_HAM_50 nice learn
> tflags CRM_114_HAM_99 nice learn
>
> describe CRM114_SPAM_00 CRM114 pR from -0.01 to -10.00
> describe CRM114_SPAM_10 CRM114 pR from -10.00 to -50.00
> describe CRM114_SPAM_50 CRM114 pR from -50.00 to -100.00
> describe CRM114_SPAM_99 CRM114 pR from -100.00 to -999.99
>
> describe CRM114_HAM_00 CRM114 pR from 0.00 to 10.00
> describe CRM114_HAM_10 CRM114 pR from 10.00 to 50.00
> describe CRM114_HAM_50 CRM114 pR from 50.00 to 100.00
> describe CRM114_HAM_99 CRM114 pR from 100.00 to 999.99
> endif
>
> Module code is in the attachment. Comments are welcome.
> Eugene
>
> --
> Email: jmv /at/ online.ru
>
Re: CRM114 plugin [ In reply to ]
On Fri, 27 Feb 2004, Eugene Morozov wrote:

> I've created a beta version of crm114 plugin for
> SpamAssassin. I didn't implemented config options
> (is it possible without hacking SA Conf.pm?), so crm114
> command is hardcoded in the module code. Here's my
> sample configuration:

My question is *definitely* lame, but when did we get the
"loadplugin" capability? I've got a couple of eval() rules
that I've been using to reasonable success which might be
(1) shared with the community and (2) should be removed from
(a hand-hacked) EvalTests.pm. This is a *wonderful*
enhancement if it allows "external" computational testing
of messages!

+------------------------------------------------+---------------------+
| Carl Richard Friend (UNIX Sysadmin) | West Boylston |
| Minicomputer Collector / Enthusiast | Massachusetts, USA |
| mailto:crfriend@rcn.com +---------------------+
| http://users.rcn.com/crfriend/museum | ICBM: 42:22N 71:47W |
+------------------------------------------------+---------------------+
Re: CRM114 plugin [ In reply to ]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


"Carl R. Friend" writes:
> On Fri, 27 Feb 2004, Eugene Morozov wrote:
>
>> I've created a beta version of crm114 plugin for
>> SpamAssassin. I didn't implemented config options
>> (is it possible without hacking SA Conf.pm?), so crm114
>> command is hardcoded in the module code. Here's my
>> sample configuration:
>
> My question is *definitely* lame, but when did we get the
>"loadplugin" capability? I've got a couple of eval() rules
>that I've been using to reasonable success which might be
>(1) shared with the community and (2) should be removed from
>(a hand-hacked) EvalTests.pm. This is a *wonderful*
>enhancement if it allows "external" computational testing
>of messages!

That's certainly the case ;) -- it's not released yet, but
SVN trunk will be 3.0.0, and it has plugin support along these
lines.

- --j.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Exmh CVS

iD8DBQFAPqRFQTcbUG5Y7woRAtAzAKCPL5f93jw2OUAMkGev/aifHdLmmQCgzCc4
wDahrt36Bo2J2eLtYDWz57g=
=8EH2
-----END PGP SIGNATURE-----
Re: CRM114 plugin [ In reply to ]
"Jon" <groups@ez15loan.com> writes:

> Hi Eugene,
>
> Very interesting. Perhaps you could post this on bugzilla? Seems like a
> nice addition.
>

Hello!
Perhaps I will after some testing. I've already found
a bug yesterday:
Buggy line:
if (/^X-CRM114-Status: \w+\s+\( pR: ([-\d.]+) \)/) {
Fixed line:
if (/^X-CRM114-Status: \w+\s+\( pR: ([-\d.]+)\s*\)/) {

And I also should implement many of things discussed
here if I want to make this plugin more useful:
http://bugzilla.spamassassin.org/show_bug.cgi?id=2301
Eugene

--
Email: jmv /at/ online.ru
Re: CRM114 plugin [ In reply to ]
Eugene Morozov wrote:

>"Jon" <groups@ez15loan.com> writes:
>
>
>
>>Hi Eugene,
>>
>>Very interesting. Perhaps you could post this on bugzilla? Seems like a
>>nice addition.
>>
>>
>>
>
>Hello!
>Perhaps I will after some testing. I've already found
>a bug yesterday:
>Buggy line:
> if (/^X-CRM114-Status: \w+\s+\( pR: ([-\d.]+) \)/) {
>Fixed line:
> if (/^X-CRM114-Status: \w+\s+\( pR: ([-\d.]+)\s*\)/) {
>
>And I also should implement many of things discussed
>here if I want to make this plugin more useful:
>http://bugzilla.spamassassin.org/show_bug.cgi?id=2301
>Eugene
>
>
>
Hi,

This is very cool. Do you plan to implement auto-learning, like in

http://bugzilla.spamassassin.org/show_bug.cgi?id=2301 ?

Making a crm114 database by hand is difficult, especially if we follow
the authors way of teaching on error on realtime.
Re: CRM114 plugin [ In reply to ]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Jerrin Kallukalam writes:
>Eugene Morozov wrote:
>
>>"Jon" <groups@ez15loan.com> writes:
>>
>>
>>
>>>Hi Eugene,
>>>
>>>Very interesting. Perhaps you could post this on bugzilla? Seems like a
>>>nice addition.
>>>
>>>
>>>
>>
>>Hello!
>>Perhaps I will after some testing. I've already found
>>a bug yesterday:
>>Buggy line:
>> if (/^X-CRM114-Status: \w+\s+\( pR: ([-\d.]+) \)/) {
>>Fixed line:
>> if (/^X-CRM114-Status: \w+\s+\( pR: ([-\d.]+)\s*\)/) {
>>
>>And I also should implement many of things discussed
>>here if I want to make this plugin more useful:
>>http://bugzilla.spamassassin.org/show_bug.cgi?id=2301
>>Eugene
>
>This is very cool. Do you plan to implement auto-learning, like in
>
>http://bugzilla.spamassassin.org/show_bug.cgi?id=2301 ?
>
>Making a crm114 database by hand is difficult, especially if we follow
>the authors way of teaching on error on realtime.

BTW, if any new plugin hooks are needed, be sure to let us know at
SpamAssassin-dev -- it should be OK to add new ones (as long as they
make sense ;)

- --j.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Exmh CVS

iD8DBQFAP4F8QTcbUG5Y7woRAoU0AKCrmfaBIR9RaXXmCyT2eDl2SB+uowCg5aiz
PGLeMBgOMaNlBS+eiOgYDOc=
=I/Dw
-----END PGP SIGNATURE-----
Re: CRM114 plugin [ In reply to ]
> BTW, if any new plugin hooks are needed, be sure to let us know at
> SpamAssassin-dev -- it should be OK to add new ones (as long as they
> make sense ;)

This sounds like a mailing list. Where does one find it?

Loren