Merge branch 'jlee-r7-bug/redmine-7226-rhost-dns'

unstable
sinn3r 2012-09-13 11:04:51 -05:00
commit c6c59b6df6
1 changed files with 13 additions and 5 deletions

View File

@ -253,7 +253,7 @@ class DBManager
wspace = find_workspace(wspace)
end
address, scope = address.split('%', 2)
address = normalize_host(address)
return wspace.hosts.find_by_address(address)
}
end
@ -6066,12 +6066,20 @@ class DBManager
if (host.kind_of? String)
if Rex::Socket.is_ipv4?(host)
# If it's an IPv4 addr with a port on the end, strip the port
if Rex::Socket.is_ipv4?(host) and host =~ /((\d{1,3}\.){3}\d{1,3}):\d+/
if host =~ /((\d{1,3}\.){3}\d{1,3}):\d+/
norm_host = $1
else
norm_host = host
end
elsif Rex::Socket.is_ipv6?(host)
# If it's an IPv6 addr, drop the scope
address, scope = host.split('%', 2)
norm_host = address
else
norm_host = Rex::Socket.getaddress(host, true)
end
elsif host.kind_of? ::Mdm::Session
norm_host = host.host
elsif host.respond_to?(:session_host)