Metasploit, NMAP

Port Scanning with Nmap and Metasploit

Port Scanning

Nmap is a free and open source tool for network discovery and security auditing. Nmap is able to determine what hosts are available on the network, what operating systems and services are running on target hosts, identify the type of the firewalls that are in use, and dozens of other capabilities.

It is very helpful to scan your target with nmap and import the results into Metasploit. All you have to do is scan your target using the -oX option to generate an XML file that will contain the results. To do this, execute the following nmap command, assuming that your target machine has the IP address,

nmap -Pn -sS -A -oX scan.xml

Launch the msfconsole, if you haven’t done it already, and import the results with the command,

import scan.xml

To verify that the import was succesfull, use the hosts command to list all targeted hosts.

Run Nmap from msfconsole

You can also run nmap from within msfconsole and have the results automatically stored into database. To achieve this, run

db_nmap -Pn -sS -A

assuming that your target machine’s IP address is
To verify that the results from the scan has been stored in database, run hosts or services.

This post is part of my article about metasploit which was originally published in PenTest Magazine, August issue.