metasploit

Initializing database

First time using Metasploit, the database should be initialized by msfdb init. Check the status by db_status. This helps organizing and tracking activities for later use. Different workspaces can be created for different occasions.

The postgresql service must be started before launching Metasploit in order to connect to the database.

Usage

General

msfconsole launches Metasploit and msfconsole -q launches Metasploit quietly. See msfconsole -h for more options.

After Metasploit is loaded, some of the more general, widely used and self-explanatory commands are:

  • help

    • NOTE: help <command> will show a help menu for a specific command

  • search to find modules

  • use to use a specific module,

    • NOTE: The number from the # column in a search result can be used instead of the path

  • info will show information of the selected module, or a full path to a payload can be specified

  • connect to communicate with a host netcat-style

  • show options to see which options to set when using a module

  • set, unset, get to set/unset/get options

  • spool <filename> to log output to <filename>

  • sessions to list sessions, use sessions -i <number> to select a session

  • jobs to list jobs

  • exploit or run to launch a module

    • NOTE: Use run -j to launch a module as a job

Database commands

Metasploit comes with several commands that utilizes the database capabilities.

Some of them are:

  • workspaces to list workspaces

  • services to list services in the database

  • vulns to list vulnerabilities in the database

  • db_nmap to execute nmap and feed the output directly into the database

  • ... and several others. See help database for an exhaustive list.

Reference

Full documentation can be found at https://docs.rapid7.com/metasploit/.

Last updated