安裝步驟:
(1) tcpdump需要依賴(lài)包libcap,所以需要先安裝lipcap,然后安裝tcpdump
(2) lipcap需要依賴(lài)包flex和bison,所以需要先安裝flex和bison
(3) flex、bison、libcap、tcpdump百度網(wǎng)盤(pán)安裝包可以訪問(wèn)鏈接: https://pan.baidu.com/s/17Kx56e_B87OnOSQz598D5w
提取碼:jsw8
如果想下載最新版本tar.gz格式的libcap、tcpdump,可以訪問(wèn)鏈接: https://www.tcpdump.org/release/
如果想下載不同操作系統(tǒng)的rpm格式的 flex、bison、libcap、tcpdump,可以訪問(wèn)鏈接: https://pkgs.org/download/libpcap
1.安裝依賴(lài)包flex和bison
安裝包:
tar -zxvf flex.tar.gz
cd flex/
./configure --prefix=/usr
make && sudo make install
tar -zxvf bison.tar.gz
cd bison/
./configure --prefix=/usr
make && sudo make install
安裝bison:make編輯報(bào)錯(cuò)./stdio.h:1010:1: error: ‘gets’ undeclared here (not in a function)
解決辦法:文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-461920.html
vi lib/stdio.in.h
查找字段:gets is a security hole,將_GL_WARN_ON_USE (gets, “gets is a security hole - use fgets instead”); 字段和他之前的注釋 /* 一塊注釋掉,如下
/* It is very rare that the developer ever has full control of stdin,
so any use of gets warrants an unconditional warning. Assume it is
always declared, since it is required by C89.
#undef gets
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); */
再添加如下內(nèi)容:
#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
#endif
安裝bison:make編輯報(bào)錯(cuò)lib/fseterr.c:77:3: error: #error "Please port gnulib fseterr.c to your platform! Look at the definitions of ferror and clearerr on your system, then report this to bug-gnulib
解決辦法:
cd /opt/p2/openwrt/build_dir/host/bison-3.0.4/
sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c
echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h
2.安裝lipcap
tar -zxvf libpcap-1.5.3.tar.gz
cd libpcap-1.5.3
./configure
sudo make install
3.安裝tcpdump
tar -zxvf tcpdump-4.5.1.tar.gz
cd tcpdump-4.5.1
./configure
sudo make install
4.校驗(yàn)安裝成功
抓取所有經(jīng)過(guò)eno33559296網(wǎng)卡的網(wǎng)絡(luò)數(shù)據(jù),并寫(xiě)入指定文件
tcpdump -i eno33559296 -w /tmp/wangjing.pcap文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-461920.html
到了這里,關(guān)于linux離線(xiàn)安裝tcpdump的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!