FRAMEWORK

// interactive metasploit msfconsole trainer — learn the workflow, not just the syntax

This trainer simulates msfconsole. Every command you'd type at a real prompt, you can type here. The simulator reads your input, validates it, and prints back realistic output — including how things go wrong when you forget a flag or mistype a target. Each command is explained: what it does, why it exists, and where it fits in a real engagement.

⚠ Authorized use only

Metasploit is for security research, CTFs, lab work, and engagements you have written permission for. Pointing it at machines you don't own or have authorization to test is illegal in most jurisdictions. The targets in this trainer are fictional. Practice on Hack The Box, TryHackMe, your own VMs, or your employer's authorized scope.

→ How to use this trainer

Read each module's brief and command anatomy. Watch the demo run — you can replay it. Then attempt each challenge by typing into the live terminal. The terminal accepts help and clear as builtins. Use ↑/↓ to recall previous commands. If stuck, the hints reveal progressively more of the answer. Your progress saves automatically.

01Welcome to msfconsole

// what metasploit is, how to launch it, how to find your way around

Metasploit Framework is the world's most-used exploitation toolkit. Think of it as a giant library of pre-built attacks — exploits, scanners, payloads, post-exploitation modules — wrapped in a command-line shell called msfconsole. Instead of writing custom code for every CVE, you load a module, set a few options, and fire.

Metasploit ships in Kali by default. The console is interactive — when you launch it, you get a prompt that looks like msf6 >, and from there you navigate by typing commands.

→ Mental model

msfconsole is like a kitchen. The pantry has thousands of ingredients (modules). The countertop is your active workspace. You go grab one ingredient (use a module), prep it (set options), and serve it (run or exploit). When you're done, you put it back (back) and grab the next.

Command anatomy — the navigation basics

CommandWhat it does
msfconsoleLaunches the framework console (run from your bash shell)
help or ?Lists every console command, grouped by category
help <cmd>Detailed help on one command. help search shows search filters.
versionPrints framework + console version. Useful when reporting bugs or checking module compatibility.
bannerReprints the ASCII-art startup banner. Cosmetic, but rotates through several designs — try it twice.
historyShows previous commands you've run this session
exit or quitLeaves msfconsole and returns to your shell
Why this matters

Every module you'll ever use lives behind these basic navigation commands. If you can't get help, can't see options, can't get back out — you can't work the framework. Master these first; everything else is just more specific versions.

Demo run

Watch a typical session start: launching the console, checking the version, asking for help.

demo · launch sequence

Challenges

CH 1.1 — Launch the console
unsolved
From your bash prompt, launch Metasploit Framework's interactive console.
You've just sat down at a Kali box. You need to start working with Metasploit. What command do you type?
bash · /home/kali
└─$
CH 1.2 — Check the framework version
unsolved
You're inside msfconsole now. A bug report you're filing needs the exact framework version. Print it.
The prompt has changed from └─$ to msf6 > — that's how you know you're inside the framework.
msfconsole
msf6 >
CH 1.3 — Find help on the search command
unsolved
You want to learn what filters the search command accepts. Print its detailed help inside msfconsole.
Generic help dumps every command — too much. Pinpoint help for one command is faster.
msfconsole
msf6 >

02Searching the arsenal

// finding the right module among thousands

Metasploit ships with 2,300+ exploits, hundreds of payloads, scanners, and post-exploitation modules. The search command is how you find the one you need. It accepts a free-text query, but the real power is in the filters — keyword:value pairs that narrow results dramatically.

→ Module path naming

Modules have paths like exploit/windows/smb/ms17_010_eternalblue. Read it left-to-right: category / platform / service / name. That structure is what the filters target. type:exploit hits the first segment, platform:windows hits the second, and so on.

Command anatomy — search filters

