I have a script in Python that is simply download some video with youtube-dl library. Please note: script is running in Anaconda Environment. On top of it I have a tshark capture all network traffic. I'm looking for a way to capture and decode the SSL Pre Master key. Is it possible to capture and save it in order to be re-used to decrypt traffic with WhireShark?
I'm using (in Anaconda env): Python 3.6.5 - OpenSSL 1.1.1c 28 May 2019
In order to capture SSL keys, you need to set the $SSLKEYLOGFILE environmental variable. I wrote an article on using Firefox to download a website's HTML and then decrypting it. Other people have also written good articles on doing this:
For youtube-dl to take advantage of the $SSLKEYLOGFILE variable, you need Python 3.8 and OpenSSL 1.1.1.