您的位置:首页 > 理论基础 > 计算机网络

三个源码包libnet、libnids、libpcap学习TCP/IP

2011-02-22 11:33 405 查看
如果要搭建基于Linux的网络入侵检测系统,必须要安装libnet、libnids、libpcap这三个源码包。并且他们的编译顺序还有讲究,分别是libnet——>libpcap——>libnids,也就是说必须保证最后编译安装libnids;需要说明的是,系统必须事先安装gcc编译器才能编译源码。

[root@Server andylau]# tar -xvzf libnet.tar

[root@Server andylau]# tar -xvzf libpcap.tar.gz

[root@Server andylau]# tar -xvzf libnids-1.20.tar.gz

[root@Server andylau]# rm -rf *.gz

[root@Server andylau]# dir

libnet libnids-1.20 libpcap-0.9.8

[root@Server andylau]# dir

libnet libnids-1.20 libpcap-0.9.8

[root@Server andylau]# cd libnet

[root@Server libnet]# dir

acconfig.h configure libnet-config.in missing version.h.in

acinclude.m4 configure.in libnet.doxygen.conf mkinstalldirs win32

aclocal.m4 CVS Makefile.am README

autom4te.cache doc Makefile.am.common sample

config.guess include Makefile.in src

config.sub install-sh man VERSION

[root@Server libnet]# ./configure

beginning autoconfiguration process for libnet-1.1.2.1...

checking build system type... i686-pc-linux-gnu

checking host system type... i686-pc-linux-gnu

checking target system type... i686-pc-linux-gnu

checking for a BSD-compatible install... /usr/bin/install -c

checking whether build environment is sane... yes

checking for gawk... gawk

checking whether make sets $(MAKE)... yes

checking whether to enable maintainer-specific portions of Makefiles... no

checking for gcc... gcc

checking for C compiler default output... a.out

checking whether the C compiler works... yes

checking whether we are cross compiling... no

checking for suffix of executables...

checking for suffix of object files... o

checking whether we are using the GNU C compiler... yes

checking whether gcc accepts -g... yes

checking for gcc option to accept ANSI C... none needed

checking for style of include used by make... GNU

checking dependency style of gcc... none

checking for a BSD-compatible install... /usr/bin/install -c

checking for ranlib... ranlib

checking how to run the C preprocessor... gcc -E

checking for egrep... grep -E

checking for ANSI C header files... yes

checking for sys/types.h... yes

checking for sys/stat.h... yes

checking for stdlib.h... yes

checking for string.h... yes

checking for memory.h... yes

checking for strings.h... yes

checking for inttypes.h... yes

checking for stdint.h... yes

checking for unistd.h... yes

checking sys/sockio.h usability... no

checking sys/sockio.h presence... no

checking for sys/sockio.h... no

checking machine endianess... lil

checking if unaligned accesses fail... no

checking whether gcc needs -traditional... no

checking for strerror... yes

checking link-layer packet interface type... found linux primitives

checking for packet socket (PF_SOCKET)... yes

checking for Linux proc filesystem... yes

scanning available packet construction modules: 802.1q 802.1x 802.2 802.3 arp bgp cdp data dhcp dns ethernet fddi gre icmp igmp ip ipsec isl link mpls ntp ospf rip rpc sebek snmp stp tcp token_ring udp vrrp

checking net/ethernet.h usability... yes

checking net/ethernet.h presence... yes

checking for net/ethernet.h... yes

configure: creating ./config.status

config.status: creating Makefile

config.status: creating src/Makefile

config.status: creating include/Makefile

config.status: creating include/libnet/Makefile

config.status: creating sample/Makefile

config.status: creating version.h

config.status: creating include/libnet.h

config.status: creating libnet-config

config.status: creating include/config.h

config.status: executing depfiles commands

config.status: executing default commands

