安装 Wireshark 工具
How to set up wireshark to run without root on Debian? – Super User
在 Ubuntu 21.04 中,按照如下方法安装:
# apt-get install -y wireshark
# dpkg-reconfigure wireshark-common
…
Should non-superusers be able to capture packets?
<Yes>
…
# adduser <your username> wireshark
# reboot // 或者,退出重新登录当前帐号
编写表达式
6.4. Building Display Filter Expressions
应用场景
通过 tcpdump 抓包,然后通过 Wireshark 分析
https://www.wireshark.org/ https://www.wireshark.org/docs/wsug_html_chunked/
我们能够使用 tcpdump 保存数据包信息,将数据包信息导入 wireshark 中分析: 1)不仅以更规整的格式,展示各个网络包的头部信息; 2)还用不同颜色展示 DNS 和 ICMP 这两种不同的协议; 3)选择某一个网络包后,在其下方的网络包详情中,可以看到这个包在协议栈各层的详细信息
我们将要访问的是 http://example.com/ 站点,并分析流量:
# tcpdump -i any -nn host example.com -w web.pcap
# curl http://example.com
// 按下 Ctrl+C 停止 tcpdump 命令
# wireshark
常用配置
远程主机抓包
How can I sniff the traffic of remote machine with wireshark? – Server Fault [OpenWrt Wiki] How to capture, filter and inspect packets using tcpdump or wireshark tools
ssh root@<SERVER> tcpdump -U -s0 -i <INTERFACE> -w – “<EXPRESSION>” | wireshark -k -i –
# tcpdump
# -U:配合 -w 选项,将数据包[……]
READ MORE