Land #9872, Fix JSONRPC fields in external modules
parent
0bb0e78599
commit
8bacddb18f
|
@ -14,9 +14,9 @@ class Msf::Modules::External::Message
|
|||
m = self.new(j['method'].to_sym)
|
||||
m.params = j['params']
|
||||
m
|
||||
elsif j['response']
|
||||
elsif j['result']
|
||||
m = self.new(:reply)
|
||||
m.params = j['response']
|
||||
m.params = j['result']
|
||||
m.id = j['id']
|
||||
m
|
||||
end
|
||||
|
|
|
@ -66,11 +66,11 @@ def report_vuln(ip, name, **opts):
|
|||
def run(metadata, module_callback):
|
||||
req = json.loads(os.read(0, 10000).decode("utf-8"))
|
||||
if req['method'] == 'describe':
|
||||
rpc_send({'jsonrpc': '2.0', 'id': req['id'], 'response': metadata})
|
||||
rpc_send({'jsonrpc': '2.0', 'id': req['id'], 'result': metadata})
|
||||
elif req['method'] == 'run':
|
||||
args = req['params']
|
||||
module_callback(args)
|
||||
rpc_send({'jsonrpc': '2.0', 'id': req['id'], 'response': {
|
||||
rpc_send({'jsonrpc': '2.0', 'id': req['id'], 'result': {
|
||||
'message': 'Module completed'
|
||||
}})
|
||||
|
||||
|
|
|
@ -30,12 +30,12 @@ module Metasploit
|
|||
req = JSON.parse($stdin.readpartial(10000), symbolize_names: true)
|
||||
if req[:method] == 'describe'
|
||||
rpc_send({
|
||||
jsonrpc: '2.0', id: req[:id], response: metadata
|
||||
jsonrpc: '2.0', id: req[:id], result: metadata
|
||||
})
|
||||
elsif req[:method] == 'run'
|
||||
callback.call req[:params]
|
||||
rpc_send({
|
||||
jsonrpc: '2.0', id: req[:id], response: {
|
||||
jsonrpc: '2.0', id: req[:id], result: {
|
||||
message: 'Module completed'
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue