Skip to content

Commit

Permalink
Land #9872, Fix JSONRPC fields in external modules
Browse files Browse the repository at this point in the history
  • Loading branch information
acammack-r7 authored and msjenkins-r7 committed Apr 16, 2018
1 parent 0bb0e78 commit 8bacddb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/msf/core/modules/external/message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ def self.from_module(j)
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
Expand Down
4 changes: 2 additions & 2 deletions lib/msf/core/modules/external/python/metasploit/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}})

Expand Down
4 changes: 2 additions & 2 deletions lib/msf/core/modules/external/ruby/metasploit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ def run(metadata, callback)
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'
}
})
Expand Down

0 comments on commit 8bacddb

Please sign in to comment.