FilterPurpose
search <term>Free-text query against name and description. search eternalblue finds anything mentioning EternalBlue.
type:exploitRestrict to exploits. Other values: auxiliary, post, payload, encoder, nop, evasion
platform:windowsRestrict to a target platform. Values: windows, linux, unix, osx, android, php, python, java, multi
cve:2017-0144Match a specific CVE identifier. Year-only also works: cve:2017
name:smbSubstring match against the module name only (not description)
rank:excellentFilter by exploit reliability. Worst→best: manual, low, average, normal, good, great, excellent
app:clientClient-side (user must open something) vs app:server (remote, no interaction)
combine themsearch type:exploit platform:windows smb — filters AND together
Why this matters

Without filters, search smb returns 80+ results. With type:exploit platform:windows smb, you're down to maybe 25 — all relevant. In a time-boxed engagement, the difference between scrolling output and finding-what-you-need is fluency with these filters.

Demo run

Searching for EternalBlue three different ways — by name, by CVE, by combined filter.

demo · search workflow

Challenges

CH 2.1 — Find EternalBlue by name
unsolved
A pentest report mentions a target is vulnerable to MS17-010 EternalBlue. Search for the module by its name.
You don't remember the exact module path yet. Free-text search is the right starting move.
msfconsole
msf6 >
CH 2.2 — Find by CVE identifier
unsolved
Your vulnerability report cites CVE-2017-0144. Find every Metasploit module that targets that exact CVE.
CVE-based searching is more precise than name-based — vendors disagree on names but CVEs are unique.
msfconsole
msf6 >
CH 2.3 — Filter by type and platform
unsolved
Find all exploits targeting Windows SMB. Use type and platform filters together so the result list is short and relevant.
Plain search smb would also dump scanners, post-modules, and Linux Samba bugs — none of which are what you want right now.
msfconsole
msf6 >

03Anatomy of a module

// the use → info → show options → set workflow that runs everything

Once you've found a module, working with it is always the same four-step dance: use it, info it, show options on it, then set what's required. This loop is the same for an exploit, a scanner, a post-module, anything. Once you internalize it, the framework gets dramatically smaller.

→ The four-step loop

1. use — load the module into your active workspace. The prompt changes to show what's loaded.
2. info — read the module's documentation: what it does, refs, targets, options.
3. show options — list every parameter, what it's currently set to, and which are required.
4. set — assign values to required options, primarily RHOSTS (the target).

Command anatomy — module workflow

CommandWhat it does
use <module-path>Loads the module. Prompt becomes msf6 exploit(...) > showing what's active. Tab-completion works on paths.
use <number>After a search, you can use the result number directly: use 0 picks the first result.
infoFull description, references (CVE, BID, MSB), authors, supported targets. Read this before firing.
show optionsThree-column table: Name, Current Setting, Required, Description. Required options must be set or the module won't run.
show targetsLists target OS/version variants. Some exploits work on Win7 but not Win10 — pick the right one.
show payloadsLists payloads compatible with the loaded exploit. Filtered automatically.
set OPT valueAssign a value to an option. Case-insensitive on the option name. set RHOSTS 10.10.10.5.
setg OPT valueSet globally — applies to every module loaded this session. Useful for LHOST when your IP doesn't change.
unset OPTClear a value. unset RHOSTS. Use unset all to clear everything.
backUnload the current module — prompt returns to msf6 >. Doesn't lose your sets if you re-use the same module.
Why this matters

Newcomers skip info and jump to exploit — which crashes loudly because they didn't notice the module needs three required options, not one. The four-step loop isn't bureaucracy; it's the difference between knowing what your tool will do versus throwing packets at a target hoping for the best.

Demo run

Loading EternalBlue, reading its info, viewing options, setting the target.

demo · module workflow

Challenges