[root@Server libnet]# make

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_build_igmp.c' || echo './'`libnet_build_igmp.c

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_build_ip.c' || echo './'`libnet_build_ip.c

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_build_ipsec.c' || echo './'`libnet_build_ipsec.c

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_build_isl.c' || echo './'`libnet_build_isl.c

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_build_mpls.c' || echo './'`libnet_build_mpls.c

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_build_ntp.c' || echo './'`libnet_build_ntp.c

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_build_ospf.c' || echo './'`libnet_build_ospf.c

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_build_rip.c' || echo './'`libnet_build_rip.c

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_build_rpc.c' || echo './'`libnet_build_rpc.c

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_build_sebek.c' || echo './'`libnet_build_sebek.c

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_build_snmp.c' || echo './'`libnet_build_snmp.c

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_build_stp.c' || echo './'`libnet_build_stp.c

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_build_tcp.c' || echo './'`libnet_build_tcp.c

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_build_token_ring.c' || echo './'`libnet_build_token_ring.c

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_build_udp.c' || echo './'`libnet_build_udp.c

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_build_vrrp.c' || echo './'`libnet_build_vrrp.c

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_advanced.c' || echo './'`libnet_advanced.c

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_checksum.c' || echo './'`libnet_checksum.c

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_cq.c' || echo './'`libnet_cq.c

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_crc.c' || echo './'`libnet_crc.c

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_error.c' || echo './'`libnet_error.c

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_if_addr.c' || echo './'`libnet_if_addr.c

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_init.c' || echo './'`libnet_init.c

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_internal.c' || echo './'`libnet_internal.c

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_pblock.c' || echo './'`libnet_pblock.c

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_port_list.c' || echo './'`libnet_port_list.c

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_prand.c' || echo './'`libnet_prand.c

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_raw.c' || echo './'`libnet_raw.c

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_resolve.c' || echo './'`libnet_resolve.c

libnet_resolve.c: In function `libnet_hex_aton':

libnet_resolve.c:393: warning: dereferencing type-punned pointer will break strict-aliasing rules

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_version.c' || echo './'`libnet_version.c

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_write.c' || echo './'`libnet_write.c

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'libnet_link_linux.c' || echo './'`libnet_link_linux.c

rm -f libnet.a

ar cru libnet.a libnet_asn1.o libnet_build_802.1q.o libnet_build_802.1x.o libnet_build_802.2.o libnet_build_802.3.o libnet_build_arp.o libnet_build_bgp.o libnet_build_cdp.o libnet_build_data.o libnet_build_dhcp.o libnet_build_dns.o libnet_build_ethernet.o libnet_build_fddi.o
libnet_build_gre.o libnet_build_icmp.o libnet_build_igmp.o libnet_build_ip.o libnet_build_ipsec.o libnet_build_isl.o libnet_build_mpls.o libnet_build_ntp.o libnet_build_ospf.o libnet_build_rip.o libnet_build_rpc.o libnet_build_sebek.o libnet_build_snmp.o libnet_build_stp.o
libnet_build_tcp.o libnet_build_token_ring.o libnet_build_udp.o libnet_build_vrrp.o libnet_advanced.o libnet_checksum.o libnet_cq.o libnet_crc.o libnet_error.o libnet_if_addr.o libnet_init.o libnet_internal.o libnet_pblock.o libnet_port_list.o libnet_prand.o
libnet_raw.o libnet_resolve.o libnet_version.o libnet_write.o libnet_link_linux.o

ranlib libnet.a

make[1]: Leaving directory `/home/andylau/libnet/src'

Making all in sample

make[1]: Entering directory `/home/andylau/libnet/sample'

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'arp.c' || echo './'`arp.c

gcc -g -O2 -Wall -o arp arp.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'cdp.c' || echo './'`cdp.c

gcc -g -O2 -Wall -o cdp cdp.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'dhcp_discover.c' || echo './'`dhcp_discover.c

gcc -g -O2 -Wall -o dhcp_discover dhcp_discover.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'get_addr.c' || echo './'`get_addr.c

gcc -g -O2 -Wall -o get_addr get_addr.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'icmp_timestamp.c' || echo './'`icmp_timestamp.c

gcc -g -O2 -Wall -o icmp_timestamp icmp_timestamp.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'icmp_unreach.c' || echo './'`icmp_unreach.c

gcc -g -O2 -Wall -o icmp_unreach icmp_unreach.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'ieee.c' || echo './'`ieee.c

