A little more cleanup for IPv6 in HTTP mixins

unstable
HD Moore 2012-01-31 01:44:03 -06:00
parent 0b8987f2af
commit 52004b1e33
1 changed files with 10 additions and 2 deletions

View File

@ -293,6 +293,10 @@ module Exploit::Remote::HttpServer
host = srvhost_addr
end
if Rex::Socket.is_ipv6?(host)
host = "[#{host}]"
end
if (ssl and datastore["SRVPORT"] == 443)
port = ''
elsif (!ssl and datastore["SRVPORT"] == 80)
@ -331,7 +335,7 @@ module Exploit::Remote::HttpServer
if (datastore['LHOST'])
host = datastore["LHOST"]
else
if (datastore['SRVHOST'] == "0.0.0.0")
if (datastore['SRVHOST'] == "0.0.0.0" or datastore['SRVHOST'] == "::")
if (sock and sock.peerhost)
host = Rex::Socket.source_address(sock.peerhost)
else
@ -880,7 +884,11 @@ module Exploit::Remote::HttpServer::PHPInclude
# Does not take SSL into account. For the reasoning behind this, see +exploit+.
#
def php_include_url(sock=nil)
"http://#{srvhost_addr}:#{datastore['SRVPORT']}#{get_resource()}?"
host = srvhost_addr
if Rex::Socket.is_ipv6?
host = "[#{host}]"
end
"http://#{host}:#{datastore['SRVPORT']}#{get_resource()}?"
end