PDA

View Full Version : Postgresql and Metasploit



Noob123
2015-08-18, 03:28
Hi and thanks for the help. I am having difficulty getting Metasploit to connect to the db. I have confirmed postgresql starts:

service postgresql start
[OK] Starting PostgreSQL 9.4 database server: main.

Then I try and start the Metasploit service but get an error:

service metasploit start
metasploit: unrecognized service

Then I start msfconsole. It starts fine. I run:

db_status
postgresql selected, no connection.

Not sure what my next steps should be. I can run db_connect but I am not sure what the rest of the command should look like. Any help would be greatly appreciated. Thanks again.

ldglance
2015-08-18, 16:26
so you need to start the metasploit service via the nethunter android app under services. not with in the command line. it won't show as a service there.

so what i did is just start command line start postgresql service, go to android app start metasploit service, and then back to console and start msfconsole

Noob123
2015-08-18, 16:57
Thanks for the help. No luck though. Started Postgresql from the command line, service postgresql start, then went to the Kali Service Control screen and started the Metasploit service. Returned to the command line and tried msfconsole. Metasploit loaded then I tried db_status:

postgresql selected, no connection.

I must also mention, when I leave the Kali Service Control screen and return, the Metasploit service is down again. Thanks again!

ldglance
2015-08-18, 18:22
Thanks for the help. No luck though. Started Postgresql from the command line, service postgresql start, then went to the Kali Service Control screen and started the Metasploit service. Returned to the command line and tried msfconsole. Metasploit loaded then I tried db_status:

postgresql selected, no connection.

I must also mention, when I leave the Kali Service Control screen and return, the Metasploit service is down again. Thanks again!
humm your right even with connecting the db_status is still showing disconnected. i tried loading the dummy database.yml that cames with metasploit but it does not load it either.

wondering if because they changed how the services work and loading if it never created the database. may report it on the github as a issue.
https://github.com/offensive-security/kali-nethunter/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+

its not working for me either.

ldglance
2015-08-18, 18:50
so after a little digging around it looks like they changed some things around from the last version to this. so to get it working what you will need to do is start up constole. make sure postgresql is started, then go to /usr/share/metasploit-framework and then run the msfdb init to build the database, then start up msfconsole and run your db_status and it will come back as postgresql connected to msf

hope that helps.

i wrote up the steps here with a few screenshots.
http://localtechrepair.blogspot.com/2015/08/nethunter-2-metasploit-database.html

Noob123
2015-08-18, 20:38
Awesome! Thanks! Worked like a charm. I couldn't navigate to /usr/share/metasploit-framework though. Tried from both the local connection as well as the terminal in Kali, i.e. logged on as root@Kali as well as u0_a81@grouper. Couldn't find the directory though. So, I ran msfdb init straight from the Kali terminal. It started up and I could see it saved the msf and msf_test dbs in the /usr/share/metasploit-framework directory. How would I navigate there? Thanks again!

Noob123
2015-08-19, 01:26
Sorry, tried to post earlier but must have messed up. msfdb init did the job! Metasploit now connects to the msf db. had a little trouble though as I couldn't find /usr/share/metasploit-framework from either the local login or the Kali terminal. I ran the command as Root@Kali and it worked. Still can't seem to find the directory though. Funny too, when I try and "Turn Off External Wifi" from the menu, I get an error that "/usr/bin/stop-wlan1.sh : No file or directory" exists. Is it possible the name was changed? Anyway, thanks again! You were a big help. Have a good one.

ldglance
2015-08-19, 15:03
humm that could be because i purged and reinstalled metasploit framework. i should probably reflash and see if that changed the folder structure.

as for the turn off external wifi. ya that has never worked for the one plus one roms. you will need to manually do the "ip link set wlan1 down" command (or what ever your wlan is set to for your external card). your more than willing to recreate that script and move it to that location to get it to work though :D i just haven't taken the time to rewrite it and do a pull for it.

Noob123
2015-08-21, 01:02
sound great. Thanks again for the help. I am pretty psyched everything is running well. Have a good one!

Noob123
2015-08-23, 14:17
Um, I am a dope. Found the directory, ls -a. :)