CH 3.1 — Load the EternalBlue module
unsolved
Load exploit/windows/smb/ms17_010_eternalblue into your active workspace.
Your search has already found it. Now load it.
msfconsole
msf6 >
CH 3.2 — Read the module info
unsolved
Print the full description, references, and supported targets for the loaded module.
Always read this before firing. References point you at the original CVE / advisory if anything goes weird.
msfconsole
msf6 exploit(windows/smb/ms17_010_eternalblue) >
CH 3.3 — List the options
unsolved
List every option this module accepts so you can see what's required and what's optional.
Required options have yes in the Required column. Anything missing a current setting that's required will block exploit from running.
msfconsole
msf6 exploit(windows/smb/ms17_010_eternalblue) >
CH 3.4 — Set the target host
unsolved
Set the target to 10.10.10.5. The required option for "the host you want to attack" is named RHOSTS.
RHOSTS = "Remote Host(S)". Plural because it can take a single IP, a range (10.10.10.0/24), or a file (file:targets.txt).
msfconsole
msf6 exploit(windows/smb/ms17_010_eternalblue) >

04Payloads explained

// the part you actually send — and why picking the right one matters

An exploit is the delivery mechanism. The payload is what runs on the target after the exploit lands. Pick the wrong payload and you either get nothing (a session that dies in 30 seconds), or you get a basic shell when you could have had a Meterpreter — losing 90% of your post-ex capability.

→ The three big payload axes

Reverse vs Bind: Reverse = target connects back to you (works through NAT/firewalls). Bind = target opens a port and you connect to it (almost always blocked by firewalls). Default to reverse.

Staged vs Stageless: Staged splits the payload into a tiny initial dropper plus a second-stage download — small footprint, two network connections. Stageless ships the full payload at once — bigger but more reliable through fragile shells.

Shell vs Meterpreter: Shell = a regular OS command prompt. Meterpreter = an in-memory framework with file transfer, screenshot, hash dump, pivoting, lateral commands. Always prefer Meterpreter when available.

Reading payload paths

PathDecoded
windows/x64/meterpreter/reverse_tcpWindows, 64-bit, Meterpreter, reverse TCP, staged. The default for most modern Windows exploits.
windows/x64/meterpreter_reverse_tcpSame idea, but stageless — note underscore instead of slash before reverse_tcp. One transfer, larger payload.
linux/x64/meterpreter/reverse_tcpLinux Meterpreter — yes, it exists; not just Windows.
cmd/unix/reverse_bashJust a bash one-liner reverse shell. No framework, no fancy commands. Use when target is a constrained appliance.
generic/shell_reverse_tcpGeneric shell over reverse TCP. Falls back to whatever the target offers (cmd.exe, /bin/sh).

Key payload options

OptionWhat it does
LHOST"Listen Host" — your attacker IP. The target will connect to this. Common bug: setting this to 127.0.0.1 by accident — the target can't reach your loopback.
LPORT"Listen Port" — what port your handler listens on. Defaults to 4444. Pick a port your firewall allows outbound; 443 often gets through restrictive egress.
set payload <path>Switch the payload from the default. Always tab-complete or copy-paste — the paths are long.
show payloadsLists every payload compatible with the loaded exploit. Don't pick a Linux payload for a Windows exploit.
Why this matters

The number-one reason "the exploit ran but I didn't get a session" is a payload misconfig: LHOST set to your hostname instead of your IP, LHOST set to a NAT'd address the target can't reach, or LPORT blocked outbound from the target's network. Spend 30 seconds confirming your payload before firing.

Demo run

Listing compatible payloads, switching to a stageless variant, setting LHOST/LPORT.

demo · payload selection

Challenges

CH 4.1 — List compatible payloads
unsolved
EternalBlue is loaded. List every payload that's compatible with it.
You want to confirm a 64-bit Meterpreter is available before continuing.
msfconsole
msf6 exploit(windows/smb/ms17_010_eternalblue) >
CH 4.2 — Set a 64-bit Meterpreter reverse TCP
unsolved
Set the payload to windows/x64/meterpreter/reverse_tcp.
This is the most common Metasploit payload in the wild — staged, 64-bit, full Meterpreter feature set.
msfconsole
msf6 exploit(windows/smb/ms17_010_eternalblue) >
CH 4.3 — Set your listening IP
unsolved
Your tunneled VPN gives you the address 10.10.14.2. Set LHOST so the reverse Meterpreter connects back to you.
If you set this to 127.0.0.1 or your hostname, the target can't reach you and the session never opens.
msfconsole
msf6 exploit(windows/smb/ms17_010_eternalblue) >

