zoukankan      html  css  js  c++  java
  • msf连接PostgreSQL数据库

    一、启动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,连接数据库。
    ########################################################################

  • 相关阅读:
    php 随机红包算法
    mysql window系统备份远程数据库到本地
    程序员 面试题【前端,java,php】
    PDMan 数据库建模工具
    数据结构之更多字符串的内容
    数据结构之参考-对象与参考
    数据结构之序列
    excel的宏与VBA入门——代码调试
    DataWorks使用小结(二)——功能面板使用指南
    DataWorks使用小结(一)——概述
  • 原文地址:https://www.cnblogs.com/qiudabai/p/8853389.html
Copyright © 2011-2022 走看看