Metasploit-framework: msfconsole is a house of lies

Created on 11 Nov 2018  路  1Comment  路  Source: rapid7/metasploit-framework

If msfconsole is started while PostgreSQL is not running, it becomes impossible to connect to PostgreSQL, even once PostgreSQL has been started.

[-] ***rting The Metasploit Framework console.../
[-] * WARNING: No database support: No database YAML file
[-] ***

  LOGON: Help Logon

  HELP NOT AVAILABLE


  LOGON: Help Games

  'GAMES' REFERS TO MODELS, SIMULATIONS AND GAMES
  WHICH HAVE TACTICAL AND STRATEGIC APPLICATIONS.

  List of Games
  FALKEN'S MAZE
  BLACK JACK           .=======================.
  GIN RUMMY           |                         |
  HEARTS              |  SHALL WE PLAY A GAME ? |
  BRIDGE              |                         |
  CHECKERS             '======================='
  CHESS
  POKER
  FIGHTER COMBAT
  GUERRILLA ENGAGEMENT
  DESERT WARFARE
  AIR-TO-GROUND ACTIONS
  THEATERWIDE TACTICAL WARFARE
  THEATERWIDE BIOTOXIC AND CHEMICAL WARFARE

  GLOBAL THERMONUCLEAR WAR

  LOGON: JOSHUA


       =[ metasploit v5.0.0-dev-7ee70f5                   ]
+ -- --=[ 1840 exploits - 1038 auxiliary - 319 post       ]
+ -- --=[ 541 payloads - 44 encoders - 10 nops            ]
+ -- --=[ 2 evasion                                       ]
+ -- --=[ ** This is Metasploit 5 development branch **   ]

msf5 > service postgresql status
[*] exec: service postgresql status

Running clusters: 
msf5 > db_status
[*] postgresql selected, no connection
msf5 > db_connect msf:[email protected]:5432/msf
[-] Error while running command db_connect: Failed to connect to the Postgres data service: could not connect to server: Connection refused
    Is the server running on host "127.0.0.1" and accepting
    TCP/IP connections on port 5432?


Call stack:
/pentest/exploit/metasploit-framework/lib/msf/ui/console/command_dispatcher/db.rb:2053:in `db_connect_postgresql'
/pentest/exploit/metasploit-framework/lib/msf/ui/console/command_dispatcher/db.rb:1821:in `cmd_db_connect'
/pentest/exploit/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:502:in `run_command'
/pentest/exploit/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:453:in `block in run_single'
/pentest/exploit/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:447:in `each'
/pentest/exploit/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:447:in `run_single'
/pentest/exploit/metasploit-framework/lib/rex/ui/text/shell.rb:151:in `run'
/pentest/exploit/metasploit-framework/lib/metasploit/framework/command/console.rb:48:in `start'
/pentest/exploit/metasploit-framework/lib/metasploit/framework/command/base.rb:82:in `start'
./msfconsole:49:in `<main>'
msf5 > service postgresql start
[*] exec: service postgresql start

Starting PostgreSQL 9.1 database server: main.
msf5 > db_connect msf:[email protected]:5432/msf
[-] Connection already established. Only one connection is allowed at a time.
[-] Run db_disconnect first if you wish to connect to a different data service.

Current connection information:
[*] Connected to msf. Connection type: postgresql.
msf5 > db_status
[*] Connected to msf. Connection type: postgresql.
msf5 > hosts
[-] Database not connected
msf5 > db_disconnect
[-] Not currently connected to a data service.
msf5 > LIES
^CInterrupt: use the 'exit' command to quit
msf5 > db_connect msf:[email protected]:5432/msf
[-] Connection already established. Only one connection is allowed at a time.
[-] Run db_disconnect first if you wish to connect to a different data service.

Current connection information:
[*] Connected to msf. Connection type: postgresql.
msf5 > db_status
[*] Connected to msf. Connection type: postgresql.
msf5 > hosts
[-] Database not connected
msf5 > 
bug database

Most helpful comment

The fix is the same for all versions of MSF.

/etc/init.d/postgresql

service --status-all
service postgresql start
service postgresql status

/usr/bin/msfconsole

msfdb init
msfconsole
msf > db_status

>All comments

The fix is the same for all versions of MSF.

/etc/init.d/postgresql

service --status-all
service postgresql start
service postgresql status

/usr/bin/msfconsole

msfdb init
msfconsole
msf > db_status

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kali64amd picture kali64amd  路  39Comments

anthraxx picture anthraxx  路  31Comments

busterb picture busterb  路  30Comments

hacksoldier98 picture hacksoldier98  路  30Comments

TheBrokenWasp picture TheBrokenWasp  路  28Comments