Hi Azfar Hashmi,

Here is a simple perl script to do this :)

#!/usr/bin/perl -w
use strict;
use Net::RBLClient;
die "Usage: $0 file or ip.add.re.ss ...\n" unless scalar(@ARGV);

my @target = ();
foreach my $ip_list (@ARGV) {
    if ($ip_list =~ /$Net::RBLClient::ip_pat/o and not -f $ip_list) {
        push @target, $ip_list;
    } else {
        die "'$ip_list' is not an ip address or filename\n" unless -f $ip_list;
        open FD, "< $ip_list" or die "cannot open file '$ip_list': $!\n";
        while (<FD>) {
            chomp;
            next if /^#/;
            if (/$Net::RBLClient::ip_pat/o) {
                push @target, $&;
            }
        }
        close FD;
    }
}

my @rblserver = qw(
        bl.spamcop.net
        zen.spamhaus.org
        cbl.abuseat.org
        dnsbl.njabl.org
        dnsbl.sorbs.net
        spam.dnsbl.sorbs.net
        dynablock.njabl.org
        list.dsbl.org
        multihop.dsbl.org
        relays.ordb.org
        unconfirmed.dsbl.org
        blackholes.mail-abuse.org
        rbl.softworking.com
        );

my $rblclient = Net::RBLClient->new(
        lists       => [EMAIL PROTECTED],
        query_txt   => 0,
        server      => '127.0.0.1' # DNS server
        );

# check
my $result = {};
foreach my $ip (@target) {
    print "checking $ip ...\n";
    $rblclient->lookup($ip);
    my %listed_hash = $rblclient->listed_hash();
    if (scalar keys %listed_hash) {
        foreach my $rbl (keys %listed_hash) {
            print "\t$rbl";
            $result->{$rbl}->{$ip} = $listed_hash{$rbl};
            $result->{$rbl}->{$ip} =~ s/^\s*|\s*$//g;
        }
    }
}

# build report
my $text = '';
foreach my $rbl (keys %$result) {
    $text .= "$rbl\n";
    foreach my $ip (keys %{$result->{$rbl}}) {
        #$text .= sprintf("%-28s %-20s %16s\n", $name, $ip, 
$result->{$rbl}->{$ip});
        $text .= "\t$ip\n";
    }
    $text .= "\n";
}

... send the result to your email or save as html to view with browser ...


Azfar Hashmi wrote:
> Is there any way to monitor my ips in RBLs.
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> AMaViS-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/amavis-user
> AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
> AMaViS-HowTos:http://www.amavis.org/howto/


-- 
Xueron Nee <[EMAIL PROTECTED]>


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
AMaViS-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/

Reply via email to