gcc -g -O2 -Wall -o ieee ieee.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'isl.c' || echo './'`isl.c

gcc -g -O2 -Wall -o isl isl.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'ntp.c' || echo './'`ntp.c

gcc -g -O2 -Wall -o ntp ntp.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'ospf_hello.c' || echo './'`ospf_hello.c

gcc -g -O2 -Wall -o ospf_hello ospf_hello.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'ospf_lsa.c' || echo './'`ospf_lsa.c

gcc -g -O2 -Wall -o ospf_lsa ospf_lsa.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'ping_of_death.c' || echo './'`ping_of_death.c

gcc -g -O2 -Wall -o ping_of_death ping_of_death.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'stp.c' || echo './'`stp.c

gcc -g -O2 -Wall -o stp stp.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'synflood.c' || echo './'`synflood.c

gcc -g -O2 -Wall -o synflood synflood.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'tcp1.c' || echo './'`tcp1.c

gcc -g -O2 -Wall -o tcp1 tcp1.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'tcp2.c' || echo './'`tcp2.c

gcc -g -O2 -Wall -o tcp2 tcp2.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'udp1.c' || echo './'`udp1.c

gcc -g -O2 -Wall -o udp1 udp1.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'udp2.c' || echo './'`udp2.c

udp2.c: In function `main':

udp2.c:211: warning: int format, __time_t arg (arg 3)

udp2.c:211: warning: int format, __suseconds_t arg (arg 4)

gcc -g -O2 -Wall -o udp2 udp2.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'synflood6.c' || echo './'`synflood6.c

synflood6.c: In function `main':

synflood6.c:157: warning: long int format, unsigned int arg (arg 2)

gcc -g -O2 -Wall -o synflood6 synflood6.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'icmp6_echoreq.c' || echo './'`icmp6_echoreq.c

gcc -g -O2 -Wall -o icmp6_echoreq icmp6_echoreq.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'icmp_echo_cq.c' || echo './'`icmp_echo_cq.c

gcc -g -O2 -Wall -o icmp_echo_cq icmp_echo_cq.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'smurf.c' || echo './'`smurf.c

gcc -g -O2 -Wall -o smurf smurf.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'dot1x.c' || echo './'`dot1x.c

gcc -g -O2 -Wall -o dot1x dot1x.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'dns.c' || echo './'`dns.c

gcc -g -O2 -Wall -o dns dns.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'rpc_tcp.c' || echo './'`rpc_tcp.c

gcc -g -O2 -Wall -o rpc_tcp rpc_tcp.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'rpc_udp.c' || echo './'`rpc_udp.c

gcc -g -O2 -Wall -o rpc_udp rpc_udp.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'mpls.c' || echo './'`mpls.c

gcc -g -O2 -Wall -o mpls mpls.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'icmp_timeexceed.c' || echo './'`icmp_timeexceed.c

gcc -g -O2 -Wall -o icmp_timeexceed icmp_timeexceed.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'fddi_tcp1.c' || echo './'`fddi_tcp1.c

gcc -g -O2 -Wall -o fddi_tcp1 fddi_tcp1.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'fddi_tcp2.c' || echo './'`fddi_tcp2.c

gcc -g -O2 -Wall -o fddi_tcp2 fddi_tcp2.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'tring_tcp1.c' || echo './'`tring_tcp1.c

gcc -g -O2 -Wall -o tring_tcp1 tring_tcp1.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'tring_tcp2.c' || echo './'`tring_tcp2.c

gcc -g -O2 -Wall -o tring_tcp2 tring_tcp2.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'icmp_redirect.c' || echo './'`icmp_redirect.c

gcc -g -O2 -Wall -o icmp_redirect icmp_redirect.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'bgp4_hdr.c' || echo './'`bgp4_hdr.c

gcc -g -O2 -Wall -o bgp4_hdr bgp4_hdr.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'bgp4_open.c' || echo './'`bgp4_open.c

