Metasploit is a modular exploitation platform. You don’t need to understand its Ruby internals to be effective — but knowing where things live on disk and how modules are categorized will save you hours when something doesn’t load, when you need to drop in a custom exploit, or when search returns noise.

Architecture on Disk

On most pentest distros, Metasploit lives at /usr/share/metasploit-framework/.

ComponentPurpose
modules/Exploits, auxiliary, payloads, encoders, post, nops, evasion
plugins/Add-ons (nessus, nexpose, wmap) loaded with load
scripts/Resource scripts and meterpreter helpers
tools/CLI utilities (msfvenom, msf-pattern_create, msf-virustotal)
data/, lib/Engine internals and library code

Memorize this layout — when a custom module won’t load, it’s almost always a wrong path or a permissions issue under modules/.

msfconsole — Starting Up

# Full start with database (preferred for anything multi-host)
sudo systemctl start postgresql
sudo msfdb init         # first time only
sudo msfdb run          # launches msfconsole with DB connected
 
# Check DB
sudo msfdb status
sudo msfdb reinit       # wipe and rebuild if broken
 
# No database
msfconsole -q           # -q skips the banner

The msf6 > prompt confirms you’re in. Run db_status to verify database connection — if it says not connected, workspaces, hosts, and creds won’t work.

Module Types

Metasploit organizes everything under modules/ into six categories. Knowing which one you want narrows a search from hundreds of results to a handful.

TypePath prefixWhat it does
Exploitexploit/Triggers a vulnerability to deliver a payload
Auxiliaryauxiliary/Scanners, fuzzers, brute-forcers, spoofers — no payload delivery
Payloadpayload/Code that runs on the target post-exploit (shell, meterpreter)
Encoderencoder/Transforms payload bytes to avoid badchars or signature AV
Postpost/Runs inside an existing session (enum, priv esc, loot)
Nopnop/Generates nop-sled bytes for exploit-dev
Evasionevasion/Generates standalone AV-evading binaries

Auxiliary isn't just scanners

auxiliary/ also contains brute-force modules (scanner/ssh/ssh_login), DoS modules (dos/), fuzzers, and server modules (server/socks_proxy, server/capture/http_ntlm) that stand up listeners for credential harvesting. Don’t ignore the tree.

Search — Finding Modules Fast

Raw keyword search drowns in false positives. Use filters.

search eternalblue
search cve:2017 type:exploit platform:windows
search type:auxiliary name:smb
search path:scanner/ssh
search author:zerosum0x0
search type:post platform:linux
search rank:excellent type:exploit

Useful filters: type:, platform:, cve:, name:, path:, author:, rank:, app: (client vs server).

Results come with a rank — excellent and great are reliable, average and below often need tuning or specific conditions.

msf6 > search ms17-010
 
Matching Modules
================
   #  Name                                           Rank      Check  Description
   -  ----                                           ----      -----  -----------
   0  exploit/windows/smb/ms17_010_eternalblue       average   Yes    MS17-010 EternalBlue
   1  exploit/windows/smb/ms17_010_psexec            normal    Yes    MS17-010 EternalRomance/Synergy/Champion
   2  auxiliary/scanner/smb/smb_ms17_010             normal    No     MS17-010 SMB RCE Detection

Select with the index: use 2 is shorthand for use auxiliary/scanner/smb/smb_ms17_010.

Always info before firing

info shows disclosure date, CVE, available targets, required options, and any notes about reliability. Skipping this step is how people blue-screen production hosts mid-engagement.

The Database

MSF’s PostgreSQL backend tracks hosts, services, credentials, loot, and vulns across the engagement. Everything you do while db_status says connected auto-saves.

workspace                     # list (* = current)
workspace -a client_acme      # create
workspace client_acme         # switch
workspace -d old_project      # delete
 
db_nmap -sV -sC 10.10.11.0/24 # nmap, auto-import to current workspace
db_import nmap.xml
db_import nessus.nessus
 
hosts
hosts -R                      # set discovered IPs as RHOSTS for next module
services -p 445
creds
loot
vulns
db_export -f xml engagement.xml

hosts -R and services -R are gold — they populate RHOSTS for the next module from the database instead of typing IP ranges by hand.