欢迎来到starnight_cyber的博客

Metasploit 使用基础

  本文将简单介绍一下Kali2 上Metasploit的一些基本使用,包括启动、更新及一个小问题"Module database cache not built yet, using slow search"的解决。

启动

  终端输入msfconsole

root@kali:~# msfconsole

应该会出现界面下端提示符: msf > 

更新

  apt update; apt install metasploit-framework

msf > msfupdate          【以前使用的更新方式,现已弃用】
[*] exec: msfupdate

msfupdate is no longer supported when Metasploit is part of the operating
system. Please use 'apt update; apt install metasploit-framework'
root@kali:~# apt update; apt upgrade metasploit-framework  
...

一个小问题

  Module database cache not built yet, using slow search

以搜索ms08-067的exploit为例,很多情况下会出现如下问题:

msf > search ms08-067
[!] Module database cache not built yet, using slow search

解决办法:

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
root@kali:~# service postgresql restart          【重启postgresql服务】
root@kali:~# update-rc.d postgresql enable        【设置为开机自启动】
root@kali:~# service postgresql status
● postgresql.service - PostgreSQL RDBMS
   Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: disabled)
   Active: active (exited) since Tue 2017-08-22 03:47:39 EDT; 1min 18s ago
 Main PID: 1254 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/postgresql.service

Aug 22 03:47:39 kali systemd[1]: Starting PostgreSQL RDBMS...
Aug 22 03:47:39 kali systemd[1]: Started PostgreSQL RDBMS.
root@kali:~# msfconsole

msf > db_rebuild_cache                      【重建缓存】
[*] Purging and rebuilding the module cache in the background...

...
【大概要等个5分钟的样子,自己可以尝试一下运行下面那个命令】
...
msf > search ms08-067          【再次搜索发现变快了很多】 Matching Modules ================ Name Disclosure Date Rank Description ---- --------------- ---- ----------- exploit/windows/smb/ms08_067_netapi 2008-10-28 great MS08-067 Microsoft Server Service Relative Path Stack Corruption

缓存构建好之后,即使退出msf命令行,再次进入metasaploit进行搜索,因为已经有了缓存了,速度会快很多。

如果是在虚拟机上使用Kali的话,不用的时候直接挂起即可,下次再搜索时便不会影响速度。

posted @ 2017-08-22 16:07  starnight_cyber  阅读(2470)  评论(0编辑  收藏  举报