使用 wireshark+rpcapd 实现远程抓包

Linux 安装 rpcapd

可以访问 https://www.tcpdump.org/index.html#latest-releases,下载最新 libpcap

# yum安装
yum install -y gcc gcc-c++ glibc-static flex
# dnf安装
dnf install -y gcc gcc-c++ flex
dnf --enablerepo=crb install glibc-static

wget https://www.tcpdump.org/release/libpcap-1.10.4.tar.gz

# 自v1.9.0版本开始,自带rpcapd,无需另外安装
tar -zxf libpcap-1.10.4.tar.gz
cd libpcap-1.10.4
./configurate --enable-remote && make

# 启动rpcapd
./rpcapd/rpcapd -4 -n

Windows 安装 wireshark

  1. 从官网下载安装 https://www.wireshark.org/download.html
  2. 使用 scoop 安装,scoop install extras/wireshark

配置 wireshark

顶部菜单栏 -> 捕获 -> 选项 -> 下方的 Manage Interfaces -> 管理接口窗口

点击远程接口 -> 点击左下角加号➕

主机:服务器 IP

端口:默认为 2002,如果指定 - p 参数则自行修改

通过 tcp port 端口,可以指定监听具体端口的请求数据。

最终效果大致如下