Thursday, March 21, 2013

db_connect to Connect to a Database in Metasploit Framework

I recently tried loading Nessus .nbe file into the msfconsole using db_connect. It failed to connect :

msf > db_import /root/e7f0de273bdcf3a7e757244c064eb9ce.nbe
[-] Database not connected

msf > db_status
[*] postgresql selected, no connection

So I tried to connect it to the mysql server running on port 3306 on my localhost, but :

msf > load db_mysql
[-] Failed to load plugin from /opt/metasploit/apps/pro/msf3/plugins/db_mysql: cannot load such file -- /opt/metasploit/apps/pro/msf3/plugins/db_mysql

msf > db_driver
[-] The db_driver command is DEPRECATED

Because Metasploit no longer supports databases other than the default
PostgreSQL, there is no longer a need to set the driver. Thus db_driver
is not useful and its functionality has been removed.
So I guess I can't connect to my Mysql database in metasploit anymore. I would have to use postgres.

root@Xtr3M3-Mach:~# service postgresql start
[ ok ] Starting PostgreSQL 9.1 database server: main.
Now set postgres, if you get a problem refer to this link.

 OR you can do this :

msf > go_pro
[*] Starting the Metasploit services. This can take a little time.
insserv: warning: current start runlevel(s) (empty) of script `metasploit' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `metasploit' overrides LSB defaults (0 1 6).
[*] Starting PostgreSQL 9.1 database server: main.
[*] Configuring Metasploit...
[*] Creating metasploit database user 'msf3'...
[*] Creating metasploit database 'msf3'...
[*] Starting Metasploit rpc server: prosvc.
[*] Starting Metasploit web server: thin.
..............................
 This would automatically start all services relating to Metasploit


3 comments:

  1. hey bro dont work with go_p[!] For some reason, Community / Pro didn't start in a timely fashion.
    [!] You might want to restart the Metasploit services by typing
    [!] 'service metasploit restart' . Sorry it didn't work out.ro
    just say:

    ReplyDelete
  2. when are you getting on twitter???

    ReplyDelete
  3. Thank you for reminding, I will soon be there :)

    ReplyDelete