I will use android/browser/webview_addjavascriptinterface to pwn an Android target, but I want to execute a command before the victim falls in the exploit. I want to install an APK file on the victim machine automatically.

  • Your title does not match the question in the post. What you have said in the post is that you want to execute a command before exploitation (impossible). Your title asks how to execute a command before meterpreter executes a network connection (a trivial task). Which question do you want an answer to?
    – schroeder
    Commented May 4, 2018 at 9:29
  • The answer to your title is to simply write a script as a payload that installs the APK and then runs meterpreter, or configure meterpreter with pre-defined commands, which include installing the APK.
    – schroeder
    Commented May 4, 2018 at 9:31

1 Answer 1


I think we need to step back to the basics here for this question. The vulnerable software is exploited in order to execute arbitrary code. What you are asking is how to execute commands before you're able to execute your commands. This is simply not possible.

Not the answer you're looking for? Browse other questions tagged .