Appearance
wireshark 远程分析
远程抓包 down 到本地分析相对会比较麻烦,有些场景需要本地 wireshark 时时分析 remote server 数据包。主要有以下三种方法。
一、匿名管道
ssh + wireshark + tcpdump
ssh [email protected] "tcpdump -s0 -w- -i ens38 'not port 22'" | wireshark -k -i -
-s snaplen
--snapshot-length=snaplen
-w- 告诉 tcpdump 将二进制数据写入 stdout
二、命名管道
- 创建一个命名管道
mkfifo /tmp/remote
- 管道读取方式1:cli 读取
wireshark -k -i /tmp/remote
-k start capturing immediately (def: do nothing)
-i <interface>, --interface <interface>
- 管道读取方式2:gui 读取
- ssh tcpdump 将数据包重定向到命名管道
ssh [email protected] "tcpdump -s0 -n -w- -i ens38" > /tmp/remote
-s snaplen
--snapshot-length=snaplen
-w- 告诉 tcpdump 将二进制数据写入 stdout
-i <interface>, --interface <interface>
-n Don't convert addresses (i.e., host addresses, port numbers, etc.) to names.
三、sshdump
- 显示所有接口,点击齿轮配置 sshdump
- 配置 sshdump 认证(切换混杂模式需要 root 权限,所以需要以root身份登录)
- 配置 capture