Kali2017 Metasploit连接postgresql数据库

 

msfdb:msf数据库管理命令

 

1、查看msf数据库连接状态

msf > db_status
[*] postgresql selected, no connection    //未连接

 

2、msfdb命令

msf > msfdb      //msfdb可以在命令行直接使用
[*] exec: msfdb


Manage a metasploit framework database

  msfdb init    # initialize the database          //初始化数据库
  msfdb reinit  # delete and reinitialize the database  //清空配置重新初始化数据库
  msfdb delete  # delete database and stop using it    //删除数据库并停止使用
  msfdb start   # start the database         //启动数据库
  msfdb stop    # stop the database         //停止数据库

 

3、初始化数据库

msf > msfdb init
[*] exec: msfdb init

Creating database user 'msf'
为新角色输入的口令: 
再输入一遍: 
Creating databases 'msf' and 'msf_test'
Creating configuration file in /usr/share/metasploit-framework/config/database.yml
Creating initial database schema

 

4、查看msf数据库配置文件

root@kali:~# cat /usr/share/metasploit-framework/config/database.yml
development:
  adapter: postgresql
  database: msf
  username: msf
  password: EUsDzzKRsyxvmwmPI+dZ2KF1rojkKeEKqNRvNbV7LdY=
  host: localhost
  port: 5432
  pool: 5
  timeout: 5

production:
  adapter: postgresql
  database: msf
  username: msf
  password: EUsDzzKRsyxvmwmPI+dZ2KF1rojkKeEKqNRvNbV7LdY=
  host: localhost
  port: 5432
  pool: 5
  timeout: 5

test:
  adapter: postgresql
  database: msf_test
  username: msf
  password: EUsDzzKRsyxvmwmPI+dZ2KF1rojkKeEKqNRvNbV7LdY=
  host: localhost
  port: 5432
  pool: 5
  timeout: 5

 

5、启动或重启msf

root@kali:~# msfconsole
                                                  

 ______________________________________________________________________________
|                                                                              |
|                          3Kom SuperHack II Logon                             |
|______________________________________________________________________________|
|                                                                              |
|                                                                              |
|                                                                              |
|                 User Name:          [   security    ]                        |
|                                                                              |
|                 Password:           [               ]                        |
|                                                                              |
|                                                                              |
|                                                                              |
|                                   [ OK ]                                     |
|______________________________________________________________________________|
|                                                                              |
|                                                       https://metasploit.com |
|______________________________________________________________________________|


       =[ metasploit v4.15.5-dev                          ]
+ -- --=[ 1673 exploits - 959 auxiliary - 294 post        ]
+ -- --=[ 489 payloads - 40 encoders - 9 nops             ]
+ -- --=[ Free Metasploit Pro trial: http://r-7.co/trymsp ]

msf > db_status
[*] postgresql connected to msf

 

转载于:https://www.cnblogs.com/captainRoB/p/7376743.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值