2025-03-14 21:59:59 -06:00
|
|
|
# msfconsole
|
|
|
|
|
|
|
|
|
|
> Console for the Metasploit Framework.
|
2026-06-12 17:51:25 -06:00
|
|
|
> Note: Run `sudo msfdb init` to enable the Metasploit database backend prior to launching `msfconsole`.
|
2026-02-18 06:55:01 -07:00
|
|
|
> More information: <https://docs.rapid7.com/metasploit/msf-overview/>.
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
- Launch the interactive console (append `--quiet` to suppress the startup banner):
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
`sudo msfconsole`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
- Execute console commands (Note: Use `;` for passing multiple commands):
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
`sudo msfconsole {{[-x|--execute-command]}} "{{use auxiliary/scanner/portscan/tcp; set PORTS 80,443; set RHOSTS example.com; run; quit}}"`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
- Run a specific resource file:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
`sudo msfconsole {{[-r|--resource]}} {{path/to/file.rc}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
- [Interactive] Show specific type of modules:
|
|
|
|
|
|
|
|
|
|
`show {{auxiliary|encoders|evasion|exploits|nops|payloads|post}}`
|
|
|
|
|
|
|
|
|
|
- [Interactive] Use a module:
|
|
|
|
|
|
|
|
|
|
`use {{auxiliary/scanner/portscan/syn}}`
|
|
|
|
|
|
|
|
|
|
- [Interactive] Show module options (module needs to be loaded first):
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
`show options`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
- [Interactive] Set value of variable:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
`set {{variable_name}} {{value}}`
|
2025-04-03 20:36:56 -06:00
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
- [Interactive] Run a module (module needs to be loaded and options need to be set first):
|
2025-04-03 20:36:56 -06:00
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
`{{run|exploit}}`
|