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

reuse the classExists function in process_getpid

This commit is contained in:
Tim W 2022-01-17 09:27:08 +00:00
parent 328a43bccf
commit 023382aa9c
2 changed files with 4 additions and 11 deletions

View File

@ -7,8 +7,9 @@ import com.metasploit.meterpreter.command.Command;
import java.lang.reflect.Method;
public class stdapi_sys_process_getpid_V1_5 implements Command {
private static boolean classExists(String className) {
public class stdapi_sys_process_getpid_V1_5 extends stdapi_sys_process_getpid implements Command {
protected static boolean classExists(String className) {
try {
Class.forName(className);
return true;

View File

@ -7,15 +7,7 @@ import com.metasploit.meterpreter.command.Command;
import java.lang.reflect.Method;
public class stdapi_sys_process_getpid_V1_9 implements Command {
private static boolean classExists(String className) {
try {
Class.forName(className);
return true;
} catch (ClassNotFoundException e) {
return false;
}
}
public class stdapi_sys_process_getpid_V1_9 extends stdapi_sys_process_getpid_V1_5 implements Command {
public int execute(Meterpreter meterpreter, TLVPacket request, TLVPacket response) throws Exception {
if (classExists("java.lang.ProcessHandle"))