Land #3979, @wchen-r7 fixes #3976, http_login not using TARGETURI, neither uri normalization

bug/bundler_fix
jvazquez-r7 2014-10-20 18:10:57 -05:00
commit d6f4c02c2a
No known key found for this signature in database
GPG Key ID: 38D99152B9352D83
1 changed files with 23 additions and 2 deletions

View File

@ -54,8 +54,17 @@ class Metasploit3 < Msf::Auxiliary
register_autofilter_ports([ 80, 443, 8080, 8081, 8000, 8008, 8443, 8444, 8880, 8888 ])
end
def find_auth_uri
def to_uri(uri)
begin
# In case TARGETURI is empty, at least we default to '/'
uri = "/" if uri.blank?
URI(uri)
rescue ::URI::InvalidURIError
raise RuntimeError, "Invalid URI: #{uri}"
end
end
def find_auth_uri
if datastore['AUTH_URI'].present?
paths = [datastore['AUTH_URI']]
else
@ -69,8 +78,20 @@ class Metasploit3 < Msf::Auxiliary
end
paths.each do |path|
uri = ''
begin
uri = to_uri(path)
rescue RuntimeError => e
# Bad URI so we will not try to request it
print_error(e.message)
next
end
uri = normalize_uri(uri.path)
res = send_request_cgi({
'uri' => path,
'uri' => uri,
'method' => datastore['REQUESTTYPE'],
'username' => '',
'password' => ''