大网数据广告活动
服务器运维问答

How to print SSL packet details with tshark?

· 52CE 我爱测

I collected a brief exchange between an SSL client and server (openssl's s_client and s_server , to be exact), and want to view the ssl portions of the pcap file with tshark . I don't need to decrypt the encrypted portions, but a…

问题原文

原帖链接 · vasilyrud · CC BY-SA 4.0

I collected a brief exchange between an SSL client and server (openssl's s_client and s_server, to be exact), and want to view the ssl portions of the pcap file with tshark. I don't need to decrypt the encrypted portions, but at least would like to know the values in the unencrypted fields.

When copying the file from the server to my desktop I can open the pcap file with Wireshark and see the fields by default:

On the other hand, tshark -r tls_dump.pcap only displays up to the TCP portion of the packets. For example, for the same packet:

4 0.000069237    127.0.0.1 → 127.0.0.1    TCP 373 54312 → 44330 [PSH, ACK] Seq=1 Ack=1 Win=43776 Len=307 ...

I tried collecting the packets both with tcpdump -U -i lo 'port 44330' -w tls_dump.pcap and with tshark -nn -i lo -s 0 -w tls_dump.pcap port 44330 (as here), but when trying to view the packets the results are the same.

tshark options I tried:

  • -2 has no effect

  • -2R "ssl" shows nothing

  • -Y "ssl" shows nothing

  • -o "ssl.desegment_ssl_records: TRUE" -o "ssl.desegment_ssl_application_data: TRUE" has no effect

  • -T json shows only raw uninterpreted TCP payload data

  • -V shows only raw uninterpreted TCP payload data

  • --print has no effect

  • --enable-protocol "ssl" has no effect

  • --enable-heuristic "ssl" gives me a No such protocol ssl, can't enable error

How does one output SSL packet details of an SSL packet with tshark?

已采纳解答

原帖链接 · vasilyrud · CC BY-SA 4.0

What worked in the end was specifying the port using -d tcp.port==44330,ssl, thus my full command was:

tshark -r tls_dump.pcap -d tcp.port==44330,ssl

The reason this was necessary was due to some version-specific differences in Wireshark. My desktop had version 2.6.0, which was able to automatically detect the SSL protocol. The server had version 2.4.6, which wasn't able to detect SSL and needed the port number to be specified.

Only SSL packets can be printed with:

tshark -r tls_dump.pcap -d tcp.port==44330,ssl -2R "ssl"

Only SSL packets in JSON format:

tshark -r tls_dump.pcap -d tcp.port==44330,ssl -2R "ssl" -T json

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-07-02)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。