rapid7/metasploit-framework — pull request #4403 by wchen-r7 (2014-12-16 06:14:44+00:00)
Title: Resolves #4275 - Configurable variable name as an option

Resolves #4275

This allows the payload output to have a configurable variable name. Please note that not all formats have a variable name, the ones that actually do include: Python, Ruby, Perl, Bash, C, C#, Java, Powershell, VBScript, and VB Application.

## Verification ##

This one is just making sure I'm not messing up the the most basic part of msfvenom:

- [ ] Do: ```./msfvenom -p windows/meterpreter/bind_tcp -v myVarName -f raw```
- [ ] You should not see "myVarName" in your payload's output

This following portion should test the actual feature. You need to test quite a few different formats, but they all can be tested like the following example:

```bash
echo AAAA | ./msfvenom -p - -a x86 --platform windows -v myVar -f java
Attempting to read payload from STDIN...
Found 0 compatible encoders
byte myVar[] = new byte[]
{
(byte) 0x41, (byte) 0x41, (byte) 0x41, (byte) 0x41, (byte) 0x0a
};
```

You should also make sure there is always a default variable name (which should be "buf") when -v isn't specified:

```
echo AAAA | ./msfvenom -p - -a x86 --platform windows -f java
Attempting to read payload from STDIN...
Found 0 compatible encoders
byte buf[] = new byte[]
{
(byte) 0x41, (byte) 0x41, (byte) 0x41, (byte) 0x41, (byte) 0x0a
};
```

Now, based on the above two examples, please test the following formats:

- [ ] bash
- [ ] c
- [ ] csharp
- [ ] perl
- [ ] powershell
- [ ] py
- [ ] rb
- [ ] sh
- [ ] vbapplication
- [ ] vbscript