lib/scanner/plugins/dns/generic.rb in yawast-0.6.0.beta5 vs lib/scanner/plugins/dns/generic.rb in yawast-0.6.0.beta6
- old
+ new
@@ -75,24 +75,32 @@
end
mx = resv.getresources(uri.host, Resolv::DNS::Resource::IN::MX)
unless mx.empty?
mx.each do |rec|
- ip = resv.getaddress rec.exchange
+ begin
+ ip = resv.getaddress rec.exchange
- Yawast::Utilities.puts_info "\t\tMX: #{rec.exchange} (#{rec.preference}) - #{ip} (#{get_network_info(ip.to_s)})"
+ Yawast::Utilities.puts_info "\t\tMX: #{rec.exchange} (#{rec.preference}) - #{ip} (#{get_network_info(ip.to_s)})"
+ rescue => e
+ Yawast::Utilities.puts_error "\t\tMX: #{rec.exchange} (#{rec.preference}) - Error: #{e.message})"
+ end
end
end
#check for higher-level MX records, if we aren't already at the top
if root_domain != uri.host
mx = resv.getresources(root_domain, Resolv::DNS::Resource::IN::MX)
unless mx.empty?
mx.each do |rec|
- ip = resv.getaddress rec.exchange
+ begin
+ ip = resv.getaddress rec.exchange
- Yawast::Utilities.puts_info "\t\tMX (#{root_domain}): #{rec.exchange} (#{rec.preference}) - #{ip} (#{get_network_info(ip.to_s)})"
+ Yawast::Utilities.puts_info "\t\tMX (#{root_domain}): #{rec.exchange} (#{rec.preference}) - #{ip} (#{get_network_info(ip.to_s)})"
+ rescue => e
+ Yawast::Utilities.puts_error "\t\tMX (#{root_domain}): #{rec.exchange} (#{rec.preference}) - Error: #{e.message})"
+ end
end
end
end
ns = resv.getresources(root_domain, Resolv::DNS::Resource::IN::NS)
@@ -111,11 +119,13 @@
if options.subdomains
find_subdomains root_domain, resv
end
end
- #get the CAA info
- Yawast::Scanner::Plugins::DNS::CAA.caa_info uri
+ #get the CAA info - unless it's an IP
+ unless IPAddress.valid? uri.host
+ Yawast::Scanner::Plugins::DNS::CAA.caa_info uri
+ end
puts
rescue => e
Yawast::Utilities.puts_error "Error getting basic information: #{e.message}"
raise