From 8bacddb18f909b5d3a10aa5abc6450ce1b1bc2f2 Mon Sep 17 00:00:00 2001 From: Adam Cammack Date: Fri, 13 Apr 2018 15:00:26 -0500 Subject: [PATCH] Land #9872, Fix JSONRPC fields in external modules --- lib/msf/core/modules/external/message.rb | 4 ++-- lib/msf/core/modules/external/python/metasploit/module.py | 4 ++-- lib/msf/core/modules/external/ruby/metasploit.rb | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/msf/core/modules/external/message.rb b/lib/msf/core/modules/external/message.rb index 492baa6476..886a17534a 100644 --- a/lib/msf/core/modules/external/message.rb +++ b/lib/msf/core/modules/external/message.rb @@ -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 diff --git a/lib/msf/core/modules/external/python/metasploit/module.py b/lib/msf/core/modules/external/python/metasploit/module.py index bec3112a61..f9ccfc5a77 100644 --- a/lib/msf/core/modules/external/python/metasploit/module.py +++ b/lib/msf/core/modules/external/python/metasploit/module.py @@ -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' }}) diff --git a/lib/msf/core/modules/external/ruby/metasploit.rb b/lib/msf/core/modules/external/ruby/metasploit.rb index 00751fc8d1..1e63359213 100644 --- a/lib/msf/core/modules/external/ruby/metasploit.rb +++ b/lib/msf/core/modules/external/ruby/metasploit.rb @@ -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' } })