libnids libpcap libnet 安装

来源:互联网 发布:3个月能学会php吗 编辑:程序博客网 时间:2024/05/17 19:58

http://2382965.blog.51cto.com/2372965/802876

libnet-1.1.2.1.tar.gz

libpcap-1.2.1.tar.gz

libnids-1.24.tar.gz

这里的安装是有顺序的,nids的安装需要pcap和net,所以安装nids前需要先装pcap和net。

pcap和net没有相互依赖,所以它们顺序无关。

1、安装net

tar zxvf libnet-1.1.2.1.tar.gz

cd libnet

./configure

make

make install

2、安装pcap

tar zxvf libpcap-1.2.1.tar.gz

cd libpcap-1.2.1

./configure

make

make install

3、安装nids

tar zxvf libnids-1.24.tar.gz

cd libnids-1.24

./configure --with-pcap=[前面pcap的源码目录] --with-net=[前面net的源码目录]

make

make install

安装完成。

编译nids下samples的例子,修改:

 

PCAP_CFLAGS     = -I/usr/local/libpcap -I/usr/local/libpcap/pcap

PCAPLIB         = -L/usr/local/libpcap/lib -lpcap

                                                                                                                             

LNET_CFLAGS     = -I/usr/local/libnet/include

LNETLIB         = -L/usr/local/libnet/lib -lnet

修改这里的四个变量,使它们分别指示对应的头文件目录和库文件目录。

然后执行make就ok了。


出现的问题解决办法:

http://blog.sina.com.cn/s/blog_51e67b250100hh8h.html

安装libpcap出现:
1:error: Your operating system's lex is insufficient to compile
 libpcap. ex is a lex replacement that has many advantages, including
 being able to compile libpcap.
需要更新lex
执行命令:sudo apt-get install flex

2:出现错误
yacc -d grammar.y
make: yacc:命令未找到
make: *** [grammar.c] 错误 127
需要安装yacc
inux下是用flex和bison来分别代替lex和yacc的,安装直接使用命令:
sudo apt-get install bison

*************************************

安装libnet:
1:error: C++ preprocessor "/lib/cpp" fails sanity check
安装 g++ 编译器 (一款linux、unix等操作系统下的C++编译器
使用命令:sudo apt-get install g++

可能出现libnet的版本不符合要求

***************************************
安装libnids:
1:checking for GLIB... configure: error: Package requirements (glib-2.0 >= 2.2.0) were not met.

直接安装命令:sudo apt-get install "libglib2.0-dev"

编译程序是发生错误:
undefined reference to `pcap_parse'
不知道是什么原因说没有安装libpcap.

安装到最后才发现,原来ubuntu里提供了这三个包,只要运行下面三个命令即可了!(悲剧的人阿!)
原来是自己没有安装开发包,
sudo apt-get install libpcap-dev
sudo apt-get install libnet1-dev
sudo apt-get install libnids-dev
编译获取http的程序时发现无法截取无线网络的数据包。


原创粉丝点击