本文將簡單介紹一下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的話,不用的時候直接掛起即可,下次再搜索時便不會影響速度。
