Introduction
Welcome to the world of Metasploit! The Metasploit Framework is a powerful tool used by security professionals for penetration testing and vulnerability assessment. At its heart is the Metasploit Console, or msfconsole, an interactive command-line interface that gives you access to the framework's vast array of modules, exploits, and payloads.
In this lab, you will learn the essential commands for navigating msfconsole. Mastering these basics is the first step toward effectively using Metasploit. We will cover how to get help, manage your projects with workspaces, search for modules, view detailed information about them, and properly exit the console.
Let's get started by launching the console.
Explore Core Commands with help Command
In this step, you will launch the Metasploit Console and use the help command to explore the available commands. The help command is your most valuable resource when you're unsure about what a command does or what commands are available.
First, let's start the Metasploit Console. We'll use the -q (quiet) flag to skip the startup banner for a cleaner interface.
Execute the following command in your terminal:
msfconsole -q
You will notice that your command prompt changes to msf >, indicating that you are now inside the Metasploit Console.
Now, let's use the help command to see a list of all available commands.
help
You will see a long list of commands, categorized for easier navigation.
Core Commands
=============
Command Description
------- -----------
? Help menu
banner Display an awesome metasploit banner
cd Change the current working directory
color Toggle color output
connect Communicate with a host
...
Module Commands
===============
Command Description
------- -----------
advanced Displays advanced options for a module
back Move back from the current context
info Displays information about a module
...
You can also get detailed help for a specific command. For example, to learn more about the search command, you can type help search.
help search
This will display the syntax and options for the search command.
Usage: search [options] <keywords>
Search for modules, plugins, and other framework objects.
OPTIONS:
-h, --help Help banner.
-o <file>, --output <file> Send output to a file in csv format.
-S <string>, --search <string> Search string for row filtering.
-t <type>, --type <type> The type of module to search for (exploit, payload, auxiliary, etc)
...
Feel free to explore other commands using help before moving to the next step.
View Workspace Management with workspace Command
In this step, you'll learn about workspaces. Workspaces are a way to organize your work in Metasploit. Each workspace is a self-contained environment that stores information about hosts, services, vulnerabilities, and loot for a specific engagement. This is incredibly useful for keeping different penetration testing projects separate.
By default, you are in the default workspace. You can view the current and available workspaces using the workspace command.
workspace
The output will show you the available workspaces, with an asterisk * indicating the one you are currently in.
* default
Let's create a new workspace for our project. We'll name it myproject. The -a flag is used to add a new workspace.
workspace -a myproject
Metasploit will confirm the creation and automatically switch you to the new workspace.
[*] Added workspace: myproject
[*] Workspace: myproject
Now, if you list the workspaces again, you will see both default and myproject, with myproject being the active one.
workspace
default
* myproject
All subsequent actions, such as scanning hosts or collecting data, will now be saved within the myproject workspace.
List Available Modules with search Command
In this step, you will learn how to find modules using the search command. The Metasploit Framework contains thousands of modules, which are the core components you'll use to perform actions. These include exploits, auxiliary scanners, payloads, and more. The search command is essential for finding the right tool for the job.
You can search for modules based on keywords. For example, let's search for modules related to smb (Server Message Block), a common network protocol.
search smb
The output will be a long list of matching modules. The results are displayed in a table with several columns:
- #: The index number of the result.
- Name: The full path and name of the module.
- Disclosure Date: The date the vulnerability was publicly disclosed.
- Rank: The reliability of the exploit, from
lowtoexcellent. - Check: Indicates if the module has a
checkmethod to safely test for vulnerability. - Description: A brief summary of what the module does.
Matching Modules
================
## Name Disclosure Date Rank Check Description
- ---- --------------- ---- ----- -----------
0 auxiliary/admin/smb/impacket/secretsdump 2021-11-09 normal No SMB Secrets Dump
1 auxiliary/admin/smb/psexec_ntdsgrab 2021-11-09 normal No PsExec NTDSGRAB
...
58 exploit/windows/smb/ms17_010_eternalblue 2017-03-14 average Yes MS17-010 EternalBlue SMB Remote Windows Kernel Pool Corruption
...
You can refine your search using keywords like type, platform, name, etc. For instance, to find only exploit modules for the windows platform related to smb, you can use the following command:
search type:exploit platform:windows smb
This will give you a much more focused list of results, making it easier to find the specific exploit you need.
Display Module Information with info Command
In this step, you'll learn how to get detailed information about a specific module using the use and info commands. After finding a promising module with search, you need to understand what it does, what options it requires, and what targets it affects.
First, you need to select a module to work with. This is done with the use command, followed by the module's full name from the search results. Let's select the famous eternalblue exploit.
use exploit/windows/smb/ms17_010_eternalblue
Notice that your prompt changes. It now includes the name of the active module, indicating that you are in its context.
msf exploit(windows/smb/ms17_010_eternalblue) >
Now that a module is selected, you can get detailed information about it using the info command.
info
This command displays a comprehensive overview of the module, including:
- Name, Module, Platform, Arch
- Privileged: Whether it requires special permissions.
- License and Rank
- Provided by: The authors of the module.
- Available targets: The specific operating systems or applications it can target.
- Basic options: The parameters you need to configure, like the target IP address (
RHOSTS). - Payload information: The types of payloads it can deliver.
- Description: A detailed explanation of the vulnerability.
- References: Links to advisories and articles (CVE, BID, etc.).
Name: MS17-010 EternalBlue SMB Remote Windows Kernel Pool Corruption
Module: exploit/windows/smb/ms17_010_eternalblue
Platform: Windows
Arch: x86, x64
Privileged: Yes
License: Metasploit Framework License (BSD)
Rank: Average
...
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 445 yes The target port (TCP)
SMBDomain . no (Optional) The Windows domain to use for authentication
...
Reviewing this information is a critical step before attempting to run any exploit.
Exit Console with exit Command
In this final step, you will learn how to properly exit the Metasploit Console. While you can close the terminal window or use Ctrl+C, the recommended way to leave msfconsole is by using the exit command.
This ensures that the framework shuts down gracefully, stopping any running jobs and saving the current state.
Before you exit, you can return to the main msfconsole prompt from a module's context by using the back command.
back
Your prompt will return to the standard msf >.
Now, to exit the console completely, simply type exit.
exit
You will see a shutdown message, and you will be returned to your regular system shell prompt.
labex:project$
This concludes our basic tour of Metasploit Console navigation.
Summary
Congratulations! You have successfully completed this lab on Metasploit Console navigation basics.
In this lab, you learned how to perform the most fundamental operations within msfconsole:
- Starting the console and using the
helpcommand to discover and learn about other commands. - Organizing your projects using the
workspacecommand to create and manage separate environments. - Finding modules for any task with the powerful
searchcommand and its filters. - Examining a module's details, options, and targets with the
infocommand. - Properly shutting down the framework using the
exitcommand.
These commands are the foundation upon which all your future work in Metasploit will be built. With this knowledge, you are now ready to explore more advanced topics, such as configuring and running modules.



