From d25f0d8f6c94f7b1a7149cd8a7a808073e401d76 Mon Sep 17 00:00:00 2001 From: David Maloney Date: Tue, 22 Apr 2014 15:34:16 -0500 Subject: [PATCH] cash host resolution if we successfuly resolve the host during the validation, then alter host to the resolved address to avoid the overhead of subsequent DNS requests. --- lib/metasploit/framework/login_scanner/ssh.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/metasploit/framework/login_scanner/ssh.rb b/lib/metasploit/framework/login_scanner/ssh.rb index c3212be510..11ab369c59 100644 --- a/lib/metasploit/framework/login_scanner/ssh.rb +++ b/lib/metasploit/framework/login_scanner/ssh.rb @@ -196,12 +196,13 @@ module Metasploit errors.add(:host, "must be a string") end begin - ::Rex::Socket.getaddress(host, true) + resolved_host = ::Rex::Socket.getaddress(host, true) if host =~ /^\d{1,3}(\.\d{1,3}){1,3}$/ unless host =~ Rex::Socket::MATCH_IPV4 errors.add(:host, "could not be resolved") end end + host = resolved_host rescue errors.add(:host, "could not be resolved") end