1. 下载
libpcap: http://www.tcpdump.org/release/libpcap-1.9.0.tar.gz
cmake: https://github-production-release-asset-2e65be.s3.amazonaws.com/537699/54722c00-cf07-11e9-8910-8264b6ebd3e4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20190930%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20190930T023618Z&X-Amz-Expires=300&X-Amz-Signature=752170aaf9180a2bb389e58db4d1dffeaa1107eb001d0bd4f22c6463b3a4dcca&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dcmake-3.15.3-Linux-x86_64.sh&response-content-type=application%2Foctet-stream
Wireshark:https://2.na.dl.wireshark.org/src/wireshark-3.0.5.tar.xz
GLib2.0: 使用yum安装,glib2, glib2-devel
gcc/gcc-c++: 使用yum安装
2. 安装
安装glib2.0
yum install glib2 glib2-devel
安装gcc, gcc-c++
yum install gcc, gcc-c++
安装 bison
yum install bison
安装libpcap
tar zxf libpcap-1.9.0.tar.gz
cd libpcap-1.9.0/
./configure --prefix=/home/tim/inst/
make
make install
安装CMake
./cmake-3.15.3-Linux-x86_64.sh --prefix=/home/tim/inst/
cd /home/tim/inst/
cp -rf cmake-3.*/bin/* ./bin/
cp -rf cmake-3.*/share/* ./share/
cp -rf cmake-3.*/* .
安装wireshark
tar xf wireshark-3.0.5.tar.xz
cd wireshark-3.0.5/
mkdir build
cd build
cmake -DBUILD_wireshark=OFF -DCMAKE_INSTALL_PREFIX=/home/tim/inst ../
make
make install
3. 设置普通用户能抓包权限
root用户环境
安装 libcap
yum install libcap
groupadd -g wireshark
usermod -a -G wireshark tim
chgrp wireshark /home/tim/inst/bin/dumpcap
chmod 4750 /home/tim/inst/bin/dumpcap
setcap cap_net_raw,cap_net_admin=eip /home/tim/inst/bin/dumpcap
getcap /home/tim/inst/bin/dumpcap
输出
/home/tim/inst/bin/dumpcap = cap_net_admin,cap_net_raw+eip
tim普通用户环境
tshark -i ens33
... working...