Java自学者论坛

 找回密码
 立即注册

手机号码,快捷登录

恭喜Java自学者论坛(https://www.javazxz.com)已经为数万Java学习者服务超过8年了!积累会员资料超过10000G+
成为本站VIP会员,下载本站10000G+会员资源,会员资料板块,购买链接:点击进入购买VIP会员

JAVA高级面试进阶训练营视频教程

Java架构师系统进阶VIP课程

分布式高可用全栈开发微服务教程Go语言视频零基础入门到精通Java架构师3期(课件+源码)
Java开发全终端实战租房项目视频教程SpringBoot2.X入门到高级使用教程大数据培训第六期全套视频教程深度学习(CNN RNN GAN)算法原理Java亿级流量电商系统视频教程
互联网架构师视频教程年薪50万Spark2.0从入门到精通年薪50万!人工智能学习路线教程年薪50万大数据入门到精通学习路线年薪50万机器学习入门到精通教程
仿小米商城类app和小程序视频教程深度学习数据分析基础到实战最新黑马javaEE2.1就业课程从 0到JVM实战高手教程MySQL入门到精通教程
查看: 859|回复: 0

Kali linux2.0里Metasploit的postgresql selected, no connection问题解决

[复制链接]
  • TA的每日心情
    奋斗
    2024-11-24 15:47
  • 签到天数: 804 天

    [LV.10]以坛为家III

    2053

    主题

    2111

    帖子

    72万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    积分
    726782
    发表于 2021-4-20 00:47:45 | 显示全部楼层 |阅读模式

     

     

    说在前面的话

    1、在kali中metasploit默认使用postgresql作为它的数据库;
      想要开启metasploit服务首先得打开postgresql数据库,
      命令如下:(或者:/etc/init.d/postgresql start);
      因为在kali中所有的服务都不是默认开机自启的,
      所以想要开机自启,命令如下:update-rc.d postgresql enable。

    2、初次使用数据库服务时需初始化,以便创建系统默认的数据库及数据库用户;
      命令如下:msfdb init(默认创建的数据库名:msf,msf_test;用户名:msf;口令默认为空)

     

    3、接下来就是启动metasploit的时候了;
      在kali2.0之后,只需启动msf控制台即可;
      命令如下:msfconsole。
      (kali2.0之前的命令是这样的:service metasploit start;对于2.0之后不管用)

     

     

     

     

      问题详情

    msf > db_status
    [*] postgresql selected, no connection
    msf > 

     

    运行  service Metasploit start 无任何反应,提醒报错:
    Failed to start metasploit.service: Unit metasploit.service failed to load: No such file or directory.

     

     

     

    解决办法

      对于命令解释
      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

     

     

    root@kali:~# msfdb reinit
    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
    root@kali:~# msfdb start
    root@kali:~# msfconsole
                                                      
    
         .~+P``````-o+:.                                      -o+:.
    .+oooyysyyssyyssyddh++os-`````                        ```````````````          `
    +++++++++++++++++++++++sydhyoyso/:.````...`...-///::+ohhyosyyosyy/+om++:ooo///o
    ++++///////~~~~///////++++++++++++++++ooyysoyysosso+++++++++++++++++++///oossosy
    --.`                 .-.-...-////+++++++++++++++////////~~//////++++++++++++///
                                    `...............`              `...-/////...`
    
    
                                      .::::::::::-.                     .::::::-
                                    .hmMMMMMMMMMMNddds\...//M\\.../hddddmMMMMMMNo
                                     :Nm-/NMMMMMMMMMMMMM$$NMMMMm&&MMMMMMMMMMMMMMy
                                     .sm/`-yMMMMMMMMMMMM$$MMMMMN&&MMMMMMMMMMMMMh`
                                      -Nd`  :MMMMMMMMMMM$$MMMMMN&&MMMMMMMMMMMMh`
                                       -Nh` .yMMMMMMMMMM$$MMMMMN&&MMMMMMMMMMMm/
        `oo/``-hd:  ``                 .sNd  :MMMMMMMMMM$$MMMMMN&&MMMMMMMMMMm/
          .yNmMMh//+syysso-``````       -mh` :MMMMMMMMMM$$MMMMMN&&MMMMMMMMMMd
        .shMMMMN//dmNMMMMMMMMMMMMs`     `:```-o++++oooo+:/ooooo+:+o+++oooo++/
        `///omh//dMMMMMMMMMMMMMMMN/:::::/+ooso--/ydh//+s+/ossssso:--syN///os:
              /MMMMMMMMMMMMMMMMMMd.     `/++-.-yy/...osydh/-+oo:-`o//...oyodh+
              -hMMmssddd+:dMMmNMMh.     `.-=mmk.//^^^\\.^^`:++:^^o://^^^\\`::
              .sMMmo.    -dMd--:mN/`           ||--X--||          ||--X--||
    ........../yddy/:...+hmo-...hdd:............\\=v=//............\\=v=//.........
    ================================================================================
    =====================+--------------------------------+=========================
    =====================| Session one died of dysentery. |=========================
    =====================+--------------------------------+=========================
    ================================================================================
    
                         Press ENTER to size up the situation
    
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%% Date: April 25, 1848 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %%%%%%%%%%%%%%%%%%%%%%%%%% Weather: It's always cool in the lab %%%%%%%%%%%%%%%%
    %%%%%%%%%%%%%%%%%%%%%%%%%%% Health: Overweight %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %%%%%%%%%%%%%%%%%%%%%%%%% Caffeine: 12975 mg %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %%%%%%%%%%%%%%%%%%%%%%%%%%% Hacked: All the things %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    
                            Press SPACE BAR to continue
    
    
    
    Validate lots of vulnerabilities to demonstrate exposure
    with Metasploit Pro -- Learn more on http://rapid7.com/metasploit
    
           =[ metasploit v4.12.41-dev                         ]
    + -- --=[ 1597 exploits - 912 auxiliary - 274 post        ]
    + -- --=[ 458 payloads - 39 encoders - 8 nops             ]
    + -- --=[ Free Metasploit Pro trial: http://r-7.co/trymsp ]
    
    msf > db_status
    [*] postgresql connected to msf
    msf > 
        
    

     

     

        则,可以成功!
    哎...今天够累的,签到来了1...
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|手机版|小黑屋|Java自学者论坛 ( 声明:本站文章及资料整理自互联网,用于Java自学者交流学习使用,对资料版权不负任何法律责任,若有侵权请及时联系客服屏蔽删除 )

    GMT+8, 2024-12-22 15:55 , Processed in 0.057891 second(s), 29 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2021, Tencent Cloud.

    快速回复 返回顶部 返回列表