「Metasploit PostgreSQLデータベースの初期化」の版間の差分
提供: セキュリティ
(ページの作成:「Metasploit では、PostgreSQL データベースを利用します。データベースの初期化のやり方を説明します。 '''読み方''' ;Metasploit...」) |
|||
| 行7: | 行7: | ||
== 概要 == | == 概要 == | ||
[[Metasploit]]で利用する msf のデータベースを作成します。 | [[Metasploit]]で利用する msf のデータベースを作成します。 | ||
| − | + | ||
| + | msfconsole を起動したときに、データベースと接続できてない場合は、以下のエラーがでます。 | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
| + | msf > db_status | ||
| + | [*] postgresql selected, no connection | ||
| + | msf > services | ||
| + | [-] Database not connected | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | この場合は、データベースが初期化されてない、もしくは、PostgreSQL が起動していないことが考えられます。 | ||
| + | PostgreSQL のプロセスがいるかどうかは、 | ||
| + | <syntaxhighlight lang="bash"> | ||
| + | ps axuw|fgrep postgres | ||
| + | </syntaxhighlight> | ||
| + | で確認できます。 | ||
| + | == データベースの初期化 == | ||
| + | <syntaxhighlight lang="bash"> | ||
| + | service postgresql start | ||
msfdb init | msfdb init | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| 行21: | 行37: | ||
Creating configuration file in /usr/share/metasploit-framework/config/database.yml | Creating configuration file in /usr/share/metasploit-framework/config/database.yml | ||
Creating initial database schema | Creating initial database schema | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | |||
| + | '''db_status''' でデータベースの接続状態を確認できます。 | ||
| + | <syntaxhighlight lang="bash"> | ||
| + | $ msfconsole | ||
| + | ... | ||
| + | Taking notes in notepad? Have Metasploit Pro track & report | ||
| + | your progress and findings -- learn more on http://rapid7.com/metasploit | ||
| + | |||
| + | =[ metasploit v4.11.5-2016010401 ] | ||
| + | + -- --=[ 1517 exploits - 875 auxiliary - 257 post ] | ||
| + | + -- --=[ 437 payloads - 37 encoders - 8 nops ] | ||
| + | + -- --=[ Free Metasploit Pro trial: http://r-7.co/trymsp ] | ||
| + | |||
| + | msf > db_status | ||
| + | [*] postgresql connected to msf | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== 関連項目 == | == 関連項目 == | ||
2016年1月11日 (月) 16:33時点における最新版
Metasploit では、PostgreSQL データベースを利用します。データベースの初期化のやり方を説明します。
読み方
- Metasploit
- めたすぷろいと
概要
Metasploitで利用する msf のデータベースを作成します。
msfconsole を起動したときに、データベースと接続できてない場合は、以下のエラーがでます。
msf > db_status [*] postgresql selected, no connection msf > services [-] Database not connected
この場合は、データベースが初期化されてない、もしくは、PostgreSQL が起動していないことが考えられます。 PostgreSQL のプロセスがいるかどうかは、
ps axuw|fgrep postgres
で確認できます。
データベースの初期化
service postgresql start msfdb init
使い方
以下は、Kali Linuxでの例です。
root@kali:~# msfdb init Creating database user 'msf' Enter password for new role: Enter it again: Creating databases 'msf' and 'msf_test' Creating configuration file in /usr/share/metasploit-framework/config/database.yml Creating initial database schema
db_status でデータベースの接続状態を確認できます。
$ msfconsole ... Taking notes in notepad? Have Metasploit Pro track & report your progress and findings -- learn more on http://rapid7.com/metasploit =[ metasploit v4.11.5-2016010401 ] + -- --=[ 1517 exploits - 875 auxiliary - 257 post ] + -- --=[ 437 payloads - 37 encoders - 8 nops ] + -- --=[ Free Metasploit Pro trial: http://r-7.co/trymsp ] msf > db_status [*] postgresql connected to msf