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

GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