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
twitter 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
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等命令现象。
解决方法如下:
安装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