一、启动PostgreSQL服务
######################################################################
?root@root:~# service postgresql start    ###启动PostgreSQL服务
?root@root:~# service postgresql status    ###查看状态
?root@root:~# ss -ant    ###执行成功后,可以通过ss -ant命令查看端口5432是否在侦听,去验证PostgreSQL服务是否成功开启。
######################################################################

二、msfconsole连接PostgreSQL数据库
######################################################################
连接方式1:
    root@root:~# msfdb init    ###初始化数据库
    root@root:~# msfconsole    ###打开msf
    msf > db_status    ###查看连接状态
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    [*] postgresql connected to msf    ###连接成功
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    msf > update-rc.d postgresql enable    ###设置PostgreSQL服务开机自启
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    [*] exec: update-rc.d postgresql enable    ###使用命令update-rc.d postgresql enable将PostgreSQL服务添加至开机启动项中
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

######################################################################
注意:
!!!
msf > search ms08-067
[!] Module database cache not built yet, using slow search

? 提示这个信息,其实Metasploit已经连接上数据库,但是没有建立数据库缓存。

!!!
重新构建数据库缓存

? 这时,需要重新构建数据库缓存,在msf提示符下执行以下命令:

msf > db_rebuild_cache
[*] Purging and rebuilding the module cache In the background..

?#######################################################################

参考:https://www.jianshu.com/p/9c82ccb2aaf7

########################################################################

三、msfconsole手动连接PostgreSQL数据库
########################################################################
root@root:~# su postgres    ###切换postgres账号
########################################################################
postgres@root:/root$ createuser test -P    ###创建test账号,密码为test。
########################################################################
postgres@root:/root$ createdb --owner=test test    ###owner参数指定数据库的所有者,赋予数据库的所有者为test,创建数据库为test。
########################################################################
msf > db_connect test:test@localhost/test    ###进入msf,连接数据库。
########################################################################

最新文章

  1. noi往届题目泛做
  2. VS2013各个版本秘钥
  3. mysql python image
  4. Tomcat 内存和线程配置优化
  5. Hibernate-Criteria用法
  6. 每日一九度之 题目1042:Coincidence
  7. nbtstat -a <IP> 会显示主机名、所在工作组等信息
  8. 前后端差异更小了——浅谈ES(ECMAScript)6
  9. scn转换为十进制
  10. IOS 性能优化的建议和技巧
  11. 数据库基础(子查询练习、链接查询(join on 、union)及其练习)
  12. HTML5: Screen Orientation API
  13. Java8学习(4)-Stream流
  14. (七十六)CoreLocation(二)获取经纬度、速度、方向,进行区域监听
  15. asp.net core系列 59 Ocelot 构建基础项目示例
  16. css background-image 自适应宽高——转载
  17. 支持flash in Chrome 2017
  18. python 语言特性
  19. 【做题】CF285E. Positions in Permutations——dp+容斥
  20. python中序列化json模块和pickle模块

热门文章

  1. findwindow\sendmessage向第三方软件发送消息演示
  2. Solaris10如何确认DirectIO是否已经启用
  3. scrapy(1)安装
  4. C#如何生成JSON字符串?(序列化对象)
  5. Javascript 面向对象(一):封装
  6. 【263】Linux 添加环境变量 & 全局 shell 脚本
  7. 修改 linux 时区时间和 php 时区
  8. sql 一些偶尔会用到的写法和函数 不定时更新
  9. C# 设置程序session过期时间
  10. 去除Activity上面的标题边框