Fixed code issues as requested in PR2801
Mostly coding style issues Re-tested in testbed - output as expectedbug/bundler_fix
parent
87648476e1
commit
d0d82fe405
|
@ -26,7 +26,6 @@ class Metasploit3 < Msf::Auxiliary
|
|||
)
|
||||
register_options(
|
||||
[
|
||||
Opt::RPORT(443),
|
||||
OptString.new('TARGETURI', [ true, "The path to the Sametime Server", '/']),
|
||||
OptBool.new('QuerySametimeProxy', [ true, "Automatically query Sametime proxy if found", true]),
|
||||
OptBool.new('ShowVersions', [ true, "Display Version information from server", true]),
|
||||
|
@ -41,14 +40,16 @@ class Metasploit3 < Msf::Auxiliary
|
|||
|
||||
end
|
||||
|
||||
def peer
|
||||
return "#{rhost}:#{rport}"
|
||||
end
|
||||
|
||||
def check_url(tpath, url, stproxy_rhost='')
|
||||
|
||||
begin
|
||||
if not stproxy_rhost.empty?
|
||||
if stproxy_rhost.empty?
|
||||
checked_host = datastore['RHOST']
|
||||
vprint_status("Requesting \"#{checked_host}:#{rport}#{normalize_uri(tpath, url)}\"")
|
||||
res = send_request_cgi({
|
||||
'uri' => normalize_uri(tpath, url),
|
||||
'method' => 'GET'
|
||||
})
|
||||
else
|
||||
checked_host = stproxy_rhost
|
||||
# make request with provided stproxy rhost
|
||||
vprint_status("Requesting \"#{checked_host}:#{rport}#{normalize_uri(tpath, url)}\"")
|
||||
|
@ -58,14 +59,6 @@ class Metasploit3 < Msf::Auxiliary
|
|||
'rhost' => stproxy_rhost, # connect to Sametime Proxy
|
||||
'vhost' => stproxy_rhost # set appropriate VHOST
|
||||
})
|
||||
else
|
||||
checked_host = datastore['RHOST']
|
||||
vprint_status("Requesting \"#{checked_host}:#{rport}#{normalize_uri(tpath, url)}\"")
|
||||
res = send_request_cgi({
|
||||
'uri' => normalize_uri(tpath, url),
|
||||
'method' => 'GET'
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
if not res
|
||||
|
@ -82,7 +75,11 @@ class Metasploit3 < Msf::Auxiliary
|
|||
if url.include?('WebAVServlet')
|
||||
# special handler for WebAVServlet as body is JSON regardless of content-type
|
||||
|
||||
begin
|
||||
res_json = JSON.parse(res.body)
|
||||
rescue JSON::ParserError
|
||||
print_error("Unable to parse JSON response")
|
||||
end
|
||||
extract_webavservlet_data(res_json)
|
||||
|
||||
elsif res['content-type'].include?("text/plain") or res['content-type'].include?("text/html")
|
||||
|
@ -93,7 +90,11 @@ class Metasploit3 < Msf::Auxiliary
|
|||
|
||||
elsif res['content-type'].include?("text/json") or res['content-type'].include?("text/javaScript")
|
||||
|
||||
begin
|
||||
res_json = JSON.parse(res.body)
|
||||
rescue JSON::ParserError
|
||||
print_error("Unable to parse JSON response")
|
||||
end
|
||||
|
||||
# store configuration files as loot
|
||||
store_config(tpath, url, res_json, checked_host) if datastore['StoreConfigs']
|
||||
|
@ -102,13 +103,6 @@ class Metasploit3 < Msf::Auxiliary
|
|||
|
||||
end
|
||||
|
||||
rescue Errno::ENOPROTOOPT, Errno::ECONNRESET, ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::ArgumentError
|
||||
print_error("#{checked_host}:#{rport} - Unable to Connect")
|
||||
return
|
||||
rescue ::Timeout::Error, ::Errno::EPIPE
|
||||
print_error("#{checked_host}:#{rport} - Timeout error")
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
def extract_webavservlet_data(res_json)
|
||||
|
|
Loading…
Reference in New Issue