rapid7/metasploit-framework — pull request #1336 by kernelsmith (2013-01-18 04:49:17+00:00)
Title: fixed RM 7705 & adds run_multiple, adds rex/parser/generic...

Adds Rex::Parser::GenericWithEscape at
lib/rex/parser/generic_with_escape.rb which is used via run_multiple
which was added to lib/rex/ui/text/dispatcher_shell.rb which parses for
multiple commands (separated by ';' and escaped by '\\' by default) and
then calls run_single. Rex::Parser::GenericWithEscape may be useful
elsewhere, anywhere you need to parse on an arbitrary separator and
and an arbitrary escape char. It is also purposefully 1.8.x compliant as
1.8.x doesn't support fancy Regex stuff like negative look behinds or
whatever they're called, so this parser does it old school

Running multiple commands was egypt's desire, but I don't think we ever
created a ticket for it. I can create a feature ticket if you want

Most run_singles were converted to run_multiple except those running a
single command straight up like run_single("quit") etc.

Tested with msfconsole -x, msfconsole -r, the resource command, and
sending multiple commands at the msfconsole command line.
Try:
msfconsole -x set VERBOSE true;show options; set VERBOSE false (or any
other combo, and the same with:)
msfconsole -r test.rc (where test.rc has commands similar to above)
resource test.rc
msf > set SMBUser admin;set SMBPass pass;exploit -j
etc