Python module to retrieve the Master Key and Client Random from an ssl.SSLSocket.
This can be used to decrypt TLS traffic with WireShark. See https://wiki.wireshark.org/SSL#Using_the_.28Pre.29-Master-Secret for more details.
For python >= 3.8 use https://docs.python.org/3/library/ssl.html#ssl.SSLContext.keylog_filename instead!
- cpython
- libssl1.1
- Dump your encrypted traffic into a pcap file.
- Use
get_ssl_master_keyon yourssl.SSLSocket. - Write its output (
CLIENT_RANDOM .....) into a text file. - In WireShark in the protocol preferences for SSL, set the "(Pre)-Master-Secret log filename" to this file.
- Load the pcap file.
The code is ugly. Please improve it, e.g.:
- Port it to cffi
- Add support for other OpenSSL versions
- Add support for PyPy