Hide RPORT more intelligently

bug/bundler_fix
William Vu 2017-02-08 09:39:47 -06:00
parent e76b53c5d1
commit b06895b604
1 changed files with 8 additions and 1 deletions

View File

@ -465,8 +465,15 @@ module Exploit::Remote::HttpClient
# Returns the complete URI as string including the scheme, port and host
def full_uri(custom_uri = nil)
uri_scheme = ssl ? 'https' : 'http'
uri_port = rport.to_s == '80' ? '' : ":#{rport}"
if (rport == 80 && !ssl) || (rport == 443 && ssl)
uri_port = ''
else
uri_port = ":#{rport}"
end
uri = normalize_uri(custom_uri || target_uri.to_s)
"#{uri_scheme}://#{rhost}#{uri_port}#{uri}"
end