通過Docker搭建開源版IVRE
1 引言
1.1 編寫目的
本文主要介紹開源IVRE項(xiàng)目的安裝、部署和配置。目的是提供給IVRE項(xiàng)目學(xué)習(xí)、研究人員,利于他們更快的搭建和部署IVRE。
1.2 背景
IVRE(又名DRUNK)是一款網(wǎng)絡(luò)偵查框架,包括兩個(gè)基于p0f和Bro的被動(dòng)偵查模塊和一個(gè)基于Nmap&Zmap的主動(dòng)偵查模塊,其功能類似于國(guó)內(nèi)知道創(chuàng)宇公司推出的一款網(wǎng)絡(luò)空間搜索引擎ZoomEye(鐘馗之眼)。
1.3 定義
Docker:一個(gè)開源的應(yīng)用容器引擎,讓開發(fā)者可以打包他們的應(yīng)用以及依賴包到一個(gè)可移植的容器中,然后發(fā)布到任何流行的 Linux 機(jī)器上,也可以實(shí)現(xiàn)虛擬化。容器是完全使用沙箱機(jī)制,相互之間不會(huì)有任何接口(類似 iPhone 的 app)。幾乎沒有性能開銷,可以很容易地在機(jī)器和數(shù)據(jù)中心中運(yùn)行。最重要的是,他們不依賴于任何語言、框架包括系統(tǒng)。
1.4 參考資料
安裝Docker:
http://www.cnblogs.com/MicroTeam/p/see-docker-run-in-debian-with-aliyun-ecs.html
IVRE官方網(wǎng)站:
https://ivre.rocks/
GitHub
https://github.com/cea-sec/ivre
2 系統(tǒng)配置
2.1 運(yùn)行環(huán)境
Ubuntu Server 14.4 64位
Docker
IVRE
2.2 系統(tǒng)依賴
Python 2, version 2.6 minimum
the Crypto module
the pymongo module, version 2.7.2 minimum.
Nmap & ZMap
Bro & p0f
MongoDB, version 2.6 minimum
web服務(wù)器(在Apache、Nginx下測(cè)試通過)
web瀏覽器(在FireFox和Chromum下測(cè)試通過)
Maxmind GeoIP免費(fèi)數(shù)據(jù)庫
Tesseract(可選,可對(duì)Nmap掃描結(jié)果增加快照)
Docker & Vagrant (version 1.6 minimum,可選)
2.3 前端組件
AngularJS
Twitter Bootstrap
jQuery
D3.js
flag-icon-css
Passive recon
2.4 系統(tǒng)安裝部署圖
2.5 系統(tǒng)硬件配置
測(cè)試機(jī)配置:
CPU:Intel至強(qiáng)E5400系列CPU*2
內(nèi)存:4G 1333MHz
硬盤:100GB
2.6 系統(tǒng)應(yīng)用服務(wù)器軟件安裝與配置
Linux服務(wù)器安裝步驟(略)
注意:內(nèi)核版本如果低于 3.8,就要升級(jí)內(nèi)核,參考方法如下
http://docs.docker.com/installation/debian/
查看linux內(nèi)核命令:
uname –a
3 程序部署
3.1 安裝Docker
快速安裝Docker方法有2種:
***種方法:(推薦使用)
- sudo wget -qO- https://get.docker.com/ | sh
第二種方法:
- sudo curl -sSL https://get.docker.com/ | sh
3.1.1 驗(yàn)證Docker安裝是否成功(可忽略)
運(yùn)行 hello world:
- sudo docker run hello-world
如果前面步驟都沒有問題的話,能看到 hello-world 啟動(dòng)了。
- Hello from Docker.
- This message shows that your installation appears to be working correctly.
3.1.2 把非管理員用戶添加到docker組
sudo useradd -G docker 登陸系統(tǒng)用戶名
3.2 安裝Vagrant
安裝IVRE方法有2種:
***種方法:(推薦使用)
- wget https://releases.hashicorp.com/vagrant/1.7.4/vagrant_1.7.4_x86_64.deb
- sudo dpkg -i vagrant_1.7.4_x86_64.deb
第二種方法:
- sudo apt-get install -y vagrant
3.3 安裝IVRE
- $ mkdir -m 1777 var_lib_mongodb var_log_mongodb ivre-share
- $ wget -q https://ivre.rocks/Vagrantfile
- $ sudo vagrant up --no-parallel
- $ docker attach ivreclient
- root@e809cb41cb9a:/#
此時(shí)IVRE已經(jīng)安裝成功。通過Docker裝好的IVRE是沒有數(shù)據(jù)的。
界面如下:
4 IVRE運(yùn)行和停止
查看docker有那些容器,命令:
- docker ps –a
開啟IVRE分三步,
***步要開啟database server,命令:
- sudo docker start ivredb
第二步開啟web,命令:
- sudo docker start ivreweb
第三步開啟客戶端,命令:
- sudo docker start ivreclient
然后通過attach命令進(jìn)入ivreclient
- sudo docker attach ivreclient
5 IVRE掃描并導(dǎo)入數(shù)據(jù)
通過attach命令進(jìn)入ivreclient
- sudo docker attach ivreclient
5.1運(yùn)行如下初始化命令:(前4步可忽略)
- root@881486651a32:/$ ipinfo --init
- This will remove any passive information in your database. Process ? [y/N] y
- root@881486651a32:/$ ipdata --init
- This will remove any country/AS information in your database. Process ? [y/N] y
- root@881486651a32:/$ scancli --init
- This will remove any scan result in your database. Process ? [y/N] y
- root@881486651a32:/$ runscans-agentdb --init
- This will remove any agent and/or scan in your database and files. Process ? [y/N] y
- root@881486651a32:/$ ipdata --download --import-all --dont-feed-ipdata-cols
- [...]
- The latest command will take a long time. Then we can integrate the
- Nmap results to the database:
- root@881486651a32:/$ nmap2db -r -s MySource -c MyCategory /ivre-share
- You can then exit the shell (`C-d`), this will stop the
- container.
或者忽略5.1步驟執(zhí)行如下命令:
- root@881486651a32:/$ ipdata --download
5.1 掃描任務(wù)
執(zhí)行命令:
- root@881486651a32:/$ runscans --routable --limit 1000 --output=XMLFork
上面這條命令將對(duì)互聯(lián)網(wǎng)上1000個(gè)隨機(jī)主機(jī)進(jìn)行標(biāo)準(zhǔn)掃描,開啟13個(gè)nmap進(jìn)程。
5.2 掃描結(jié)果入庫
- root@881486651a32:/$ nmap2db -c ROUTABLE-CAMPAIGN-001 -s MySource -r scans/ROUTABLE/up
5.3 界面展示
6 安裝出錯(cuò)解決
安裝IVRE成功后,通過attach命令進(jìn)入ivreclient后??赡艹霈F(xiàn)缺少ipdata、runscans和nmap2db等命令現(xiàn)象。
解決方法如下:
通過attach命令進(jìn)入ivreclient
- sudo docker attach ivreclient
安裝curl
- root@881486651a32:/$ apt-get install crul
安裝unzip
- root@881486651a32:/$ apt-get install unzip
利用curl命令將IVRE項(xiàng)目里的bin目錄下所有文件下載到Docker容器里:
- root@881486651a32:/$ tmp
- root@881486651a32:/$ curl –O http://hackliu.com/bin.zip
- root@881486651a32:/$ cd /
將bin.zip解壓到/usr/bin目錄
- root@881486651a32:/$ unzip /tmp/bin.zip –d /usr/
為下載的文件添加執(zhí)行權(quán)限:
- root@881486651a32:/$ chmod + x analyzercli
- root@881486651a32:/$ chmod + x getmoduli
- root@881486651a32:/$ chmod + x httpd-ivre
- root@881486651a32:/$ chmod + x ipdata
- root@881486651a32:/$ chmod + x ipinfo
- root@881486651a32:/$ chmod + x ipinfohost
- root@881486651a32:/$ chmod + x nmap2db
- root@881486651a32:/$ chmod + x p0f2db
- root@881486651a32:/$ chmod + x passiverecon2db
- root@881486651a32:/$ chmod + x passivereconworker
- root@881486651a32:/$ chmod + x plotdb
- root@881486651a32:/$ chmod + x runscans
- root@881486651a32:/$ chmod + x runscans-agent
- root@881486651a32:/$ chmod + x runscans-agentdb
- root@881486651a32:/$ chmod + x scancli
- root@881486651a32:/$ chmod + x scanstatus
7 其他
7.1 安裝所需軟件包
鏈接: http://pan.baidu.com/s/1kUsuOGv 密碼: wvct