Now you should be ready to fire up Metasploit. Metasploit should already be installed on the machine that you’re using(Windows or Linux), so to start the console, simply run “msfconsole”.

Before getting to exploits straight away, it is useful to understand what some Metasploit commands do. Below are some of the command that are used in almost every exploit procedure. It is vital that you get familiar with these : (Below I’ve listed example commands followed by their instructions in the next lines)

► use exploitname

Tells Metasploit to use the exploit with a specified name.

► set RHOST hostname_or_ip

Will instruct Metasploit to target the specified remote host.

► set RPORT host_port

Sets the port that Metasploit will connect to on the remote host.

► set PAYLOAD generic/shell_bind_tcp

As an example, this command sets the payload to a generic one that will give you access to a shell when a service is exploited.

► set LPORT local_port

Sets the port number that the payload will open on the server when an vulnerability is successfully 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 digit number greater than 1024, and you should be fine. You’ll have to change the number each time you successfully exploit a service as well.(All ports below number 1024 are reserved).

► exploit

Typing “exploit” - starts to 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.

► show options

This command 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. “Show exploits” and “show payloads” can also be used to show all exploits and payloads that are built in to Metasploit.

► help

“help” Will give you basic information on commands not listed here. All that’s left is to issue a series of simple commands. The commands below use the example exploit to attack a the IP address on port 3000 with the “shell_bind_tcp” payload. When it is successful(If it is successful) it will open port 9485 on the target machine and Metasploit will show you the command shell (Meaning you are in the system, which you just compromised). Below are all the commands that are used to carry out this example exploit. (Note, this is just an example, there’s not an actual exploit called example)

use example


set RPORT 3000

set PAYLOAD generic/shell_bind_tcp

set LPORT 9485


Want to be a real hacker? Sign Up!

Recommended | All | New

go to top