首页 > 数据库技术 > 详细

postgreSQL数据库的初探

时间:2019-07-31 15:36:46      阅读:139      评论:0      收藏:0      [点我收藏+]

转载至:https://www.cnblogs.com/wangyuyang1016/p/10878527.html

postgreSQL数据库是Metasploit的默认数据库哦!

 

启动postgresql:

service postgresql start

既然postgresql是配合Metasploit框架的,那么也要启动Metasploit:

kali >  msfconsole
技术分享图片 启动完成

启动metasploit成功后则会进入:

msf >

命令行环境下

下一步,将建立metasploit将其信息存储在其中的数据库中:

技术分享图片

需要以root权限身份登录postgres :(su:“switch user”命令)

技术分享图片

提示:postgres@kali:/root$ 【表示程序 - 主机名 - 用户】

 下一步,创建用户和密码:

技术分享图片

使用 createuser 命令的-P选项创建用户名msf_user,并提示输入密码。

下一步,授予用户一定的权限并创建一个数据库:

技术分享图片

使用 createdb 命令的-O为msf_user用户创建了 hack_db 数据库。

初步配置结束,exit退出!

接下来,则是连接msf和数据库了!参考数据库连接的博文 

技术分享图片

检查数据库是否连接?结果显示未连接!

使用 db_connect 命令连接数据库:

技术分享图片
技术分享图片
msf5 > db_connect
[-] A URL or saved data service name is required.

   USAGE:
      * Postgres Data Service:
          db_connect <user:[pass]>@<host:[port]>/<database>
        Examples:
          db_connect user@metasploit3
          db_connect user:pass@192.168.0.2/metasploit3
          db_connect user:pass@192.168.0.2:1500/metasploit3
          db_connect -y [path/to/database.yml]
 
      * HTTP Data Service:
          db_connect [options] <http|https>://<host:[port]>
        Examples:
          db_connect http://localhost:8080
          db_connect http://my-super-msf-data.service.com
          db_connect -c ~/cert.pem -t 6a7a74c1a5003802c955ead1bbddd4ab1b05a7f2940b4732d34bfc555bc6e1c5d7611a497b29e8f0 https://localhost:8080
        NOTE: You must be connected to a Postgres data service in order to successfully connect to a HTTP data service.
 
      Persisting Connections:
        db_connect --name <name to save connection as> [options] <address>
      Examples:
        Saving:     db_connect --name LA-server http://123.123.123.45:1234
        Connecting: db_connect LA-server
 
   OPTIONS:
       -l,--list-services List the available data services that have been previously saved.
       -y,--yaml          Connect to the data service specified in the provided database.yml file.
       -n,--name          Name used to store the connection. Providing an existing name will overwrite the settings for that connection.
       -c,--cert          Certificate file matching the remote data server‘s certificate. Needed when using self-signed SSL cert.
       -t,--token         The API token used to authenticate to the remote data service.
       --skip-verify      Skip validating authenticity of server‘s certificate (NOT RECOMMENDED).
技术分享图片

 

技术分享图片

如上图显示: Connected to Postgres data service: 127.0.0.1/hack_db 【连接到hack_db数据库】


检查是否连接:

技术分享图片

------------------------------------

至此,msf和postgreSQL数据库已经连接并可以使用,使用Metasploit进行的工作,结果将存到PostgreSQL数据库中。

更多了解,待它日研究后更新!!!

 

postgreSQL数据库的初探

原文:https://www.cnblogs.com/yumianxiaodamo/p/11276494.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!