Handle IPv6 properly (host header parsing)

This commit is contained in:
HD Moore 2011-12-10 07:33:23 -06:00
parent 8ccb68c9df
commit cd4d7d3c47
1 changed files with 10 additions and 4 deletions

View File

@ -162,14 +162,20 @@ class Metasploit3 < Msf::Auxiliary
os_name ||= 'Unknown'
mysrc = Rex::Socket.source_address(cli.peerhost)
hhead = (req['Host'] || @myhost).split(':', 2)[0]
hhead = (req['Host'] || @myhost)
if (req.resource =~ /^http\:\/+([^\/]+)(\/*.*)/)
if req.resource =~ /^http\:\/+([^\/]+)(\/*.*)/
hhead = $1
req.resource = $2
hhead, nport = $1.split(":", 2)[0]
@myport = nport || 80
end
if hhead =~ /^(.*):(\d+)\s*$/
hhead = $1
nport = $2.to_i
end
@myport = nport || 80
cookies = req['Cookie'] || ''