rapid7/metasploit-framework — pull request #6 by tecknicaltom (2011-11-11 08:18:30+00:00)
Title: Bash format for msfencode/msfvenom

This patch adds a Bash output format for msfencode and msfvenom. This is especially useful for local exploitation with shellcode in an environment variable.
Example output:

$ echo 'this is a test' | ./msfvenom -f bash
[-] Using X86 architecture and Windows platform for stdin payload to change use -a and --platform
export buf=\
$'\x74\x68\x69\x73\x20\x69\x73\x20\x61\x20\x74\x65\x73\x74'\
$'\x0a'

It adds unit tests for the new format and also fixes a unit test that was broken (assert_equal 'AAAAAAAAA', Rex::Text.pattern_create(9,['A'])) due to a bug in the shortcut in pattern_create.

This is the same patch as submitted on redmine here: https://dev.metasploit.com/redmine/issues/5454 on 09/15/2011.