转载自:陆羽's Blog
安装环境:Zmap的官网上说zmap需要安装在64位的操作系统上。
步骤:
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
如果安装过程中出现问题,一般是因为未安装某个包,如下面例子
[ 2%]Generating parser.c
/bin/sh:byacc:command not found
make[2]:***Isrc/parser.c [Error 12]
make[1]:***Isrc/CMAKEFILES/zmap dir/all [Error ]
make:*** [all error]
此处是因为没有安装byacc,只要yum install下重新安装就行了;
5:测试是否安装成功:
zmap -h
6:如何让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
7: