1
mirror of https://github.com/rapid7/metasploit-payloads synced 2025-01-14 17:37:27 +01:00

Switch to Utils.runCommand per timwr's suggestion

This commit is contained in:
Joshua J. Drake 2015-11-18 10:47:28 -06:00
parent f12e49a085
commit 196c11e47d

View File

@ -3,18 +3,12 @@ package com.metasploit.meterpreter.android;
import com.metasploit.meterpreter.Meterpreter;
import com.metasploit.meterpreter.TLVPacket;
import com.metasploit.meterpreter.TLVType;
import com.metasploit.meterpreter.Utils;
import com.metasploit.meterpreter.command.Command;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class stdapi_sys_config_getuid implements Command {
public int execute(Meterpreter meterpreter, TLVPacket request, TLVPacket response) throws Exception {
Process proc = Runtime.getRuntime().exec(new String[]{
"sh", "-c", "id 2>/dev/null"
});
BufferedReader br = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line = br.readLine();
String line = Utils.runCommand("id");
if (line == null) {
return ERROR_FAILURE;
}