1
mirror of https://github.com/rapid7/metasploit-payloads synced 2025-02-28 06:13:03 +01:00

fix process_execute with escaped arguments

This commit is contained in:
Tim 2017-09-07 18:18:22 +08:00
parent 9931cb133b
commit fe02cd012b

View File

@ -3,8 +3,14 @@ package com.metasploit.meterpreter.stdapi;
import java.io.IOException;
public class stdapi_sys_process_execute_V1_3 extends stdapi_sys_process_execute {
protected Process execute(String[] cmdarray) throws IOException {
Process proc = Runtime.getRuntime().exec(cmdarray, null, Loader.cwd);
return proc;
@Override
protected Process execute(String cmdstr) throws IOException {
if (System.getProperty("os.name").toLowerCase().contains("windows")) {
return super.execute(cmdstr);
}
Process process = Runtime.getRuntime().exec(new String[]{"sh", "-c", cmdstr}, null, Loader.cwd);
return process;
}
}