gcc -g -O2 -Wall -o bgp4_open bgp4_open.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'bgp4_update.c' || echo './'`bgp4_update.c

gcc -g -O2 -Wall -o bgp4_update bgp4_update.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'bgp4_notification.c' || echo './'`bgp4_notification.c

gcc -g -O2 -Wall -o bgp4_notification bgp4_notification.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'gre.c' || echo './'`gre.c

gcc -g -O2 -Wall -o gre gre.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'synflood6_frag.c' || echo './'`synflood6_frag.c

gcc -g -O2 -Wall -o synflood6_frag synflood6_frag.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'tftp.c' || echo './'`tftp.c

gcc -g -O2 -Wall -o tftp tftp.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'ip_link.c' || echo './'`ip_link.c

gcc -g -O2 -Wall -o ip_link ip_link.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'ip_raw.c' || echo './'`ip_raw.c

gcc -g -O2 -Wall -o ip_raw ip_raw.o ../src/libnet.a

gcc -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -Wall -c `test -f 'sebek.c' || echo './'`sebek.c

gcc -g -O2 -Wall -o sebek sebek.o ../src/libnet.a

make[1]: Leaving directory `/home/andylau/libnet/sample'

make[1]: Entering directory `/home/andylau/libnet'

make[1]: Nothing to be done for `all-am'.

make[1]: Leaving directory `/home/andylau/libnet'

[root@Server libnet]# make install

Making install in include

make[1]: Entering directory `/home/andylau/libnet/include'

Making install in libnet

make[2]: Entering directory `/home/andylau/libnet/include/libnet'

make[3]: Entering directory `/home/andylau/libnet/include/libnet'

make[3]: Nothing to be done for `install-exec-am'.

/bin/sh ../../mkinstalldirs /usr/include/libnet

mkdir /usr/include/libnet

/usr/bin/install -c -m 644 libnet-asn1.h /usr/include/libnet/libnet-asn1.h

/usr/bin/install -c -m 644 libnet-functions.h /usr/include/libnet/libnet-functions.h

/usr/bin/install -c -m 644 libnet-headers.h /usr/include/libnet/libnet-headers.h

/usr/bin/install -c -m 644 libnet-macros.h /usr/include/libnet/libnet-macros.h

/usr/bin/install -c -m 644 libnet-structures.h /usr/include/libnet/libnet-structures.h

/usr/bin/install -c -m 644 libnet-types.h /usr/include/libnet/libnet-types.h

make[3]: Leaving directory `/home/andylau/libnet/include/libnet'

make[2]: Leaving directory `/home/andylau/libnet/include/libnet'

make[2]: Entering directory `/home/andylau/libnet/include'

make[3]: Entering directory `/home/andylau/libnet/include'

make[3]: Nothing to be done for `install-exec-am'.

/bin/sh ../mkinstalldirs /usr/include

/usr/bin/install -c -m 644 libnet.h /usr/include/libnet.h

make[3]: Leaving directory `/home/andylau/libnet/include'

make[2]: Leaving directory `/home/andylau/libnet/include'

make[1]: Leaving directory `/home/andylau/libnet/include'

Making install in src

make[1]: Entering directory `/home/andylau/libnet/src'

make[2]: Entering directory `/home/andylau/libnet/src'

/bin/sh ../mkinstalldirs /usr/lib

/usr/bin/install -c -m 644 libnet.a /usr/lib/libnet.a

ranlib /usr/lib/libnet.a

make[2]: Nothing to be done for `install-data-am'.

make[2]: Leaving directory `/home/andylau/libnet/src'

make[1]: Leaving directory `/home/andylau/libnet/src'

Making install in sample

make[1]: Entering directory `/home/andylau/libnet/sample'

make[2]: Entering directory `/home/andylau/libnet/sample'

make[2]: Nothing to be done for `install-exec-am'.

make[2]: Nothing to be done for `install-data-am'.

make[2]: Leaving directory `/home/andylau/libnet/sample'

make[1]: Leaving directory `/home/andylau/libnet/sample'

make[1]: Entering directory `/home/andylau/libnet'

make[2]: Entering directory `/home/andylau/libnet'

