msf 下 database not connect解决方法

This is a short post explaining how to deal with metasploit instance not connected to its database (I’m using the new Kali Linux but it is the same for Backtrack 5). The issue usually surfaces when you try to search auxiliary or exploit.
Assuming that you use msfconsole you get something like this:

msf > search oracle
[!] Database not connected or cache not built, using slow search

The error says that there are 2 probable causes of the problem
- either your metasploit framework is not connected to its database (postgresql instance called msf3 by default)
- or the metasploit cache was not built.
To check if the database is connected you can use db_status command. If your database is connected you will get:

msf > db_status
[*] postgresql connected to msf3

If the database is connected you can skip the next step and go directly to “Step 2: Build the cache”.

Stpe 1: Start up PostgreSQL and Metasploit services

If the database is not connected exit your metasploit console and start both postgresql and metasploit services using the following commands:

#service postgresql start
#service metasploit start

Note: if you are using user different then root make sure that he has the privilege level to start those services

Start PostgreSQL and Metasploit Services

After you’ve dealt with both services start the msfconsole again and check if the database is connected usingdb_status again.

Note: If you want to start the postgresql and metasploit services on each reboot you need to use update-rc.d

#update-rc.d postgresql enable
#update-rc.d metasploit enable

Stpe 2: Build the cache

To build/rebuild metasploit cache use db_rebuild_cache command:

msf > db_rebuild_cache

It takes some time for the cache to be rebuild so be patient.

If all went OK you can now enjoy fast auxiliary/exploit search

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值