wireshark远程抓包方式汇总
通常在linux上使用tcpdump抓包,在远端linux抓取一部分数据包后,再回传到本地,然后使用wireshark进行分析。这种操作主要是抓取的数据包不是实时的,不能做实时数据分析,其次每次要穿文件也不太方便。所以对wireshark远程抓包做了一个非常详细介绍,总结了windows、linux、mac三种不同方式远程抓包方式。
本地windows远程抓包linux
在linux上安装rpcapd
rpcapd 是一个为 Windows 版本的Wireshark协议分析器提供远程流量捕获的守护进程。它随Windows 的WinPcap 网络捕获库一起提供,但在 Linux 中的 libpcap 中不存在。安装需要root权限执行。
在 Ubuntu Linux 下安装:
apt-get build-dep libpcap -y git clone https://github.com/rpcapd-linux/rpcapd-linux.git cd rpcapd-linux/libpcap/ ./configure && make cd ../ make
Centos/Fedora/Redhat Linux 下安装:
glibc-static 中的 libcrypt.a 被破坏,需要删除rpcapd-linux目录Makefile中-static
再编译。
yum install -y byacc glibc-static libgcrypt-devel git clone https://github.com/rpcapd-linux/rpcapd-linux.git cd rpcapd-linux/libpcap/ ./configure && make cd ../ sed -i 's/-static//' Makefile make

不指定端口,默认监听2002端口。
wireshark GUI 配置远程接口



开始抓包即可。

wireshark 命令行配置远程接口
如果没有配置wireshark环境变量,就打开wireshark安装目录并执行下面命令。
wireshark -k -i rpcap://<capture_box_ip>:<rpcapd_port>/<interface_to_capture>

本地mac远程抓包linux
本地mac配置sshdump

windows的wireshark默认没有该选项,需要本地安装openssh客户端。




同理mac上也可以使用上面本地windows的rpcap的方式进行抓包。
本地linux远程抓包linux
本地wireshark设置管道
在本地linux创建管道文件
mkfifo /tmp/sharkfile
远程linux安装wireshark
yum install wireshark* -y


ssh user@remote-host "dumpcap -P -w - -f 'not tcp port 22'" > /tmp/sharkfile

同理本地linux也可以使用sshdump和rpcap的方式进行抓包。
赞赏微信赞赏
支付宝赞赏
目前为止有一条评论