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

Land , @timwr switch back to background thread after finding Context

This commit is contained in:
Brent Cook 2015-03-22 21:48:20 -05:00
commit fdebac9f9d

@ -49,6 +49,19 @@ public class AndroidMeterpreter extends Meterpreter {
private static String writeableDir; private static String writeableDir;
private static Context context; 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 { private void findContext() throws Exception {
final Class<?> activityThreadClass = Class.forName("android.app.ActivityThread"); final Class<?> activityThreadClass = Class.forName("android.app.ActivityThread");
final Method currentApplication = activityThreadClass.getMethod("currentApplication"); final Method currentApplication = activityThreadClass.getMethod("currentApplication");
@ -63,11 +76,7 @@ public class AndroidMeterpreter extends Meterpreter {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
try { startExecutingOnThread();
startExecuting();
} catch (Exception e) {
e.printStackTrace();
}
} }
}); });
} else { } else {