mirror of
https://github.com/rapid7/metasploit-payloads
synced 2025-03-24 18:16:24 +01:00
cleaner contextless meterpreter
This commit is contained in:
parent
ba2433a16f
commit
5c362ad256
@ -53,7 +53,13 @@ public class AndroidMeterpreter extends Meterpreter {
|
|||||||
private static Context context;
|
private static Context context;
|
||||||
|
|
||||||
private void findContext() throws Exception {
|
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");
|
final Method currentApplication = activityThreadClass.getMethod("currentApplication");
|
||||||
context = (Context) currentApplication.invoke(null, (Object[]) null);
|
context = (Context) currentApplication.invoke(null, (Object[]) null);
|
||||||
if (context == null) {
|
if (context == null) {
|
||||||
@ -89,7 +95,6 @@ public class AndroidMeterpreter extends Meterpreter {
|
|||||||
findContext();
|
findContext();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
// No context (running as root?)
|
|
||||||
}
|
}
|
||||||
startExecuting();
|
startExecuting();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user