rapid7/metasploit-framework — pull request #2484 by zeroSteiner (2013-10-07 21:39:08+00:00)
Title: Unify CMD Stagers

This is not ready to be merged and would require additional testing but I am proposing this as an alternative to PR #2430. This unifies all of the cmd stagers with the exception of the TFTP one, which will continue to function as it does now.

The advantage to this approach is that the module can select the appropriate stager to use at run time by setting the flavor option. The CmdStagerMulti includes a method which will try to guess an appropriate stager based on the target platform. This currently uses VBS for Windows and the Bourne stager for everything else. The default stager can easily be changed in the guess_flavor method.

Unlike jduck's mixin this does not add a new datastore option for the stager selection but instead leaves it up to the module developer who may choose to add the option themselves or define an appropriate one in the target hash.

All the modules that used a stager other than the TFTP one have been converted and exploit/multi/ssh/sshexec demonstrates the ability to hot swap between the echo and bourne stagers.