postgresql metasploit 不能使用默认的 msf3 进行连接
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32561760/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
metasploit can't use default msf3 to connect
提问by xina1i
I install metasploit v4 in ubuntu 14.04(LTS) in /opt/metasploit. And I install postgresql too. I am a very fresh to metasploit and postgresql. I start metasploit, but I can't connect to database, so I change this file /opt/metasploit/apps/pro/ui/config/database.yml, I just only change password to "testtest", and file content is:
我在 /opt/metasploit 的 ubuntu 14.04(LTS) 中安装了 metasploit v4。我也安装了 postgresql。我对 metasploit 和 postgresql 非常陌生。我启动了metasploit,但是连接不上数据库,所以我改了这个文件/opt/metasploit/apps/pro/ui/config/database.yml,我只是把密码改成“testtest”,文件内容是:
development:
adapter: "postgresql"
database: "msf3"
username: "msf3"
password: "testtest"
port: 7337
host: "localhost"
pool: 256
timeout: 5
production:
adapter: "postgresql"
database: "msf3"
username: "msf3"
password: "testtest"
port: 7337
host: "localhost"
pool: 256
timeout: 5
so I do this:
所以我这样做:
service postgresql restart
service metasploit restart
and those execute successfully. I run "msfconsole", then get "msf>", I run this:
和那些成功执行。我运行“msfconsole”,然后得到“msf>”,我运行这个:
msf> db_connect msf3:[email protected]/msf3
msf> db_stats
[*] postgresql selected, no connection
I don't know what happens, so I run msfconsole again, and I get this:
我不知道会发生什么,所以我再次运行 msfconsole,我得到了这个:
[-] Failed to connect to the database: FATAL: password authentication failed for user "msf3"
I can use postgres to create new user and database, and then I use db_connect to connect. But every time, I must run db_connect again. So I think metasploit use msf3 as default as user and database. I want to connect to msf3. What should I do?
我可以使用 postgres 创建新用户和数据库,然后我使用 db_connect 进行连接。但每次,我都必须再次运行 db_connect。所以我认为 metasploit 使用 msf3 作为默认用户和数据库。我想连接到 msf3。我该怎么办?
回答by Sputnik
Had the same error on Kali Rolling 2016.2 Open a terminal and type:
在 Kali Rolling 2016.2 上有同样的错误 打开一个终端并输入:
msfdb delete
msfdb init
msfconsole
In short, you need to recreate the db msf uses, by msf.
简而言之,您需要通过 msf 重新创建 db msf 使用。
回答by u7301672
sudo /opt/metasploit/postgresql/scripts/ctl.sh start postgresql
this will start postgresqlserver with metasploit 4.14.8 .
这将使用 metasploit 4.14.8启动postgresql服务器。
回答by standarduser
You should try running db_connect
without any options.
您应该尝试在db_connect
没有任何选项的情况下运行。
It might also be that you need to grab the hashed value of the password and pass that as the password argument. That is the way you have to pass the password when using the msfrpc
api module.
也可能是您需要获取密码的散列值并将其作为密码参数传递。这就是您在使用msfrpc
api 模块时必须传递密码的方式。
回答by Walid Hafid
You can pass the file directly to db_connect like this :
您可以像这样直接将文件传递给 db_connect:
db_connect -y /usr/share/metasploit-framework/config/database.yml
回答by JohnyMSF
I know this is old thread, but I have found different solution that works fine for me.
I checked postgresql.conf
stored in /Users/*YourUserName/.msf4/db
and default port was configured to 5433bu Metasploit's web service was running on 5443.
So I edited config and now it works for me!
Hopefully will help to someone.
我知道这是旧线程,但我找到了适合我的不同解决方案。我检查了postgresql.conf
存储/Users/*YourUserName/.msf4/db
和默认端口配置为 54 33bu Metasploit 的 web 服务正在 54 43上运行。所以我编辑了配置,现在它对我有用!希望会对某人有所帮助。
回答by samu22
try this its works for me:
试试这个对我有用:
> msfdb delete
> msfdb init
> msfconsole
on kali2017.2
在kali2017.2