make[2]: Nothing to be done for `install-exec-am'.

make[2]: Nothing to be done for `install-data-am'.

make[2]: Leaving directory `/home/andylau/libnet'

make[1]: Leaving directory `/home/andylau/libnet'

[root@Server libnet]# cd ..

[root@Server andylau]# dir

libnet libnids-1.20 libpcap-0.9.8

[root@Server andylau]# cd libpcap-0.9.8/

[root@Server libpcap-0.9.8]# dir

acconfig.h ethertype.h Makefile.in pcap-enet.c README.dag

aclocal.m4 fad-getad.c missing pcap.h README.hpux

arcnet.h fad-gifc.c mkdep pcap-int.h README.linux

atmuni31.h fad-glifc.c msdos pcap-linux.c README.macosx

bpf fad-null.c nametoaddr.c pcap-namedb.h README.septel

bpf_dump.c fad-win32.c net pcap-nit.c README.tru64

bpf_image.c FILES nlpid.h pcap-nit.h README.Win32

CHANGES gencode.c optimize.c pcap-null.c savefile.c

CHANGES~ gencode.c.orig packaging pcap-pf.c scanner.l

ChmodBPF gencode.c.rej pcap1.h pcap-pf.h sll.h

config.guess gencode.h pcap.3 pcap-septel.c sunatmpos.h

config.h.in grammar.y pcap-bpf.c pcap-septel.h SUNOS4

config.sub inet.c pcap-bpf.h pcap-snit.c TODO

configure install-sh pcap.c pcap-snoop.c VERSION

configure.in INSTALL.txt pcap-dag.c pcap-stdinc.h Win32

CREDITS lbl pcap-dag.h pcap-win32.c wlan_filtering.patch

CVS libpcap-0.9 pcap-dlpi.c ppp.h

doc LICENSE pcap-dos.c README

etherent.c llc.h pcap-dos.h README.aix

[root@Server libpcap-0.9.8]# ./configure

checking build system type... i686-pc-linux-gnu

checking host system type... i686-pc-linux-gnu

checking target system type... i686-pc-linux-gnu

checking for gcc... gcc

checking for C compiler default output file name... a.out

checking whether the C compiler works... yes

checking whether we are cross compiling... no

checking for suffix of executables...

checking for suffix of object files... o

checking whether we are using the GNU C compiler... yes

checking whether gcc accepts -g... yes

checking for gcc option to accept ISO C89... none needed

checking gcc version... 3

checking for inline... inline

checking for __attribute__... yes

checking for u_int8_t using gcc... yes

checking for u_int16_t using gcc... yes

checking for u_int32_t using gcc... yes

checking how to run the C preprocessor... gcc -E

checking for grep that handles long lines and -e... /bin/grep

checking for egrep... /bin/grep -E

checking for ANSI C header files... yes

checking for sys/types.h... yes

checking for sys/stat.h... yes

checking for stdlib.h... yes

checking for string.h... yes

checking for memory.h... yes

checking for strings.h... yes

checking for inttypes.h... yes

checking for stdint.h... yes

checking for unistd.h... yes

checking sys/ioccom.h usability... no

checking sys/ioccom.h presence... no

checking for sys/ioccom.h... no

checking sys/sockio.h usability... no

checking sys/sockio.h presence... no

checking for sys/sockio.h... no

checking limits.h usability... yes

checking limits.h presence... yes

checking for limits.h... yes

checking paths.h usability... yes

checking paths.h presence... yes

checking for paths.h... yes

checking for net/pfvar.h... no

checking for netinet/if_ether.h... yes

checking for ANSI ioctl definitions... yes

checking for strerror... yes

checking for strlcpy... no

checking for vsnprintf... yes

checking for snprintf... yes

checking for library containing gethostbyname... none required

checking for library containing socket... none required

checking for library containing putmsg... none required

checking for ether_hostton... yes

checking whether ether_hostton is declared... no

checking netinet/ether.h usability... yes

checking netinet/ether.h presence... yes

checking for netinet/ether.h... yes

checking whether ether_hostton is declared... yes

