Using the reverse Meterpreter on all ports

To circumvent this situation, we will use the windows/meterpreter/reverse_tcp_allports payload, which will try every port and will provide us with access to the one that isn't blocked. Also, since we are listening on port 4444 only, we will need to redirect the traffic from all the random ports to port 4444 on our end. We can do this using the following command:

Let's execute the exploit again with all ports using the reverse tcp meterpreter payload:

We can see that we got Meterpreter access to the ...

Get Mastering Metasploit - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.