1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

metasploit起動時のDB接続エラーの解消

Posted at

metasploitを起動したら以下の警告が表示された。

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

ぐぐったら以下のコマンドやってみれば?となっていたので実行

sudo /usr/bin/msfdb stop
sudo /usr/bin/msfdb run

そうしたら以下のエラーが出るようになった

Failed to connect to the database: could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?

5432に接続できないけど? って言われているので開放されているポートを調べてみた

┌─[marseille@parrot]─[~]
└──╼ $sudo netstat -napA inet
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      844/sshd
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      626/cupsd
tcp        0      0 127.0.0.1:5434          0.0.0.0:*               LISTEN      746/postgres
tcp        0      0 192.168.164.149:22      192.168.164.1:52988     ESTABLISHED 1198/sshd: marseill
udp        0      0 0.0.0.0:68              0.0.0.0:*                           757/dhclient
udp        0      0 0.0.0.0:68              0.0.0.0:*                           764/dhclient
udp        0      0 0.0.0.0:47673           0.0.0.0:*                           637/avahi-daemon: r
udp        0      0 0.0.0.0:631             0.0.0.0:*                           687/cups-browsed
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           637/avahi-daemon: r

何故かpostgresqlが5434で動いているので、msfconsoleが起動する際に読み込まれる設定ファイルを編集した。
編集するのはport:5432をport:5434に。

┌─[marseille@parrot]─[~]
└──╼ $cd /usr/share/metasploit-framework/config
┌─[marseille@parrot]─[/usr/share/metasploit-framework/config]
└──╼ $sudo vim database.yml

そうしてmetasploitを起動する。

┌─[marseille@parrot]─[~]
└──╼ $msfconsole

 _                                                    _
/ \    /\         __                         _   __  /_/ __
| |\  / | _____   \ \           ___   _____ | | /  \ _   \ \
| | \/| | | ___\ |- -|   /\    / __\ | -__/ | || | || | |- -|
|_|   | | | _|__  | |_  / -\ __\ \   | |    | | \__/| |  | |_
      |/  |____/  \___\/ /\ \\___/   \/     \__|    |_\  \___\


       =[ metasploit v5.0.0-dev                           ]
+ -- --=[ 1849 exploits - 1046 auxiliary - 321 post       ]
+ -- --=[ 541 payloads - 44 encoders - 10 nops            ]
+ -- --=[ 2 evasion                                       ]
+ -- --=[ ** This is Metasploit 5 development branch **   ]

msf5 > db_status
[*] Connected to msf. Connection type: postgresql.

無事接続されている。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?