05Firing the exploit

// check, exploit, sessions — the actual moment of compromise

Everything so far has been setup. Now you fire. The professional move is always check first, then exploit. The check command runs a non-destructive probe to confirm the target is actually vulnerable — if you skip it, you might be wasting time on a target that's been patched.

→ check vs exploit

check — sends harmless probes. Result: vulnerable / not vulnerable / appears unexploitable / detection unavailable. Not every module supports it.

exploit (or run — same thing) — actually fires. If everything's set up correctly, you get a session. If options are missing, the framework refuses and tells you what's wrong.

Command anatomy

CommandWhat it does
checkProbe target without exploiting. Best practice before exploit.
exploit / runFire the module. run is an alias — they're identical.
exploit -jRun as a background job. Handler stays up after session opens — needed for multiple sessions or to keep listening.
exploit -zDon't auto-interact with the new session. Pairs with -j for hands-off automation.
jobsList running background jobs.
jobs -k <id>Kill a job by ID.
sessions / sessions -lList active sessions you've opened. Each gets a numeric ID.
sessions -i <id>Interact with session N — drops you into Meterpreter or shell.
sessions -KKill all sessions. Capital K. Useful at end-of-engagement.
Why this matters

Without -j, your exploit ties up the foreground. If you want to launch a second exploit while the first is still serving sessions — a multi-host engagement — you need background jobs. Likewise, the difference between sessions -i 1 and sessions 1 is the difference between "this works" and "syntax error."

Demo run

Running check, then exploit, then dropping into the resulting Meterpreter session.

demo · the actual exploit

Challenges

CH 5.1 — Check before firing
unsolved
EternalBlue is fully configured against 10.10.10.5. Confirm the target is actually vulnerable before you exploit.
A "check" returns vulnerable / not vulnerable without crashing the box. You always do this first on production-like targets.
msfconsole
msf6 exploit(windows/smb/ms17_010_eternalblue) >
CH 5.2 — Fire the exploit as a background job
unsolved
Run the exploit, but as a background job so the handler stays alive and you keep the prompt available.
During an engagement you almost always want this — a foreground exploit blocks you from doing anything else until you manually background it.
msfconsole
msf6 exploit(windows/smb/ms17_010_eternalblue) >
CH 5.3 — Interact with session 1
unsolved
Your exploit opened Meterpreter session 1. Interact with it — drop into the Meterpreter prompt.
Backgrounded sessions don't auto-attach. You have to interact with them by ID.
msfconsole
msf6 exploit(windows/smb/ms17_010_eternalblue) >

06Meterpreter post-exploitation

// you have a session — now what

Meterpreter is an in-memory framework that runs entirely as a thread inside a hijacked process. It never touches disk. It speaks an encrypted protocol back to your handler. And it ships with dozens of commands for reconnaissance, file transfer, lateral movement, and credential theft.

→ The first 60 seconds inside

When a session opens, the first questions are always: Where am I? (sysinfo) — Who am I? (getuid) — What's running here? (ps) — Can I become SYSTEM? (getsystem). Build that muscle memory; it's the core of every post-ex flow.

Command anatomy — Meterpreter essentials

