本软件是本人的毕业设计“作品”。当年是因为Ubuntu而认识了Linux,进而知道了有个开源的图形界面开发工具——GTK+,机缘巧合之下在图书馆发现有一本刘文涛老师写的《Linux网络入侵检测系统》,翻开看看,觉得很好玩。Google之后,“歌”告诉我:没有人提供源代码?没有人自己尝试做过?……OK,哥自己干。
一、环境配置
1.由于本软件使用了libpcap,因此首先安装它(Update:到目前2010.7.4为止,选择的是最新版本1.1.1,2014.3.16下载时是1.5.3版):
1)downoad libpcap: http://www.tcpdump.org/release/
2)install the dependence packages oflibpcap:
sudo apt-get install flex
sudo apt-get install bison
3)install libpcap:
unzip <libpcap-version>
./configure
make
sudo make install
4)install rpm:
sudo apt-get install rpm
or you may receive following message:
error while loading shared libraries:libpcap.so.1: cannot open shared object file...
||
||== /usr/local/lib/
5)run the program as root, or you mayrelease:
a. no suitable device found(function pcap_lookupdev());
b. You don't have permissionto capture on that device (socket: Operation not permitted) (functionpcap_open(), pcap_open_live()).
2.安装tcpstat(到目前为止,选择的是最新版本1.5)
因为使用了GENERIC_LINK_OTHER,ETHER_ADDR_LEN等变量以及is_ip_packet(),get_ip_proto()等函数,安装tcpstat:http://www.frenchfries.net/paul/tcpstat/
3.安装tcpdump(到目前为止,选择的是最新版本4.1.1)
其实可以不用安装(*^__^*)嘻嘻……当时是因为用到了函数tcpport_string()和etheraddr_string()才装的,但运行时出现莫名其妙的问题,于是就把与tcpport_string()相关的所有变量、函数整体“移植”到我的程序中,而把etheraddr_string()函数舍弃掉了,换用了其它的方法,具体的替换方式可以参考刘文涛老师的《Linux