If you use Metasploit you may have had the need where you have to leave your exploit to execute another one or just to run a normal Linux command (remember that while using the Metasploit prompt msf> you can still execute Linux commands). The following steps show you how you can manage more than one exploit without stopping them.
If you are executing an exploit already and you have the “meterpreter>” prompt you can execute the “background” command, this will instruct Mestasploit to continue running the exploit but will return you the “msf>” prompt and now you can start another exploit or execute any other Linux command.
To return again to your exploit execute the following command:
This will give you the actual list of active sessions where you are executing an exploit, you just need to locate the exploit you want to return to, look for its session number and execute the following command:
msf> sessions -i [Session number]
Now you can return to your exploit and keep with your work withot having to stop it.
There will also be some times where the execution of an exploit maintain the port you want to use with another exploit. If you executed Ctrl+C or the “exit” command to quit the exploit it may be that the port remain still in use and when you execute it again you’ll get an error beacause the port is in use. To avoid this execute the following command:
As a result you’ll get the actual list of executing tasks, just locate the number that corresponds to the busy exploit and then stop it with the following command:
msf> kill [Job number]
Now the port will be free again for you to use it with another exploit without having to quit the entire Metasploit to run it again.
If you want more information and tips visit our Metasploit publications.
You can also send us your comments and questions to our Twitter account: @redinskala where you’ll find more info and security tips.