Groups
Groups
Sign in
Groups
Groups
姚博士的论坛-教学
Conversations
About
Send feedback
Help
Libpcap和Winpcap的安装与使用
68 views
Skip to first unread message
paska
unread,
Mar 9, 2008, 9:48:41 AM
3/9/08
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to 姚博士的论坛-教学
Libpcap是一个开放源码的数据包捕获函数库,现有的大部分Linux数据包捕获系统都是基于这套函数库或者是在它基础上做一些针对性的
改进。
Libpcap的安装(下载libpcap 库,文件的格式为x.tar.gz)
1、#tar zxvf x.tat.gz 解压文件到你的当前目录;
2、进入刚才解开的libpcap目录,执行#./configure命令,生成Makefile文件;
3、输入#make install,将生成的库安装到系统默认目录中。此目录为 /usr/lib ,如果需要修改,可以修改文件
Makefile 的prefix;
4、输入#make install-incl,将头文件安装至系统默认目录,/usr/include,修改同上。
使用
如果要使用libpcap,一般加入#include <pcap.h>,编译时要加上-lpcap,例如gcc -o example
example.c -lpcap
Winpcap是在windows中使用的数据包捕获函数库。在VC++中使用Winpcap的步骤如下:
1、安装winpcap驱动winpcap_3_1.exe;
2、解压WpdPack_3_2_alpha1.zip,比如解压到C:\WpdPack;
3、创建C++工程之后,在Tools->options->directories中选择include files新建路径导向C:
\WpdPack\include,选择library files新建路径导向C:\WpdPack\lib;
4、在project->settings->c/c++中的Preprocessor definitions中添加WPCAP,在
project->settings->Link中的Object/library modules中添加wpcap.lib。
Reply all
Reply to author
Forward
0 new messages