CommandWhat it does
sysinfoComputer name, OS, build, architecture, domain. First thing you run.
getuidUsername Meterpreter is running as. NT AUTHORITY\SYSTEM = jackpot. WORKGROUP\IUSR_X = web shell, you have work to do.
getpidProcess ID Meterpreter is currently injected into.
psList running processes. Used to find a target to migrate into or processes to kill.
migrate <pid>Move Meterpreter into another process. Useful if your current host process might die.
getsystemTry several local-privilege-escalation techniques to become SYSTEM.
hashdumpDump local SAM hashes. Requires SYSTEM privs. Output: username:RID:LM:NTLM:::
screenshotGrab a screenshot from the active console session. Saved to your Kali home dir.
shellDrop to a regular cmd.exe / /bin/sh. Type exit to come back to Meterpreter.
upload <src> <dst>Push a file from Kali to the target.
download <path>Pull a file from target to Kali.
backgroundPush the current Meterpreter to the background — back to msf6 >. Session stays alive.
Why this matters

An unmigrated Meterpreter dies the second the user kills the exploited process. Forgetting getsystem means everything you do is constrained to the user you popped — including hashdump, which silently fails without SYSTEM. The order isn't arbitrary; it's the difference between a stable foothold and a session that vanishes mid-investigation.

Demo run

Inside a fresh Meterpreter — sysinfo, getuid, ps, hashdump.

demo · post-exploitation

Challenges

CH 6.1 — Identify the target
unsolved
You just landed in a Meterpreter session. First question: what OS are you on, what version, what architecture?
This always runs first. Everything else depends on it — payload selection, escalation technique, even which post-modules to use.
meterpreter session 1
meterpreter >
CH 6.2 — Check your privilege level
unsolved
Find out which user account Meterpreter is currently running as.
If you're already SYSTEM, you skip privilege escalation. If you're NT AUTHORITY\NETWORK SERVICE, you have escalation work ahead.
meterpreter session 1
meterpreter >
CH 6.3 — Try to escalate to SYSTEM
unsolved
You're running as a standard user. Use Meterpreter's built-in escalation to attempt to become SYSTEM.
There's a single command that auto-tries multiple known LPE techniques.
meterpreter session 1
meterpreter >
CH 6.4 — Dump the local hashes
unsolved
Now that you're SYSTEM, dump every local user's NTLM hash from the SAM database.
These hashes feed straight into hashcat for cracking, or into pass-the-hash for lateral movement to other Windows boxes.
meterpreter session 1 (SYSTEM)
meterpreter >

07Database & workspaces

// remember everything you've found, separately per engagement

Metasploit can hook into a PostgreSQL database that automatically tracks every host, service, vuln, and credential it touches. Across a multi-day engagement, this is the difference between scrolling through scrollback and a queryable record of everything found. Workspaces let you segment data per engagement so customer A doesn't bleed into customer B.

→ Why bother with the DB

Run db_nmap -sV 10.10.10.0/24 instead of plain nmap. Same scan — but every host found, every port, every service banner gets stored. Two days later you can services -p 445 -R to list every host with SMB open and pre-fill RHOSTS for the next exploit. The DB turns recon into automation.

Command anatomy — db & workspace

CommandWhat it does
db_statusConfirm the DB is connected. Connected to msf. Connection type: postgresql. = good.
workspaceList workspaces. The active one has a * next to it.
workspace -a <name>Add a new workspace. Switches to it automatically.
workspace <name>Switch to an existing workspace.
workspace -d <name>Delete a workspace and all its data.
db_nmap [opts] <target>Run nmap and ingest results. Same flags as real nmap (-sV -p- -A).
hostsList every host stored in current workspace.
services / services -p 80List services. -p filters by port.
services -p 445 -RThe -R flag pipes the host list straight into RHOSTS for whatever module you have loaded.
vulnsList known vulnerabilities discovered (auto-populated by some scanners).
credsList captured credentials. Auto-populated by hashdump, login bruteforcers, etc.
Why this matters

Once you've worked with the DB, going back to plain nmap + scrollback feels like coding without source control. It's not just storage — it's the -R chain that lets you do db_nmap → services -p 445 -R → exploit as one fluid motion across dozens of hosts.

Demo run

Setting up a workspace, running db_nmap, querying services and using -R.

