Sunday, 26 June 2011

Metasploit - How to log the output of what you are doing

Yes, I admit it, I also was one of the people scrolling up and down to find the information I was looking for in a module's output, or copying the whole stdout to a file in order to make my life a bit easier. As of revision r13028 [1] the console now supports the spool command.
(To access the new command, use the msfupdate command on Linux (or just "svn update") or the Metasploit Update link on Windows)


No more hassle, you can use the spool command to log all the stdout to a file automatically! So, while in metasploit, you can type:


spool on


or


spool /root/msfoutput.txt


and anything you do will be logged in that file (all output will always append).




If you want to stop this just type:


spool off




As a quick tip, you can either check the contents of the log file by using the 'cat' command or follow the stream as it is being generated by using the 'tail -f' command


Hope you find this helpful as I did! :D







[1] https://community.rapid7.com/community/metasploit/blog/2011/06/25/metasploit-framework-console-output-spooling