#!/usr/bin/perl

#
# From pastebin by berni (20080930)
#

use Net::IP;
use Net::RBLClient;

$| = 1;

my @lists = (
        'cbl.abuseat.org',
        'list.dsbl.org',
        'multihop.dsbl.org',
        'unconfirmed.dsbl.org',
        'dnsbl.njabl.org',
        'dnsbl.sorbs.net',
        'zen.spamhaus.org',
        'bl.spamcop.net',
        'relays.mail-abuse.org',
        'dnsbl-1.uceprotect.net',
        'dnsbl-2.uceprotect.net',
        'ix.dnsbl.manitu.net' );

my $ip = new Net::IP ($ARGV[0]) || die;
my $rbl = Net::RBLClient->new(
        lists => \@lists);
do {
        $rbl->lookup($ip->ip());
        my @listed = $rbl->listed_by;
        if ($#listed > 0) {
                print "\n", $ip->ip(), " listed in ", join(" ", @listed);
        };

} while (++$ip);
