Capture and decrypt SSL traffic #
Environment
- macOS 10.15.7, Mozilla Firefox 95.0.2, Wireshark 3.6.1, tcpdump 4.9.3
Get SSL session keys
- Quit Firefox
-
export SSLKEYLOGFILE=~/Desktop/sklf && open /Applications/Firefox.app
-
sudo tcpdump -i en0 -s 0 tcp port https -w ~/Desktop/capture.pcap
- Browse to desired HTTPS site in Firefox
Load SSL key log & packet capture files into Wireshark
- Wireshark.app → Preferences... → Protocols → TLS → (Pre)-Master-Secret log filename → Browse... → ~/Desktop/sklf → OK
- File → Open → ~/Desktop/capture.pcap → Open
Search & export text
- Edit → Find Packet... → change "Packet list" to "Packet details" and "Display filter" to "String" → enter desired search string into box labeled "Enter a display filter ..." → Find
- Right click highlighted result → Copy Bytes ...as Printable Text →
pbpaste
Notes
- Several methods, from verbose to concise, for identifying the network interface:
ifconfig
netstat -i
networksetup -listallhardwareports
for i in `ifconfig -l `; do echo $i; ifconfig $i | grep "inet " ; done
1
scutil --nwi
route get example.com | grep interface
2
Sources
/mac | Jan 03, 2022
Subscribe or visit the archives.