View | Details | Raw Unified
Collapse All | Expand All

(-) src/tools/dspam_train.in (-21 / +35 lines)
 Lines 123-129    Link Here 
    my($code, $cmd, $response);
    my($code, $cmd, $response);
    my($dir, $msg) = @_;
    my($dir, $msg) = @_;
    print "[test: nonspam] " . substr($msg . " " x 32, 0, 32) .  " result: ";
    print "[test: nonspam] " . substr($msg . " " x 32, 0, 32) .  " result: ";
    $cmd = "$CONFIG{'DSPAM_BINARY'} --user $USER --deliver=summary < '$dir/$msg'";
    $cmd = "$CONFIG{'DSPAM_BINARY'} --user $USER --deliver=summary --stdout < '$dir/$msg'";
    $response = `$cmd`;
    $response = `$cmd`;
    $code = "UNKNOWN";
    $code = "UNKNOWN";
 Lines 131-140    Link Here 
        $code = $1;
        $code = $1;
    }
    }
    if ($code eq "UNKNOWN") {
    if ($code eq "UNKNOWN") {
        print "\n===== WOAH THERE =====\n";
        # print "\n===== WOAH THERE =====\n";
        print "I was unable to parse the result. Test Broken.\n";
        # print "I was unable to parse the result. Test Broken.\n";
        print "======================\n";
        # print "======================\n";
        exit(0);
        # exit(0);
        print "BROKEN result!!\n";
        return;
    }
    }
    if ($code eq "Innocent" || $code eq "Whitelisted") {
    if ($code eq "Innocent" || $code eq "Whitelisted") {
 Lines 144-159    Link Here 
        my($signature) = "UNKNOWN";
        my($signature) = "UNKNOWN";
        if ($response =~ /class="(\S+)"/i) {
        if ($response =~ /class="(\S+)"/i) {
            $class = $1;
            $class = $1;
        } else {
            print "BROKEN class!!\n";
            return;
        }
        }
        if ($response =~ /signature=(\S+)/i) {
        if ($response =~ /signature=(\S+)/i) {
            $signature = $1;
            $signature = $1;
        } else {
        } else {
            print "\n===== WOAH THERE =====\n";
            # print "\n===== WOAH THERE =====\n";
            print "I was unable to find the DSPAM signature. Test Broken.\n";
            # print "I was unable to find the DSPAM signature. Test Broken.\n";
            print "======================\n";
            # print "======================\n";
            print "\n$response\n";
            # print "\n$response\n";
            exit(0);
            # exit(0);
            print "BROKEN signature!!\n";
            return;
        }
        }
        print "FAIL ($class)";
        print "FAIL ($class)";
 Lines 182-188    Link Here 
    my($dir, $msg) = @_;
    my($dir, $msg) = @_;
    print "[test: spam   ] " . substr($msg . " " x 32, 0, 32) . " result: ";
    print "[test: spam   ] " . substr($msg . " " x 32, 0, 32) . " result: ";
    $cmd = "$CONFIG{'DSPAM_BINARY'} --user $USER --deliver=summary < '$dir/$msg'";
    $cmd = "$CONFIG{'DSPAM_BINARY'} --user $USER --deliver=summary --stdout < '$dir/$msg'";
    $response = `$cmd`;
    $response = `$cmd`;
    $code = "UNKNOWN";
    $code = "UNKNOWN";
 Lines 190-218    Link Here 
        $code = $1;
        $code = $1;
    }
    }
    if ($code eq "UNKNOWN") {
    if ($code eq "UNKNOWN") {
        print "\n===== WOAH THERE =====\n";
        # print "\n===== WOAH THERE =====\n";
        print "I was unable to parse the result. Test Broken.\n";
        # print "I was unable to parse the result. Test Broken.\n";
        print "======================\n";
        # print "======================\n";
        exit(0);
        # exit(0);
        print "BROKEN result!!\n";
        return;
    }
    }
    if ($code eq "Spam") {
    if ($code eq "Spam" || $code eq "Blacklisted") {
        print "PASS";
        print "PASS";
    } else {
    } else {
        my($class) = "UNKNOWN";
        my($class) = "UNKNOWN";
        my($signature) = "UNKNOWN";
        my($signature) = "UNKNOWN";
        if ($response =~ /class="(\S+)"/i) {
        if ($response =~ /class="(\S+)"/i) {
            $class = $1;
            $class = $1;
        } else {
            print "BROKEN class!!\n";
            return;
        }
        }
        if ($response =~ /signature=(\S+)/i) {
        if ($response =~ /signature=(\S+)/i) {
            $signature = $1;
            $signature = $1;
        } else {
        } else {
            print "\n===== WOAH THERE =====\n";
            # print "\n===== WOAH THERE =====\n";
            print "I was unable to find the DSPAM signature. Test Broken.\n";
            # print "I was unable to find the DSPAM signature. Test Broken.\n";
            print "======================\n";
            # print "======================\n";
            print "\n$response\n";
            # print "\n$response\n";
            exit(0);
            # exit(0);
            print "BROKEN signature!!\n";
            return;
        }
        }
        print "FAIL ($class)";
        print "FAIL ($class)";