Files
tldr/pages.zh/linux/tshark.md

36 lines
767 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# tshark
> 数据包分析工具Wireshark的命令行版本。
> 更多信息:<https://tshark.dev/>.
- 监控本地主机上的所有内容:
`tshark`
- 仅捕获匹配特定捕获过滤器的数据包:
`tshark -f '{{udp port 53}}'`
- 仅显示匹配特定输出过滤器的数据包:
`tshark -Y '{{http.request.method == "GET"}}'`
- 使用特定协议例如HTTP解码TCP端口
`tshark -d tcp.port=={{8888}},{{http}}`
- 指定捕获输出的格式:
`tshark -T {{json|text|ps|…}}`
- 选择特定字段进行输出:
`tshark -T {{fields|ek|json|pdml}} -e {{http.request.method}} -e {{ip.src}}`
- 将捕获的数据包写入文件:
`tshark -w {{path/to/file}}`
- 分析文件中的数据包:
`tshark -r {{path/to/file.pcap}}`