1.添加epel的YUM源,不然很多组件一会会找不到
cd /etc/yum.repos.d/
rpm --import http://mirrors.ustc.edu.cn/fedora/epel/RPM-GPG-KEY-EPEL-6
wget https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/epel?codeblock=0
mv epel?codeblock=0 epel.repo
wget https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/epel?codeblock=1
mv epel?codeblock=1 epel-testing.repo
2.更新操作系统,并安装后续需要的组件
yum makecache
yum update
yum install gmp gmp-devel libpcap-devel gengetopt byacc flex json-c-devel cmake git redis gcc hiredis-devel automake autoconf libtool mlocate
3.下载zmap
git clone git://github.com/zmap/zmap.git
4.安装Zmap
cd zmap
cmake -DWITH_REDIS=ON -DWITH_JSON=OFF -DENABLE_DEVELOPMENT=OFF -DENABLE_HARDENING=OFF ./
make
make install
5.测试是否安装成功
zmap -h
6.让zmap支持banner扫描
上述方法在centos 6.5
x64上一次编译安装成功.如遇到其他诡异问题欢迎留言交流
下面是如何让Zmap支持Banner扫描,需要编译安装包内的banner-grab组件
#首先进入banner-grab目录
cd zmap/examples/banner-grab
#下载必须组件libevent,否则无法编译,yum下载的是1.0的版本,无法使用.
wget https://github.com/libevent/libevent/archive/release-2.0.21-stable.tar.gz
tar -zxvf release-2.0.21-stable.tar.gz
cd release-2.0.21-stable
sh autogen.sh
./configure
make
make install
#返回banner-grab目录,并编译
cd ../
make
#运行下面命令测试是否编译成功,默认会报错,因为libevent路径不对
./banner-grab-tcp
#运行如下命令,查看关联文件信息
ldd banner-grab-tcp
linux-vdso.so.1 => (0x00007fff24dff000)
libpcap.so.1 => /usr/lib64/libpcap.so.1 (0x00007f05b6bf8000)
libevent-2.0.so.5 => not found
libevent_extra-2.0.so.5 => not found
libm.so.6 => /lib64/libm.so.6 (0x00007f05b6973000)
libc.so.6 => /lib64/libc.so.6 (0x00007f05b65df000)
/lib64/ld-linux-x86-64.so.2 (0x00007f05b6e3e000)
#发现缺少libevent-2.0.so.5和libevent_extra-2.0.so.5
#使用locate命令,找到,并用ln建立链接如下
locate libevent-2.0.so.5
locate libevent_extra-2.0.so.5
#x86主机ln 到/lib
#x64主机ln 到/lib64
ln -s /usr/local/lib/libevent-2.0.so.5 /lib64/libevent-2.0.so.5
ln -s /usr/local/lib/libevent_extra-2.0.so.5 /lib64/libevent_extra-2.0.so.5
#再次运行成功
./banner-grab-tcp
下面是Zmap扫描Banner信息的方法
#拷贝banner-grab-tcp、http-req到需要运行zmap命令的目录,比如/root/下,然后运行下面命令使用banner扫描
zmap -p 80 220.110.1.1/16 -o-|./banner-grab-tcp -d http-req -p 80 >result.log