diff options
author | Steve Kemp <steve@steve.org.uk> | 2013-08-06 10:06:50 +0100 |
---|---|---|
committer | Steve Kemp <steve@steve.org.uk> | 2013-08-06 10:06:50 +0100 |
commit | 8ed389f90e8d000cbb13b1aee97ea2a9ce3de045 (patch) | |
tree | ffc13b7542998bdfaf9e464bd73435fe1b5b49eb /lib | |
parent | 73802df72765350089380bb9f51fa33ee5331339 (diff) |
Added more logging of bad IPs.
Ensure we parse zones correctly.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/custodian/protocoltest/dnsbl.rb | 9 |
1 files changed, 6 insertions, 3 deletions
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 |