Pass-through with unbase64

Suzanne Skinner tril at igs.net
Tue Nov 26 05:35:12 CET 2002


On Mon, Nov 25, 2002 at 08:05:53AM -0800, Allyn Fratkin wrote:

> hi, i'd be interested in seeing your code.  seems like a good addition
> since it will probably be a several more releases before bogofilter
> can decode messages itself.

Okay, the script "bogopass" is attached. It requires Perl, formail, unbase64,
and (duh) bogofilter :-)

Command-line options will be passed to bogofilter.

Suzanne

-- 
tril at igs.net - http://www.igs.net/~tril/

A Pope has a Water Cannon.                               It is a Water Cannon.
He fires Holy-Water from it.                        It is a Holy-Water Cannon.
He Blesses it.                                 It is a Holy Holy-Water Cannon.
He Blesses the Hell out of it.          It is a Wholly Holy Holy-Water Cannon.
He has it pierced.                It is a Holey Wholly Holy Holy-Water Cannon.
Batman and Robin arrive.                                       He shoots them.
                                    -- Principia Discordia
-------------- next part --------------
#!/usr/bin/perl

use strict;

sub my_die;

my $PROG = 'bogopass';

### Begin Main ###

my $fn = "/tmp/$PROG.$$";
open F, ">$fn" or my_die "Can't open $fn for writing ($!)";
print F $_ while <STDIN>;
close F or my_die "Can't close $fn after writing ($!)";

my $options = join ' ', @ARGV;
my $bogo_header = `unbase64 $fn | bogofilter -v $options`;
chomp $bogo_header;
$bogo_header =~ /^X-Bogosity:/ or
    my_die "bogofilter returned invalid output (\"$bogo_header\")";

system("formail -I \"$bogo_header\" < $fn") == 0 or
    my_die "formail failed ($?)";
unlink $fn;
exit 0;

### End Main ###

sub my_die {
    my $msg = shift;
    die "$PROG: $msg\n";
}



More information about the Bogofilter mailing list