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

  • 相关阅读:
    netty源码学习
    大话数据结构读书笔记
    java编程思想读书笔记
    spring依赖注入源码分析和mongodb自带连接本地mongodb服务逻辑分析
    spring的xml的property和constructor-arg的解析
    junit测试用例加载spring配置文件
    (大二下)软件需求分析阅读笔记01
    课后作业——需求分析
    2018年春季个人阅读计划
    软件需求与分析——大二下需会知识点
  • 原文地址:https://www.cnblogs.com/qiudabai/p/8853389.html
Copyright © 2011-2022 走看看