通過Docker搭建開源版IVRE

jopen 8年前發布 | 22K 次閱讀 Docker Linux命令 開源

* 原創作者:HackLiu

1  引言

1.1  編寫目的

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

1.2  背景

IVRE(又名DRUNK)是一款網絡偵查框架,包括兩個基于p0f和Bro的被動偵查模塊和一個基于Nmap&Zmap的主動偵查模塊,其功能類似于國內知道創宇公司推出的一款網絡空間搜索引擎ZoomEye(鐘馗之眼)。

1.3  定義

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

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
推ter Bootstrap
jQuery
D3.js
flag-icon-css
Passive recon

2.4  系統安裝部署圖

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是沒有數據的。

界面如下:

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

sudo docker 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  界面展示

6  安裝出錯解決

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

解決方法如下:

通過attach命令進入ivreclient

sudo docker attach ivreclient

安裝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,本文屬FreeBuf原創獎勵計劃文章,未經許可禁止轉載

來自: http://www.freebuf.com/tools/92179.html

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!