checking if --disable-protochain option is specified... enabled

checking packet capture type... linux

checking for getifaddrs... yes

checking ifaddrs.h usability... yes

checking ifaddrs.h presence... yes

checking for ifaddrs.h... yes

checking if --enable-ipv6 option is specified... no

checking whether to build optimizer debugging code... no

checking whether to build parser debugging code... no

checking Linux kernel version... 2

checking if if_packet.h has tpacket_stats defined... yes

checking whether we have /proc/net/dev... yes

checking whether we have DAG API headers... no (/usr/local/include)

checking whether we have Septel API... no

checking for flex... flex

checking for flex 2.4 or higher... yes

checking for bison... bison

checking for ranlib... ranlib

checking if sockaddr struct has sa_len member... no

checking if sockaddr_storage struct exists... yes

checking if dl_hp_ppa_info_t struct has dl_module_id_1 member... no

checking if unaligned accesses fail... no

checking for a BSD-compatible install... /usr/bin/install -c

configure: creating ./config.status

config.status: creating Makefile

config.status: WARNING: Makefile.in seems to ignore the --datarootdir setting

config.status: creating config.h

[root@Server libpcap-0.9.8]# make

gcc -O2 -fPIC -I. -DHAVE_CONFIG_H -D_U_="__attribute__((unused))" -c ./pcap-linux.c

gcc -O2 -fPIC -I. -DHAVE_CONFIG_H -D_U_="__attribute__((unused))" -c ./fad-getad.c

sed -e 's/.*/static const char pcap_version_string[] = "libpcap version &";/' ./VERSION > version.h

gcc -O2 -fPIC -I. -DHAVE_CONFIG_H -D_U_="__attribute__((unused))" -c ./pcap.c

gcc -O2 -fPIC -I. -DHAVE_CONFIG_H -D_U_="__attribute__((unused))" -c ./inet.c

gcc -O2 -fPIC -I. -DHAVE_CONFIG_H -D_U_="__attribute__((unused))" -c ./gencode.c

gcc -O2 -fPIC -I. -DHAVE_CONFIG_H -D_U_="__attribute__((unused))" -c ./optimize.c

gcc -O2 -fPIC -I. -DHAVE_CONFIG_H -D_U_="__attribute__((unused))" -c ./nametoaddr.c

gcc -O2 -fPIC -I. -DHAVE_CONFIG_H -D_U_="__attribute__((unused))" -c ./etherent.c

gcc -O2 -fPIC -I. -DHAVE_CONFIG_H -D_U_="__attribute__((unused))" -c ./savefile.c

rm -f bpf_filter.c

ln -s ./bpf/net/bpf_filter.c bpf_filter.c

gcc -O2 -fPIC -I. -DHAVE_CONFIG_H -D_U_="__attribute__((unused))" -c bpf_filter.c

gcc -O2 -fPIC -I. -DHAVE_CONFIG_H -D_U_="__attribute__((unused))" -c ./bpf_image.c

gcc -O2 -fPIC -I. -DHAVE_CONFIG_H -D_U_="__attribute__((unused))" -c ./bpf_dump.c

flex -Ppcap_ -t scanner.l > $$.scanner.c; mv $$.scanner.c scanner.c

bison -y -p pcap_ -d grammar.y

mv y.tab.c grammar.c

mv y.tab.h tokdefs.h

gcc -O2 -fPIC -I. -DHAVE_CONFIG_H -D_U_="__attribute__((unused))" -c scanner.c

gcc -O2 -fPIC -I. -DHAVE_CONFIG_H -D_U_="__attribute__((unused))" -Dyylval=pcap_lval -c grammar.c

sed -e 's/.*/char pcap_version[] = "&";/' ./VERSION > version.c

gcc -O2 -fPIC -I. -DHAVE_CONFIG_H -D_U_="__attribute__((unused))" -c version.c

ar rc libpcap.a pcap-linux.o fad-getad.o pcap.o inet.o gencode.o optimize.o nametoaddr.o etherent.o savefile.o bpf_filter.o bpf_image.o bpf_dump.o scanner.o grammar.o version.o

