1
mirror of https://github.com/rapid7/metasploit-payloads synced 2025-03-18 15:14:10 +01:00

cleaner contextless meterpreter

This commit is contained in:
Tim 2015-05-19 17:19:38 +01:00
parent ba2433a16f
commit 5c362ad256

@ -53,7 +53,13 @@ public class AndroidMeterpreter extends Meterpreter {
private static Context context;
private void findContext() throws Exception {
final Class<?> activityThreadClass = Class.forName("android.app.ActivityThread");
Class<?> activityThreadClass;
try {
activityThreadClass = Class.forName("android.app.ActivityThread");
} catch (ClassNotFoundException e) {
// No context (running as root?)
return;
}
final Method currentApplication = activityThreadClass.getMethod("currentApplication");
context = (Context) currentApplication.invoke(null, (Object[]) null);
if (context == null) {
@ -89,7 +95,6 @@ public class AndroidMeterpreter extends Meterpreter {
findContext();
} catch (Exception e) {
e.printStackTrace();
// No context (running as root?)
}
startExecuting();
}