From 8017a63d26f07d47ea8356588d7b38af952a5da5 Mon Sep 17 00:00:00 2001 From: Stanley Hopcroft Date: Mon, 29 Nov 2004 05:07:34 +0000 Subject: *** empty log message *** git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@949 f882894a-f735-0410-b71e-b25c423dba1c --- contrib/rblcheck-web | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 contrib/rblcheck-web (limited to 'contrib/rblcheck-web') diff --git a/contrib/rblcheck-web b/contrib/rblcheck-web new file mode 100755 index 00000000..eb4fcdec --- /dev/null +++ b/contrib/rblcheck-web @@ -0,0 +1,37 @@ +#!/usr/bin/perl +# Multi-RBL Query tool, developer Vikram +use IO::Socket::INET; + +die "Syntax: $0 -H \n" unless $ARGV[1]; + +$soc = new IO::Socket::INET->new(PeerPort=>80, +Proto=>'tcp', +PeerAddr=>"rbls.org") or die("Cannot connect to CERT"); + +$ip = $ARGV[1]; +$uri = '/?q='.$ip; + +$soc->send("GET $uri HTTP/1.1\nHost: rbls.org\n\n"); +@buff = <$soc>; +delete @buff[0..7]; +$len = @buff; + +$alert = 0; + + +for( $i=0;$i<$len;$i++ ) { + next unless( defined $buff[$i] ); + chomp($buff[$i]); + #print "$buff[$i]\n"; + + if ( $buff[$i] eq "" ) { + $rbl = substr($buff[$i+1], 5, index($buff[$i], "") - 5); + next if ( index($rbl, '.') == -1 ); + print "$ip is listed in the following RBLS: " if ( $alert == 0 ); + print "$rbl "; + $alert = 1; + } +} +print "$ip is not listed in any RBLS" if ( $alert == 0 ); +print "\n"; +exit($alert); -- cgit v1.2.3-74-g34f1