配置msf连接postgresql数据库

  BackTrack 5 R3版本的Metasploit在每次的升级后总会出现奇奇怪怪的错误,主要是Ruby的库出错,网上找了一些解决的办法,但每次更新后又会出错,蛋碎。

  解决方法:

  BackTrack 5中默认自动开启端口7337。

1、查看PostgreSQL端口是否开启:

root@bt:~# netstat -tnpl |grep postgres

 

如果没有开启输入service postgresql start开启:

root@bt:~# service postgresql start

 2、查看msf的配置,里面有数据库用户和密码

root@bt:~# cat /opt/metasploit/config/database.yml

#
# These settings are for the database used by the Metasploit Framework
# unstable tree included in this installer, not the commercial editions.
#
development:
adapter: "postgresql"
database: "msf3dev"
username: "msf3"
password: "4bfedfc2"
port: 7337
host: "localhost"
pool: 256
timeout: 5

production:
adapter: "postgresql"
database: "msf3dev"
username: "msf3"
password: "4bfedfc2"
port: 7337
host: "localhost"
pool: 256
timeout: 5

 

3、开启msf专业版
 

# /opt/metasploit/msfpro

 

4、查看连接状态:

db_status

5、连接数据库:

db_connect用户名:口令@服务器地址:端口/数据库名称
db_connect msf3:4bfedfc2@127.0.0.1:7337/msf3

 

6、使用hosts命令检查数据库是否可以正常使用。

msf > hosts

 

 

7、使用db_disconnect命令可以断开与数据库的链接:

 

posted @ 2019-03-07 09:00  0x3mSxl  阅读(2544)  评论(0编辑  收藏  举报
Live2D