tcpdump可以按应用层协议过滤吗?

Can tcpdump filter by application layer protocol?

我没能找到一种方法让 tcpdump 按应用层协议(如 HTTP 或 FTP 进行过滤。它似乎最多可以按 TCP 或 UDP 等传输层协议进行过滤:https://linux.die.net/man/7/pcap-filter

tcpdump 真的没有像 Wireshark 那样检查和识别应用层协议头的功能吗?

tcpdump 使用 pcap 过滤器语法并允许您按端口过滤:

tcp port 80

tcp port 21

如果你想按应用层协议过滤,你必须使用TShark. With this tool you can use capture filters with the same syntax as pcap filters but also display filters,它允许你按应用层协议过滤:

http

ftp