mirror of
https://github.com/rapid7/metasploit-payloads
synced 2024-11-26 17:41:08 +01:00
Land #523, fix java getenv and android getpid
This commit is contained in:
commit
fa1ed78f33
@ -134,6 +134,7 @@ public class AndroidMeterpreter extends Meterpreter {
|
||||
mgr.registerCommand(CommandId.STDAPI_SYS_PROCESS_EXECUTE, stdapi_sys_process_execute_V1_3.class);
|
||||
mgr.registerCommand(CommandId.STDAPI_SYS_PROCESS_CLOSE, stdapi_sys_process_close.class);
|
||||
mgr.registerCommand(CommandId.STDAPI_SYS_PROCESS_GET_PROCESSES, stdapi_sys_process_get_processes_android.class);
|
||||
mgr.registerCommand(CommandId.STDAPI_SYS_PROCESS_GETPID, stdapi_sys_process_getpid_android.class);
|
||||
mgr.registerCommand(CommandId.STDAPI_UI_DESKTOP_SCREENSHOT, stdapi_ui_desktop_screenshot.class);
|
||||
if (context != null) {
|
||||
mgr.registerCommand(CommandId.APPAPI_APP_LIST, appapi_app_list.class);
|
||||
|
@ -0,0 +1,19 @@
|
||||
package com.metasploit.meterpreter.android;
|
||||
|
||||
import android.os.Process;
|
||||
|
||||
import com.metasploit.meterpreter.Meterpreter;
|
||||
import com.metasploit.meterpreter.TLVPacket;
|
||||
import com.metasploit.meterpreter.TLVType;
|
||||
import com.metasploit.meterpreter.command.Command;
|
||||
import com.metasploit.meterpreter.stdapi.stdapi_sys_process_getpid;
|
||||
|
||||
public class stdapi_sys_process_getpid_android extends stdapi_sys_process_getpid implements Command {
|
||||
|
||||
public int execute(Meterpreter meterpreter, TLVPacket request, TLVPacket response) throws Exception {
|
||||
int pid = Process.myPid();
|
||||
response.add(TLVType.TLV_TYPE_PID, pid);
|
||||
return ERROR_SUCCESS;
|
||||
|
||||
}
|
||||
}
|
@ -22,10 +22,12 @@ public class stdapi_sys_config_getenv implements Command {
|
||||
}
|
||||
|
||||
String envVal = System.getenv(envVar);
|
||||
TLVPacket grp = new TLVPacket();
|
||||
grp.add(TLVType.TLV_TYPE_ENV_VARIABLE, envVar);
|
||||
grp.add(TLVType.TLV_TYPE_ENV_VALUE, envVal);
|
||||
response.addOverflow(TLVType.TLV_TYPE_ENV_GROUP, grp);
|
||||
if (envVal != null) {
|
||||
TLVPacket grp = new TLVPacket();
|
||||
grp.add(TLVType.TLV_TYPE_ENV_VARIABLE, envVar);
|
||||
grp.add(TLVType.TLV_TYPE_ENV_VALUE, envVal);
|
||||
response.addOverflow(TLVType.TLV_TYPE_ENV_GROUP, grp);
|
||||
}
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
Map<String,String> envVals = System.getenv();
|
||||
|
Loading…
Reference in New Issue
Block a user