How to extract an SSL/TLS message using scapy and python?

我的梦境 提交于 2019-12-02 03:34:01
Cukic0d

If you want to play with TLS handshake, enable TLS on scapy using load_layer("tls").

That enables the TLS module, which supports handshake (requires scapy >= 2.4.0). Scapy will then correctly dissect TLS handshake/key... packets

You should first try

load_layer("tls")
packets = sniff(prn=lambda x:x.summary(), lfilter=lambda x: TLS in x)

Have a look on how the packets are built:

Example:

There is also a quite fancy guide here: https://github.com/secdev/scapy/blob/master/doc/notebooks/tls/notebook2_tls_protected.ipynb

So summarize:

You will find each packet when using load_layer("tls").

Note that there are a lot of packets and that TLSCertificate will only appear once. msg is a list because many informations can be contained in a single TLS packet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!