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.
This commit is contained in:
parent
0439569ffb
commit
d25f0d8f6c
|
@ -196,12 +196,13 @@ module Metasploit
|
||||||
errors.add(:host, "must be a string")
|
errors.add(:host, "must be a string")
|
||||||
end
|
end
|
||||||
begin
|
begin
|
||||||
::Rex::Socket.getaddress(host, true)
|
resolved_host = ::Rex::Socket.getaddress(host, true)
|
||||||
if host =~ /^\d{1,3}(\.\d{1,3}){1,3}$/
|
if host =~ /^\d{1,3}(\.\d{1,3}){1,3}$/
|
||||||
unless host =~ Rex::Socket::MATCH_IPV4
|
unless host =~ Rex::Socket::MATCH_IPV4
|
||||||
errors.add(:host, "could not be resolved")
|
errors.add(:host, "could not be resolved")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
host = resolved_host
|
||||||
rescue
|
rescue
|
||||||
errors.add(:host, "could not be resolved")
|
errors.add(:host, "could not be resolved")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue