This fixes a test failure when running acceptance tests with Java 8 on Windows.
At some point in the past, it seems that OpenJDK decided to change the behaviour of ProcessBuilder on Windows, to partially-but-not-entirely start doing some argv-like escaping when converting to a Windows command line.
Seems like it's just better for us to avoid letting Java do any smarts, and just create a command line string that is passed straight to the CreateProcess API, which we know has been consistent since the dawn of time.
Verification
On both older (Java 8? 11?) and newer (tested on Java 16):
[ ] In MSF, check out the new_cmd_exec branch
[ ] Build the java solution (run make when in a directory adjacent to MSF)
[ ] Create a java payload (java/meterpreter/reverse_tcp), and run it on Windows
[ ] Catch the shell in MSF - validate that it warns that ext_server_stdapi.jar is being used
This fixes a test failure when running acceptance tests with Java 8 on Windows.
At some point in the past, it seems that OpenJDK decided to change the behaviour of
ProcessBuilder
on Windows, to partially-but-not-entirely start doing some argv-like escaping when converting to a Windows command line.Seems like it's just better for us to avoid letting Java do any smarts, and just create a command line string that is passed straight to the
CreateProcess
API, which we know has been consistent since the dawn of time.Verification
On both older (Java 8? 11?) and newer (tested on Java 16):
java/meterpreter/reverse_tcp
), and run it on Windowsext_server_stdapi.jar is being used
loadpath test/modules/
use post/test/cmd_exec
run
with the captured session