On Thu, 27 May 2010 21:16:33 +0200
Stevan Bajić <ste...@bajic.ch> wrote:

> On Thu, 27 May 2010 08:11:46 -0700
> Bradley Giesbrecht <bradley.giesbre...@gmail.com> wrote:
> 
> > I do not have dspam signature in message body, only in header.
> > 
> > Using Apple Mail.app I set my preferences to show "X-*" headers.
> > 
> > If I forward normally to dspam for retraining the headers and body are
> > quoted in the forward and sum(dspam_stats.spam_misclassified) does not
> > change.
> > If I forward as an attachment to sum(dspam_stats.spam_misclassified)
> > is increased by 1.
> > If I select 10 messages and forward as attachments
> > sum(dspam_stats.spam_misclassified)  is increased by 1.
> > 
Could you forward me a bunch of messages as attachment so that I can see how 
they arrive at my end?


> > Does anyone know if it works to forward multiple email as attachments
> > to dspam for retraining?
> > 
> Some time ago I have coded for someone on the DSPAM mailing list a code in 
> Perl that is able to extract multiple signatures and retrain all of them. If 
> you want I can quickly search for the script or quickly write you one. It 
> should be no big time investment creating such a retraining script. Let me 
> know if you want one.
> 
I found my old script. Boy is that script old. I coded it in 2006 after some 
one asked me how to make the script from the old DSPAM wiki 
(http://dspamwiki.expass.de/DspamRetrainScript) to be able to process more then 
just one signature at once.

Here a quick test with a message just containing:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From: test
To: test
Subject: test
X-DSPAM-Signature: 0,12345678901234567890

this is a test
!DSPAM:1,12345678901234567890!
!DSPAM:2,12345678901234567890!
!DSPAM:3,12345678901234567890!
!DSPAM:4,12345678901234567890!
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


Test with standard parameters:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
nyx ~ # echo -ne 'From: test\nTo: test\nSubject: test\nX-DSPAM-Signature: 
0,12345678901234567890\n\nthis is a 
test\n!DSPAM:1,12345678901234567890!\n!DSPAM:2,12345678901234567890!\n!DSPAM:3,12345678901234567890!\n!DSPAM:4,12345678901234567890!\n'|./dspam-retrain-forward.pl
 --debug --class=spam --source=error --mode=teft --client --user 
t...@localhost.localdomain
DEBUG: Found DSPAM signature '0,12345678901234567890' in header.
DEBUG: /usr/bin/dspamc --source=error --class=spam 
--signature=0\,12345678901234567890 --mode=teft --user 
te...@localhost\.localdomain
nyx ~ # 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


Now the same test telling the retraining script to parse the body and search 
for signatures:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
nyx ~ # echo -ne 'From: test\nTo: test\nSubject: test\nX-DSPAM-Signature: 
0,12345678901234567890\n\nthis is a 
test\n!DSPAM:1,12345678901234567890!\n!DSPAM:2,12345678901234567890!\n!DSPAM:3,12345678901234567890!\n!DSPAM:4,12345678901234567890!\n'|./dspam-retrain-forward.pl
 --debug --class=spam --source=error --header-only=no --mode=teft --client 
--user t...@localhost.localdomain
DEBUG: Found DSPAM signature '1,12345678901234567890' in body.
DEBUG: /usr/bin/dspamc --source=error --class=spam 
--signature=1\,12345678901234567890 --mode=teft --user 
te...@localhost\.localdomain
DEBUG: Found DSPAM signature '2,12345678901234567890' in body.
DEBUG: /usr/bin/dspamc --source=error --class=spam 
--signature=2\,12345678901234567890 --mode=teft --user 
te...@localhost\.localdomain
DEBUG: Found DSPAM signature '3,12345678901234567890' in body.
DEBUG: /usr/bin/dspamc --source=error --class=spam 
--signature=3\,12345678901234567890 --mode=teft --user 
te...@localhost\.localdomain
DEBUG: Found DSPAM signature '4,12345678901234567890' in body.
DEBUG: /usr/bin/dspamc --source=error --class=spam 
--signature=4\,12345678901234567890 --mode=teft --user 
te...@localhost\.localdomain
nyx ~ #
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


The script detects if it already has processed a signature and does not call 
DSPAM again. A small test with 4 times the same signature in the body:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
nyx ~ # echo -ne 'From: test\nTo: test\nSubject: test\nX-DSPAM-Signature: 
0,12345678901234567890\n\nthis is a 
test\n!DSPAM:1,12345678901234567890!\n!DSPAM:1,12345678901234567890!\n!DSPAM:1,12345678901234567890!\n!DSPAM:1,12345678901234567890!\n'|./dspam-retrain-forward.pl
 --debug --class=spam --source=error --header-only=no --mode=teft --client 
--user t...@localhost.localdomain
DEBUG: Found DSPAM signature '1,12345678901234567890' in body.
DEBUG: /usr/bin/dspamc --source=error --class=spam 
--signature=1\,12345678901234567890 --mode=teft --user 
te...@localhost\.localdomain
nyx ~ #
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


And the script is checking (if needed) for valid --class, --source and --mode 
values:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
nyx ~ # echo -ne 'From: test\nTo: test\nSubject: test\nX-DSPAM-Signature: 
0,12345678901234567890\n\nthis is a 
test\n!DSPAM:1,12345678901234567890!\n!DSPAM:1,12345678901234567890!\n!DSPAM:1,12345678901234567890!\n!DSPAM:1,12345678901234567890!\n'|./dspam-retrain-forward.pl
 --debug --class=spam --source=not_valid_source --header-only=no --client 
--user t...@localhost.localdomain
ERROR: Source 'not_valid_source' is not known by DSPAM.
nyx ~ # echo -ne 'From: test\nTo: test\nSubject: test\nX-DSPAM-Signature: 
0,12345678901234567890\n\nthis is a 
test\n!DSPAM:1,12345678901234567890!\n!DSPAM:1,12345678901234567890!\n!DSPAM:1,12345678901234567890!\n!DSPAM:1,12345678901234567890!\n'|./dspam-retrain-forward.pl
 --debug --class=not_valid_class --source=error --header-only=no --client 
--user t...@localhost.localdomain
ERROR: Class 'not_valid_class' is not known by DSPAM.
nyx ~ # echo -ne 'From: test\nTo: test\nSubject: test\nX-DSPAM-Signature: 
0,12345678901234567890\n\nthis is a 
test\n!DSPAM:1,12345678901234567890!\n!DSPAM:1,12345678901234567890!\n!DSPAM:1,12345678901234567890!\n!DSPAM:1,12345678901234567890!\n'|./dspam-retrain-forward.pl
 --debug --class=spam --source=error --mode=not_valid_mode --header-only=no 
--client --user t...@localhost.localdomain
ERROR: Mode 'not_valid_mode' is not known by DSPAM.
nyx ~ #
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


The script is using the current user if no --user switch is used:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
nyx ~ # echo -ne 'From: test\nTo: test\nSubject: test\nX-DSPAM-Signature: 
0,12345678901234567890\n\nthis is a 
test\n!DSPAM:1,12345678901234567890!\n!DSPAM:1,12345678901234567890!\n!DSPAM:1,12345678901234567890!\n!DSPAM:1,12345678901234567890!\n'|./dspam-retrain-forward.pl
 --debug --class=spam --source=error --header-only=no --client
DEBUG: Found DSPAM signature '1,12345678901234567890' in body.
DEBUG: /usr/bin/dspamc --source=error --class=spam 
--signature=1\,12345678901234567890 --user root
nyx ~ #
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


And the script can be used for inoculation / corpus fed as well:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
nyx ~ # echo -ne 'From: test\nTo: test\nSubject: test\nX-DSPAM-Signature: 
0,12345678901234567890\n\nthis is a 
test\n!DSPAM:1,12345678901234567890!\n!DSPAM:1,12345678901234567890!\n!DSPAM:1,12345678901234567890!\n!DSPAM:1,12345678901234567890!\n'|./dspam-retrain-forward.pl
 --debug --class=spam --source=corpus --client
DEBUG: Piping message to: /usr/bin/dspamc --source=corpus --class=spam --user 
root
nyx ~ # echo -ne 'From: test\nTo: test\nSubject: test\nX-DSPAM-Signature: 
0,12345678901234567890\n\nthis is a 
test\n!DSPAM:1,12345678901234567890!\n!DSPAM:1,12345678901234567890!\n!DSPAM:1,12345678901234567890!\n!DSPAM:1,12345678901234567890!\n'|./dspam-retrain-forward.pl
 --debug --class=spam --source=inoculation --client
DEBUG: Piping message to: /usr/bin/dspamc --source=inoculation --class=spam 
--user root
nyx ~ #
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


And the script is able to process spam/ham aliases if no --user switch is used 
and change the class to spam/innocent even if the script is called with a 
(wrong) --class value.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
nyx ~ # echo -ne 'From: test\nTo: test\nSubject: test\nX-DSPAM-Signature: 
0,12345678901234567890\n\nthis is a 
test\n!DSPAM:1,12345678901234567890!\n!DSPAM:1,12345678901234567890!\n!DSPAM:1,12345678901234567890!\n!DSPAM:1,12345678901234567890!\n'|./dspam-retrain-forward.pl
 --debug --class=spam --source=error --client --rcpt-to notspam-t...@my.tld
DEBUG: Found DSPAM signature '0,12345678901234567890' in header.
DEBUG: /usr/bin/dspamc --source=error --class=innocent 
--signature=0\,12345678901234567890 --user te...@my\.tld
nyx ~ # echo -ne 'From: test\nTo: test\nSubject: test\nX-DSPAM-Signature: 
0,12345678901234567890\n\nthis is a 
test\n!DSPAM:1,12345678901234567890!\n!DSPAM:1,12345678901234567890!\n!DSPAM:1,12345678901234567890!\n!DSPAM:1,12345678901234567890!\n'|./dspam-retrain-forward.pl
 --debug --class=innocent --source=error --client --rcpt-to spam-t...@my.tld
DEBUG: Found DSPAM signature '0,12345678901234567890' in header.
DEBUG: /usr/bin/dspamc --source=error --class=spam 
--signature=0\,12345678901234567890 --user te...@my\.tld
nyx ~ #
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


etc, etc, etc... the script however does not try to decode base64 attachments 
and such. When I coded that script I did not wanted to invest to much time in 
making it über intelligent.


> > Thank you,
> > Bradley Giesbrecht
> > 
-- 
Kind Regards from Switzerland,

Stevan Bajić

------------------------------------------------------------------------------

_______________________________________________
Dspam-user mailing list
Dspam-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspam-user

Reply via email to