Jump to content

Meterpreter - Auto run commands on session


Sildaekar

Recommended Posts

I'm very new to the metasploit framework and meterpreter but I've been playing around with it a bit and managed to gain access to two different android phones I had laying around as well as a windows box. The only problem I've been able to find is that there are some commands that need to be ran almost immediately after I gain a session (persistance and the like).

My question is this: Is there any way to automate these commands so that they run as soon as a session is gained?

I'm sure there is as I've found only ONE reference on the topic through google but have yet to find any actual instructions. The basics of what I want to do is this:

1. Navigate to specified directory 
2. Upload file to device
3. Drop to shell
4. Execute file

Any and all help is greatly appreciated.

PS: This question is mainly directed at the android devices.

Edited by Sildaekar
Link to comment
Share on other sites

I'm very new to the metasploit framework and meterpreter but I've been playing around with it a bit and managed to gain access to two different android phones I had laying around as well as a windows box. The only problem I've been able to find is that there are some commands that need to be ran almost immediately after I gain a session (persistance and the like).

My question is this: Is there any way to automate these commands so that they run as soon as a session is gained?

I'm sure there is as I've found only ONE reference on the topic through google but have yet to find any actual instructions. The basics of what I want to do is this:

1. Navigate to specified directory 
2. Upload file to device
3. Drop to shell
4. Execute file

Any and all help is greatly appreciated.

PS: This question is mainly directed at the android devices.

I googled that a while ago and it seems like you can, and that it's even been implemented in Metasploit : https://offensiveinfosec.wordpress.com/tag/autorunscript/

Just have to change the commands in the rc file to the ones you want and it should work. I didn't test it though...

Link to comment
Share on other sites

I haven't had a chance to been busy and going on 28hrs no sleep -_- But I'm gonna try it tomorrow and I'll report back if it works.

Link to comment
Share on other sites

I haven't had a chance to been busy and going on 28hrs no sleep -_- But I'm gonna try it tomorrow and I'll report back if it works.

Ok ! I tried it with running persistence, and it worked flawlessly ! I'm going to try it with multiple commands when I get the time...

Edited by V3sth4cks153
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...