Sunday, October 16, 2011

Using Nmap in Metasploit

If you are a computer geek, then you must know the Nmap and how to use it. But some guys wonder that Metasploit is just an exploitation framework, but let me tell those that you can use Nmap as well as Nessus in Metasploit . Let me tell you how:


Step 1: Open The Metasploit

Step 2: Type
         
     load db_mysql

Step 3: Create Result Table & Connect to MySQL

    db_create r00t:passw0rd@localhost/kislay
    db_connect r00t:password@localhost/kislay

The above commands create a new table "kislay" and let metasploit using it.

Step 4: Load the XML file of Nmap into MySQL database.
 
    db_import_nmap_xml /opt/data/nmap/myscans/black.xml

This command loads your nmap xml file directly into your newly created database "kislay"

Step 5: Call Nmap from Metasploit Console and load results into MySQL.

    db_nmap localhost -O --reason

Step 6: List of Hosts

    db_hosts

Step 7:  List of Services

    db_services

Step 8: Automated exploitation

    db_autopwn -p -e

This will launch your exploits on the targets automatically.

Greets...

Kislay Bhardwaj
 

The Hacker News