ranlib libpcap.a

[root@Server libpcap-0.9.8]# make install

[ -d /usr/local/lib ] || /

(mkdir -p /usr/local/lib; chmod 755 /usr/local/lib)

/usr/bin/install -c -m 644 libpcap.a /usr/local/lib/libpcap.a

ranlib /usr/local/lib/libpcap.a

[ -d /usr/local/include ] || /

(mkdir -p /usr/local/include; chmod 755 /usr/local/include)

/usr/bin/install -c -m 644 ./pcap.h /usr/local/include/pcap.h

/usr/bin/install -c -m 644 ./pcap-bpf.h /

/usr/local/include/pcap-bpf.h

/usr/bin/install -c -m 644 ./pcap-namedb.h /

/usr/local/include/pcap-namedb.h

[ -d /usr/local/share/man/man3 ] || /

(mkdir -p /usr/local/share/man/man3; chmod 755 /usr/local/share/man/man3)

/usr/bin/install -c -m 644 ./pcap.3 /

/usr/local/share/man/man3/pcap.3

[root@Server libpcap-0.9.8]# cd ..

[root@Server andylau]# dir

libnet libnids-1.20 libpcap-0.9.8

[root@Server andylau]# cd libnids-1.20/

[root@Server libnids-1.20]# dir

CHANGES configure CREDITS Makefile.in README

config.guess configure.in doc MISC samples

config.sub COPYING install-sh mkinstalldirs src

[root@Server libnids-1.20]# ./configure

checking build system type... i686-pc-linux-gnu

checking host system type... i686-pc-linux-gnu

checking target system type... i686-pc-linux-gnu

checking for gcc... gcc

checking for C compiler default output... a.out

checking whether the C compiler works... yes

checking whether we are cross compiling... no

checking for suffix of executables...

checking for suffix of object files... o

checking whether we are using the GNU C compiler... yes

checking whether gcc accepts -g... yes

checking for ranlib... ranlib

checking for a BSD-compatible install... /usr/bin/install -c

checking how to run the C preprocessor... gcc -E

checking for ANSI C header files... yes

checking for sys/types.h... yes

checking for sys/stat.h... yes

checking for stdlib.h... yes

checking for string.h... yes

checking for memory.h... yes

checking for strings.h... yes

checking for inttypes.h... yes

checking for stdint.h... yes

checking for unistd.h... yes

checking sys/time.h usability... yes

checking sys/time.h presence... yes

checking for sys/time.h... yes

checking syslog.h usability... yes

checking syslog.h presence... yes

checking for syslog.h... yes

checking for unistd.h... (cached) yes

checking for gcc option to accept ANSI C... none needed

checking for an ANSI C-conforming const... yes

checking for inline... inline

checking whether time.h and sys/time.h may both be included... yes

checking whether byte ordering is bigendian... no

checking for gettimeofday... yes

checking for socket in -lsocket... no

checking for gethostbyname in -lnsl... yes

checking for libpcap... yes

checking for libnet... yes

checking whether to build shared library... no

checking the name of struct icmp... struct icmphdr

checking if tcp states are defined... yes

checking for bsd-ish struct udphdr... yes

checking libnet version... looks new

configure: creating ./config.status

config.status: creating Makefile

config.status: creating src/Makefile

config.status: creating samples/Makefile

config.status: creating src/config.h

[root@Server libnids-1.20]# make

cd src ; make static

