Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Postgresql metasploit can';t使用默认的msf3进行连接_Postgresql_Ubuntu 14.04_Metasploit - Fatal编程技术网

Postgresql metasploit can';t使用默认的msf3进行连接

Postgresql metasploit can';t使用默认的msf3进行连接,postgresql,ubuntu-14.04,metasploit,Postgresql,Ubuntu 14.04,Metasploit,我在ubuntu14.04(LTS)中的/opt/metasploit中安装了metasploitv4。我也安装了postgresql。我对metasploit和postgresql非常熟悉。我启动了metasploit,但无法连接到数据库,因此我更改了此文件/opt/metasploit/apps/pro/ui/config/database.yml,我只将密码更改为“testtest”,文件内容为: development: adapter: "postgresql" d

我在ubuntu14.04(LTS)中的/opt/metasploit中安装了metasploitv4。我也安装了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
所以我这样做:

service postgresql restart
service metasploit restart
这些都能成功执行。我运行“msfconsole”,然后获取“msf>”,我运行以下命令:

msf> db_connect msf3:testtest@127.0.0.1/msf3
msf> db_stats
[*] postgresql selected, no connection
我不知道会发生什么,所以我再次运行msfconsole,得到以下结果:

[-] Failed to connect to the database: FATAL:  password authentication failed for user "msf3"

我可以使用postgres创建新的用户和数据库,然后使用db_connect进行连接。但每次,我都必须再次运行db_connect。所以我认为metasploit使用msf3作为默认用户和数据库。我想连接到msf3。我该怎么办?

您应该尝试在没有任何选项的情况下运行
db\u connect


还可能需要获取密码的散列值,并将其作为密码参数传递。这是使用
msfrpc
api模块时必须传递密码的方式。

在Kali Rolling 2016.2上也有相同的错误 打开终端并键入:

msfdb delete
msfdb init
msfconsole
简而言之,您需要按msf重新创建db msf使用

sudo /opt/metasploit/postgresql/scripts/ctl.sh start postgresql

这将使用metasploit 4.14.8启动postgresql服务器

试试这个,它对我有用:

 >  msfdb delete

    >  msfdb init

    >  msfconsole

在kali2017.2上,您可以将文件直接传递到db_connect,如下所示:

db_connect -y /usr/share/metasploit-framework/config/database.yml

我知道这是一个老问题,但我找到了不同的解决方案,对我来说很好。 我检查了存储在
/Users/*YourUserName/.msf4/db
中的
postgresql.conf
,默认端口配置为5433bu Metasploit的web服务在5443上运行。 所以我编辑了配置,现在它适合我了!
希望能对某人有所帮助

在更改database.yml的内容之前,您是否尝试过启动这两项服务?请尝试db_connect-y/opt/metasploit/apps/pro/ui/config/database.yml谢谢!只是因为在升级我的操作系统后,postgresql也安装了默认配置,somsf无法连接到新配置。只需停止stand service并使用您的命令开始:)这是一个完全相同的副本,如果您将kali linux作为windows 10下的子系统,它也可以工作。。。不错!