前言
本文不限於Deepin Linux系統,類似的在ubuntu debian xubuntu等血統類似的Linux發行版中都可以使用這里方法來安裝原生的metasploit
配置Kali Linux官方源
Kali 官方源
這個源是我在Kali 2016.2中提取的原生源,速度很快,會根據具體的網絡情況自動去選擇最近的更新源服務器進行更新的。
deb http://http.kali.org/kali kali-rolling main contrib non-free
deb-src http://http.kali.org/kali kali-rolling main contrib non-free
把kali的源添加到 Deepin 自帶的源后面
# vim /etc/apt/sources.list
## GGenerated by deepin-installer-reborn
deb [by-hash=force] http://ackages.deepin.com/deepin unstable main contrib non-free
#deb-src http://packages.deepin.com/deepin unstable main contrib non-free
#Kali Linux2016.2
deb http://http.kali.org/kali kali-rolling main contrib non-free
deb-src http://http.kali.org/kali kali-rolling main contrib non-free
如下圖

更新源
apt-get update
大概3分鍾左右可以更新完,然后就可以像Kali Linux一樣,任意安裝所需要的工具了。 舉個例子
安裝sqlmap
apt-get install sqlmap
就是這種格式apt-get install 軟件名
強迫症患者可以把Kali Linux下的工具全部搬到 Deepin上面,使用如下命令,安裝Kali的全部工具
apt-get install kali-linux-all

然而我看到了要下載這么大的文件~! 當時就放棄這個想法了,真不清楚Demon他下載了多長時間~~ 細思恐極
安裝 Metasploit
metasploit神器級別的工具,怎么錯過。
Deepin Linux安裝metasploit很簡單,一條命令即可
apt-get install metasploit-framework
配置postgresql 數據庫
先切換到root用戶,然后再切換到postgresql,然后就進入了數據庫管理了
gg@gg-PC:~$ su
密碼:
root@gg-PC:/home/gg# su postgres
postgres@gg-PC:/home/gg$
然后創建metasploit的數據庫和用戶
createuser msf -P -S -R -D #創建用戶 會提示輸入密碼
createdb -O msf msf #創建數據庫
配置metasploit數據庫的連接
在metasploit的安裝目錄下新建database.yml文件,內容如下
production:
adapter: postgresql
database: msf
username: msf
password: gg #我在上一步創建用戶的時候 設置的密碼
host: 127.0.0.1
port: 5432
pool: 75
timeout: 5
然后在msfconsole下手動連接數據庫
msf > db_connect -y /usr/share/metasploit-framework/databa查看數據庫連接狀態
```r
msf > db_status
[*] postgresql connected to msf
解決metasploi搜索緩慢, 調用數據庫緩存 實現秒搜索
Deepin Linux安裝完metasploit后,例行公事 搜索下經典的08-067漏洞攻擊模塊
msf > search 08-067
[!] Module database cache not built yet, using slow search
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 > exit
可以發現第1行就出現了警告:[!] Module database cache not built yet, using slow search
大意是沒有調用緩存模塊,只能使用慢速搜索了~~ ,這怎么能忍?Google查了下資料,解決方法是重啟postgresql和重建metasploit緩存
重啟postgresql
# etc/init.d/postgresql restart
重新進msf 並重建緩存
gg@gg-PC:/usr/share/metasploit-framework$ msfconsole
_ _
/ \ /\ __ _ __ /_/ __
| |\ / | _____ \ \ ___ _____ | | / \ _ \ \
| | \/| | | ___\ |- -| /\ / __\ | -__/ | || | || | |- -|
|_| | | | _|__ | |_ / -\ __\ \ | | | | \__/| | | |_
|/ |____/ \___\/ /\ \\___/ \/ \__| |_\ \___\
Validate lots of vulnerabilities to demonstrate exposure
with Metasploit Pro -- Learn more on http://rapid7.com/metasploit
=[ metasploit v4.14.2-dev ]
+ -- --=[ 1631 exploits - 932 auxiliary - 282 post ]
+ -- --=[ 472 payloads - 40 encoders - 9 nops ]
+ -- --=[ Free Metasploit Pro trial: http://r-7.co/trymsp ]
重建緩存
msf > db_rebuild_cache
[*] Purging and rebuilding the module cache in the background...
查看metasploit數據庫狀態
msf > db_status
[*] postgresql selected, no connection
手動連接數據庫
msf > db_connect -y /usr/share/metasploit-framework/database.yml
[*] Rebuilding the module cache in the background...
再次檢驗數據庫
msf > db_status
[*] postgresql connected to msf
然后再次搜索就會發現 搜索速度瞬間上來了
沒有再報錯 數據庫緩存沒有建立 的錯誤了
