From 923483ab207ccfa69a1e0f79b7c4dce3e20eecbb Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Tue, 6 Aug 2013 10:06:50 +0100 Subject: Added more logging of bad IPs. Ensure we parse zones correctly. --- lib/custodian/protocoltest/dnsbl.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib/custodian/protocoltest') diff --git a/lib/custodian/protocoltest/dnsbl.rb b/lib/custodian/protocoltest/dnsbl.rb index 7cdf0b9..b043f61 100644 --- a/lib/custodian/protocoltest/dnsbl.rb +++ b/lib/custodian/protocoltest/dnsbl.rb @@ -34,9 +34,9 @@ module Custodian raise ArgumentError, "The target must be an IP address" unless( @host =~ /^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$/ ) # - # Save the host we're testing against + # See which blacklist(s) we're testing against. # - if ( line =~ /via\s+([0-9]+)/ ) + if ( line =~ /via\s+([^\s]+)\s+/ ) @zones = $1.dup else @zones = "zen.spamhaus.org" @@ -82,6 +82,7 @@ module Custodian # 4.3.2.1.$zone # if ( @host =~ /^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$/ ) + name = "#{$4}.#{$3}.#{$2}.#{$1}.#{zone}" result = Custodian::Util::DNS.hostname_to_ip( name ) @@ -91,8 +92,10 @@ module Custodian return true end + else + @error "#{@host} wasn't an IP address" + return true end - # end return false -- cgit v1.2.1