make[1]: Entering directory `/home/andylau/libnids-1.20/src'

gcc -c -g -O2 -D_BSD_SOURCE -W -Wall -DLIBNET_VER=1 -DHAVE_ICMPHDR=1 -DHAVE_TCP_STATES=1 -DHAVE_BSD_UDPHDR=1 -I. -I/usr/local/include checksum.c

gcc -c -g -O2 -D_BSD_SOURCE -W -Wall -DLIBNET_VER=1 -DHAVE_ICMPHDR=1 -DHAVE_TCP_STATES=1 -DHAVE_BSD_UDPHDR=1 -I. -I/usr/local/include ip_fragment.c

gcc -c -g -O2 -D_BSD_SOURCE -W -Wall -DLIBNET_VER=1 -DHAVE_ICMPHDR=1 -DHAVE_TCP_STATES=1 -DHAVE_BSD_UDPHDR=1 -I. -I/usr/local/include ip_options.c

gcc -c -g -O2 -D_BSD_SOURCE -W -Wall -DLIBNET_VER=1 -DHAVE_ICMPHDR=1 -DHAVE_TCP_STATES=1 -DHAVE_BSD_UDPHDR=1 -I. -I/usr/local/include killtcp.c

gcc -c -g -O2 -D_BSD_SOURCE -W -Wall -DLIBNET_VER=1 -DHAVE_ICMPHDR=1 -DHAVE_TCP_STATES=1 -DHAVE_BSD_UDPHDR=1 -I. -I/usr/local/include libnids.c

gcc -c -g -O2 -D_BSD_SOURCE -W -Wall -DLIBNET_VER=1 -DHAVE_ICMPHDR=1 -DHAVE_TCP_STATES=1 -DHAVE_BSD_UDPHDR=1 -I. -I/usr/local/include scan.c

gcc -c -g -O2 -D_BSD_SOURCE -W -Wall -DLIBNET_VER=1 -DHAVE_ICMPHDR=1 -DHAVE_TCP_STATES=1 -DHAVE_BSD_UDPHDR=1 -I. -I/usr/local/include tcp.c

gcc -c -g -O2 -D_BSD_SOURCE -W -Wall -DLIBNET_VER=1 -DHAVE_ICMPHDR=1 -DHAVE_TCP_STATES=1 -DHAVE_BSD_UDPHDR=1 -I. -I/usr/local/include util.c

gcc -c -g -O2 -D_BSD_SOURCE -W -Wall -DLIBNET_VER=1 -DHAVE_ICMPHDR=1 -DHAVE_TCP_STATES=1 -DHAVE_BSD_UDPHDR=1 -I. -I/usr/local/include allpromisc.c

gcc -c -g -O2 -D_BSD_SOURCE -W -Wall -DLIBNET_VER=1 -DHAVE_ICMPHDR=1 -DHAVE_TCP_STATES=1 -DHAVE_BSD_UDPHDR=1 -I. -I/usr/local/include hash.c

ar -cr libnids.a checksum.o ip_fragment.o ip_options.o killtcp.o libnids.o scan.o tcp.o util.o allpromisc.o hash.o

ranlib libnids.a

make[1]: Leaving directory `/home/andylau/libnids-1.20/src'

[root@Server libnids-1.20]# make install

cd src ; make _install

make[1]: Entering directory `/home/andylau/libnids-1.20/src'

../mkinstalldirs /usr/local/lib

../mkinstalldirs /usr/local/include

../mkinstalldirs /usr/local/man/man3

mkdir /usr/local/man

mkdir /usr/local/man/man3

/usr/bin/install -c -c -m 644 libnids.a /usr/local/lib

/usr/bin/install -c -c -m 644 nids.h /usr/local/include

/usr/bin/install -c -c -m 644 libnids.3 /usr/local/man/man3

make[1]: Leaving directory `/home/andylau/libnids-1.20/src'

OK!至此,三个源码包已经成功编译安装好了。

最后运行我编写的一个Udp发包工具udpSender.c[root@Server andylau]# gcc -o udpSender udpSender.c -lnet

[root@Server andylau]# dir

libnet libnids-1.20 libpcap-0.9.8 udpSender udpSender.c

[root@Server andylau]# ./udpSender -s 192.168.1.102.12345 -d 192.168.1.100.53 -p virus

libnet 1.1 packet shaping: UDP[raw]

33 byte packet, ready to go

Wrote 33 byte UDP packet; check the wire.

看到了吗?已经发送成功了!说明我们搭建的平台没有问题。

原文地址 http://blog.chinaunix.net/u2/79877/showart_1271466.html
发表于: 2008-12-08 ,修改于: 2008-12-24 17:02,已浏览488次,有评论0条

推荐
投诉
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: