Code

Fix for regex input of '|', being output causing problems with Nagios' parsing of
[nagiosplug.git] / contrib / rblcheck-dns
1 #!/usr/bin/perl
2 # Multi-RBL Query tool, developer Vikram <vr@udel.edu>
3 use strict;
4 use Socket;
5 my $suspect = $ARGV[1];
7 die "Syntax: $0 -H <ip address>\n" unless $suspect;
9 my @rblservers=qw[
10         3y.spam.mrs.kithrup.com
11         block.blars.org
12         bl.redhatgate.com
13         blackholes.five-ten-sg.com
14         blackholes.intersil.net
15         blackholes.mail-abuse.org
16         blackholes.wirehub.net
17         blacklist.spambag.org
18         dev.null.dk
19         dews.qmail.org  
20         dialup.blacklist.jippg.org
21         dialups.mail-abuse.org
22         dnsbl.njabl.org
23         dul.maps.vix.com
24         dul.orca.bc.ca
25         dynablock.wirehub.net
26         formmail.relays.monkeys.com
27         ipwhois.rfc-ignorant.org
28         list.dsbl.org
29         multihop.dsbl.org
30         okrelays.nthelp.com     
31         pm0-no-more.compu.net
32         proxies.relays.monkeys.com
33         rbl-plus.mail-abuse.org
34         rbl.maps.vix.com
35         rbl.spam.org.tr
36         relays.mail-abuse.org
37         relays.nthelp.com
38         relays.ordb.org
39         relays.radparker.com
40         relays.visi.com
41         sbl.spamhaus.org
42         spamguard.leadmon.net
43         spammers.v6net.org
44         spamsources.fabel.dk
45         spews.org
46         unconfirmed.dsbl.org
47         xbl.selwerd.cx
48 ];
51 my $spam = 0;
52 foreach ( @rblservers ) {
53         my @s = split('\.',$suspect);
54         my $req = "$s[3].$s[2].$s[1].$s[0].".$_;
56         my ($name,$aliases,$addrtype,$length,@addrs) = gethostbyname($req);
57         next unless (@addrs);
59         my $result = inet_ntoa($addrs[0]);
60         #next unless (substr($result, 7) eq '127.0.0');
62         print "$suspect is listed in the following RBLS: " if ( $spam == 0 );
63         print $_, " ";
64         $spam = 1;
65 }
67 print "$suspect is not listed in any RBLS" if ( $spam == 0 );
68 print "\n";
69 exit( $spam );