Metasploit already somes with postgresql running, check your processes and you will see it's up and running, also follow the official wiki guide for mysql.
http://www.backtrack-linux.org/wiki/...ramework_MySQL
db_driver shows no active or available drivers. None of the steps I have used to install Postgres or MySQL have worked.
When I run:
It runs successfully, but I still don't have mysql as an available driver andCode:gem install mysqlfails: "Invalid driver specified".Code:db_driver mysql
When I run:
It fails with a ruby error "/usr/bin/ruby1.9.2 extconf.rb \ extconf.rb:4:in `<main>': uninitialized constant Object::PLATFORM (NameError)"Code:gem install postgres
Why doesn't Metasploit come with MySQL and Postgres already configured? What confuses me is that some people are reporting that Postgres works fine in metasploit out of the box. Why would the configurations be different from one VM to another? Some posters are saying that certain metasploit builds work better than others. Others say that it's the ruby version that's at fault (but if you change it, other things break).
This seems to be in either 'BUG' territory, or there needs to be a much MUCH better guide on setting up databases in metasploit.
My situation is identical to the OP:
metasploit db_driver issues (or have i totally lost it?) - I have not tried his workaround script yet.
Environment:
Fresh BT5 32bit Gnome VM
Metasploit 3.7.0 and 3.8.0 r13224 (tried before upgrading and after)
Steps tried:
BT5 + Metasploit + PostgreSQL
Metasploit db_autopwn using PostgreSQL
-- These both fail to make Postgres an available driver. i.e. db_driver postgres fails with "Invalid driver specified".
I have deleted the VM and started fresh twice.
Metasploit already somes with postgresql running, check your processes and you will see it's up and running, also follow the official wiki guide for mysql.
http://www.backtrack-linux.org/wiki/...ramework_MySQL
Back|track giving machine guns to monkeys since 2007 !
Do not read the Wiki, most your questions will not be answered there !
Do not take a look at the: Forum Rules !
I get that it is supposed to be enabled by default, but why does db_hosts and db_driver show no hosts and no drivers? Port 7175 (the default Postgres port for metasploit) is showing as listening, but why does metasploit not see it?
I have uninstalled metasploit, rebooted, and reinstalled from Rapid7 binary installer a couple times, but the behavior remains. I even tried different ports, to no avail.
I am dead in the water until I figure this out.
Is it noteworthy that the Web Security Dojo 1.2 VM has exactly the same problem? Could the VM manager cause this kind of problem? (If so, why the ruby error on 'gem install postgres').
Any ideas would be helpful.
I'm one of those who's mentioned metasploit & postgres working fine out of the box. I'm also using the BT5 32-bit gnome VM environment. When you start metasploit & run db_status, what's the output? I get "postgresql connected to msf3".
You might also have a look at /opt/framework3/config/database.yml for postgresql configuration stuff. Also, have you tried running /opt/framework3/postgresql/bin/psql –U msf3 –d msf3 to connect to the msf3 database used by metasploit?
If I could figure out how to scuba dive & hack at the same time, there would be nothing I couldn't do...
db_status:[*] No driver selected
root@bt:~# /opt/framework3/postgresql/bin/psql –U msf3 –d msf3
psql.bin: warning: extra command-line argument "–d" ignored
psql.bin: warning: extra command-line argument "msf3" ignored
Password for user msf3:
but I do not know the password. Same for the postgres user when running:
root@bt:~# /opt/framework3/postgresql/bin/psql –d msf3
What should these passwords be
msf > db_status[*] No driver selected
msf >
root@bt:/opt/framework3/config# cat database.yml
production:
adapter: postgresql
database: msf3
username: msf3
password: *PASSWORD*
host: 127.0.0.1
port: 7175
pool: 75
timeout: 5
root@bt:/opt/framework3/config# /opt/framework3/postgresql/bin/psql –U msf3 –d msf3
psql.bin: warning: extra command-line argument "–d" ignored
psql.bin: warning: extra command-line argument "msf3" ignored
Password for user msf3:
psql.bin: FATAL: database "–U" does not exist
Another follow-up...have you tried starting msfconsole using sudo (i.e. "sudo msfconsole" from /pentest/exploits/framework3)? This has resolved problems for me in the past. Failing that, perhaps running msfupdate, and grabbing the latest version of the framework would help.
If I could figure out how to scuba dive & hack at the same time, there would be nothing I couldn't do...
Sorry, using sudo does not change behaviour.
Or you can try this... i got the solution on the internet..
when you start msfconsole by /pentest/exploits/framework3/msfconsole, it does not set the environment variables properly
So all you have to do is, start msfconsole using BT5 menu or by using /usr/local/bin/msfconsole
Reference by : THIS IS MY eye-Blog: No Active Driver when you type in db_driver or db_connect?
Thanks scott. After trying various approaches (including an update and new install of the framework), the sudo command solved it (postgresql database). I`m running the 64-bit BT5 in Vmware workstation 7.13. Hope this helps others.![]()