Metasploit is simple to use and is designed with ease-of-use in mind to aid Penetration Testers.
I will be taking you through this demo in BackTrack 5, so go ahead and download that if you don't already have it - http://www.backtrack-linux.org/downloads/ The reason for using BackTrack 5 is because it has the correct Ruby Libraries.
Metasploit framework has three work environments, the msfconsole, the msfcli interface and the msfweb interface. However, the primary and the most preferred work area is the 'msfconsole'. It is an efficient command-line interface that has its own command set and environment system.
Before executing your exploit, it is useful to understand what some Metasploit commands do. Below are some of the commands that you will use most. Graphical explanation of their outputs would be given as and when we use them while exploiting some boxes in later part of the article.
(i) search <keyword> : Typing in the command ‘search’ along with the keyword lists out the various possible exploits that have that keyword pattern.
(ii) show exploits : Typing in the command 'show exploits' lists out the currently available exploits. There are remote exploits for various platforms and applications including Windows, Linux, IIS, Apache, and so on, which help to test the flexibility and understand the working of Metasploit.
(iii) show payloads : With the same 'show' command, we can also list the payloads available. We can use a 'show payloads' to list the payloads.
(iv) show options : Typing in the command 'show options' will show you options that you have set and possibly ones that you might have forgotten to set. Each exploit and payload comes with its own options that you can set.
(v) info <type> <name>: If you want specific information on an exploit or payload, you are able to use the 'info' command. Let’s say we want to get complete info of the payload 'winbind'. We can use 'info payload winbind'.
(vi) use <exploit_name> : This command tells Metasploit to use the exploit with the specified name.
(vii) set RHOST <hostname_or_ip> : This command will instruct Metasploit to target the specified remote host.
(viii) set RPORT <host_port> : This command sets the port that Metasploit will connect to on the remote host.
(ix) set PAYLOAD <generic/shell_bind_tcp> : This command sets the payload that is used to a generic payload that will give you a shell when a service is exploited.
(x) set LPORT <local_port> : This command sets the port number that the payload will open on the server when an exploit is exploited. It is important that this port number be a port that can be opened on the server (i.e.it is not in use by another service and not reserved for administrative use), so set it to a random 4 digitnumber greater than 1024, and you should be fine. You’ll have to change the number each time you successfully exploit a service as well.
(xi) exploit : Actually exploits the service. Another version of exploit, rexploit reloads your exploit code and then executes the exploit. This allows you to try minor changes to your exploit code without restarting the console
(xii) help : The 'help' command will give you basic information of all the commands that are not listed out here.
Now that you are ready with all the basic commands you need to launch your exploit , lets choose a couple of scenarios to get control of a remotely connected machine.
0 komentar:
Post a Comment