demo · db workflow

Challenges

CH 7.1 — Confirm the database is connected
unsolved
Before you trust any data store/query commands, confirm msfconsole is hooked into PostgreSQL.
If the DB isn't running, every db_* and workspace command silently does nothing useful.
msfconsole
msf6 >
CH 7.2 — Create a new workspace
unsolved
You're starting an engagement for client "AcmeCorp". Create and switch to a workspace named acme.
Single command — adds and switches in one shot.
msfconsole
msf6 >
CH 7.3 — Scan the subnet into the DB
unsolved
Scan the 10.10.10.0/24 subnet with version detection enabled, and store every result in the active workspace.
You want service banners (-sV) so you can tell which ports run what software, not just which ports are open.
msfconsole
msf6 >

08Auxiliary scanners

// recon and enumeration without exploitation

Not everything in Metasploit is an exploit. The auxiliary category contains scanners, login bruteforcers, fingerprinters, and information-gathering modules. They use the same four-step loop as exploits — use, show options, set, run — but they don't try to compromise anything. They just collect.

→ When auxiliary beats nmap

For raw port scanning, plain nmap (or db_nmap) is faster and more flexible. Where auxiliary modules shine is service-specific work: auxiliary/scanner/smb/smb_version grabs SMB dialect + OS; auxiliary/scanner/ssh/ssh_login bruteforces creds with a wordlist; auxiliary/scanner/http/dir_scanner finds web paths. They feed straight into the DB, populate creds and vulns, and chain into exploits.

Useful auxiliary scanners

ModuleWhat it does
auxiliary/scanner/portscan/tcpTCP connect scan. Useful when nmap isn't available, or to stay inside msfconsole.
auxiliary/scanner/smb/smb_versionSMB dialect, OS name, domain — works against an entire subnet.
auxiliary/scanner/smb/smb_ms17_010Detection-only check for EternalBlue. Pair with the actual exploit module.
auxiliary/scanner/ssh/ssh_versionSSH server version banner.
auxiliary/scanner/ssh/ssh_loginBruteforce SSH with username and password lists. Stores creds it finds.
auxiliary/scanner/http/http_versionHTTP server fingerprint.
auxiliary/scanner/http/dir_scannerWordlist-driven directory bruteforce against a web server.
auxiliary/scanner/discovery/udp_sweepUDP probe — finds DNS, SNMP, NetBIOS.
Why this matters

Real engagements aren't just "find the box and pop it." They're "enumerate 254 hosts, identify which services run, find the weak ones, and pivot from there." Auxiliary modules + the database = an enumeration pipeline you can run unattended overnight, then come back to a populated services and creds table.

Demo run

Loading the SMB version scanner, pointing it at a subnet, running it.

demo · auxiliary scanner

Challenges

CH 8.1 — Load the SMB version scanner
unsolved
Load auxiliary/scanner/smb/smb_version so you can fingerprint SMB hosts.
Same use command as for exploits — auxiliary modules use the identical workflow.
msfconsole
msf6 >
CH 8.2 — Set the scan range
unsolved
Point the scanner at the 10.10.10.0/24 subnet.
Same RHOSTS option you've used before — but now it accepts a CIDR range, not just a single IP.
msfconsole
msf6 auxiliary(scanner/smb/smb_version) >
CH 8.3 — Run the scanner
unsolved
Fire the scanner. Auxiliary modules can use either run or exploit — by convention you'd use the former for non-exploit modules.
Output: per-host fingerprints, populated automatically into the workspace.
msfconsole
msf6 auxiliary(scanner/smb/smb_version) >

→ Where to take this next

Once these eight modules feel automatic, install Metasploit on a Kali VM, build a small lab — vulnhub.com has free VMs designed for exactly this — and rerun every workflow against real targets. Then look at resource scripts (.rc files) for automating multi-step engagements, and msfvenom for generating standalone payloads outside the console.

solved
🐞 Report a Bug