hping3的编译和安装

来源:互联网 发布:tomcat运行php项目 编辑:程序博客网 时间:2024/04/29 04:44

注:本次安装基于SUSE11SP3系统

1、获取hping3源码包:http://www.hping.org/download.html ,我下载的是hping3-20051105.tar.gz这个版本。

2、将压缩包放到系统上使用tar命令解压。

tar -xf hping3-20051105.tar.gz

3、进入解压后的目录,执行

./configure && make

执行后有以下报错:

main.c:29:18: error: pcap.h: No such file or directorymain.c:169: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ tokenmain.c:170: error: ‘PCAP_ERRBUF_SIZE’ undeclared here (not in a function)make: *** [main.o] Error 1

头文件缺失,这个头文件在libpcap里。

4、下载libpcap源码包:http://www.tcpdump.org/,我下载的是libpcap-1.8.1.tar.gz这个版本。

5、同样放到系统上使用tar命令解压,

tar -xf libpcap-1.8.1.tar.gz

6、进入解压后的目录,执行

./configure && make && make install

执行成功。

7、返回到hping3目录里执行make命令,仍然报错:

libpcap_stuff.c:20:21: error: net/bpf.h: No such file or directorylibpcap_stuff.c: In function ‘pcap_recv’:libpcap_stuff.c:61: warning: pointer targets in assignment differ in signednessmake: *** [libpcap_stuff.o] Error 1

还是有头文件缺失。

8、其实bpf.h这个头文件就在libpcap包里,具体在/pcap/bpf.h位置。将这个头文件拷贝至系统的/usr/include/net/目录,

cp ./libpcap-1.8.1/pcap/bpf.h /usr/include/net/bpf.h

9、再次回到hping3目录下执行make命令,会出现以下提示,

NO TCL scripting support compiled inuse `make strip' to strip hping3 binaryuse `make install' to install hping3

这个意思是说编译时没有使用tcl库,不过不影响功能使用,就不处理了。

linux-yuk6:/mnt/hping3-20051105 # ./hping3 --helpusage: hping host [options]  -h  --help      show this help  -v  --version   show version  -c  --count     packet count  -i  --interval  wait (uX for X microseconds, for example -i u1000)      --fast      alias for -i u10000 (10 packets for second)      --faster    alias for -i u1000 (100 packets for second)      --flood      sent packets as fast as possible. Don't show replies.  -n  --numeric   numeric output  -q  --quiet     quiet  -I  --interface interface name (otherwise default routing interface)  -V  --verbose   verbose mode  -D  --debug     debugging info  -z  --bind      bind ctrl+z to ttl           (default to dst port)  -Z  --unbind    unbind ctrl+z      --beep      beep for every matching packet received
原创粉丝点击