summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2013-08-06 10:06:50 +0100
committerSteve Kemp <steve@steve.org.uk>2013-08-06 10:06:50 +0100
commit923483ab207ccfa69a1e0f79b7c4dce3e20eecbb (patch)
tree44195be1e7b0db0c8d3238f15337efc3cc145749
parent7856c1a1e02a8b5a218088b16569929047323370 (diff)
Added more logging of bad IPs.
Ensure we parse zones correctly.
-rw-r--r--lib/custodian/protocoltest/dnsbl.rb9
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