天天看點

通過Docker搭建開源版IVRE

1 引言

1.1 編寫目的

本文主要介紹開源ivre項目的安裝、部署和配置。目的是提供給ivre項目學習、研究人員,利于他們更快的搭建和部署ivre。

1.2 背景

ivre(又名drunk)是一款網絡偵查架構,包括兩個基于p0f和bro的被動偵查子產品和一個基于nmap&zmap的主動偵查子產品,其功能類似于國内知道創宇公司推出的一款網絡空間搜尋引擎zoomeye(鐘馗之眼)。

1.3 定義

docker:一個開源的應用容器引擎,讓開發者可以打包他們的應用以及依賴包到一個可移植的容器中,然後釋出到任何流行的 linux 機器上,也可以實作虛拟化。容器是完全使用沙箱機制,互相之間不會有任何接口(類似 iphone 的 app)。幾乎沒有性能開銷,可以很容易地在機器和資料中心中運作。最重要的是,他們不依賴于任何語言、架構包括系統。

通過Docker搭建開源版IVRE

1.4 參考資料

安裝docker:

http://www.cnblogs.com/microteam/p/see-docker-run-in-debian-with-aliyun-ecs.html

ivre官方網站:

https://ivre.rocks/

github

https://github.com/cea-sec/ivre

2 系統配置

2.1 運作環境

ubuntu server 14.4 64位

docker

ivre

2.2 系統依賴

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伺服器(在apache、nginx下測試通過)

web浏覽器(在firefox和chromum下測試通過)

maxmind geoip免費資料庫

tesseract(可選,可對nmap掃描結果增加快照)

docker & vagrant (version 1.6 minimum,可選)

2.3 前端元件

angularjs

twitter bootstrap

jquery

d3.js

flag-icon-css

passive recon

2.4 系統安裝部署圖

通過Docker搭建開源版IVRE

2.5 系統硬體配置

測試機配置:

cpu:intel至強e5400系列cpu*2

記憶體:4g 1333mhz

硬碟:100gb

2.6 系統應用伺服器軟體安裝與配置

linux伺服器安裝步驟(略)

注意:核心版本如果低于 3.8,就要更新核心,參考方法如下

http://docs.docker.com/installation/debian/

檢視linux核心指令:

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 驗證docker安裝是否成功(可忽略)

運作 hello world:

sudo docker run hello-world 

如果前面步驟都沒有問題的話,能看到 hello-world 啟動了。

hello from docker. 

this message shows that your installation appears to be working correctly. 

3.1.2 把非管理者使用者添加到docker組

sudo useradd -g docker 登陸系統使用者名

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:/# 

此時ivre已經安裝成功。通過docker裝好的ivre是沒有資料的。

界面如下:

通過Docker搭建開源版IVRE

4 ivre運作和停止

檢視docker有那些容器,指令:

docker ps –a 

開啟ivre分三步,

第一步要開啟database server,指令:

sudo docker start ivredb 

第二步開啟web,指令:

sudo docker start ivreweb 

第三步開啟用戶端,指令:

sudo docker start ivreclient 

然後通過attach指令進入ivreclient

sudo docker attach ivreclient 

5 ivre掃描并導入資料

通過attach指令進入ivreclient

5.1運作如下初始化指令:(前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步驟執行如下指令:

root@881486651a32:/$ ipdata --download 

5.1 掃描任務

執行指令:

root@881486651a32:/$ runscans --routable --limit 1000 --output=xmlfork 

上面這條指令将對網際網路上1000個随機主機進行标準掃描,開啟13個nmap程序。

5.2 掃描結果入庫

root@881486651a32:/$ nmap2db -c routable-campaign-001 -s mysource -r scans/routable/up 

5.3 界面展示

通過Docker搭建開源版IVRE

6 安裝出錯解決

安裝ivre成功後,通過attach指令進入ivreclient後。可能出現缺少ipdata、runscans和nmap2db等指令現象。

解決方法如下:

安裝curl

root@881486651a32:/$ apt-get install crul 

安裝unzip

root@881486651a32:/$ apt-get install unzip 

利用curl指令将ivre項目裡的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/ 

為下載下傳的檔案添加執行權限:

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

本文作者:hackliu

來源:51cto