创建 keylogfile

mkdir ~/sslkeylogfile && touch ~/sslkeylogfile/keylogfile.log # 创建 keylogfile.log 文件
sudo chmod 777 ~/sslkeylogfile/keylogfile.log # 更改权限,确保 chrome 启动时能写入数据

配置环境变量

vim ~/.zshrc # 打开配置文件
export SSLKEYLOGFILE=~/sslkeylogfile/keylogfile.log # 配置环境变量
source ~/.zshrc # 使配置文件生效

配置 wireshark

perferences -> Protocols -> TLS

  • 配置 TSL debug file 记录解密日志
  • 配置 (Pre)-Master-Secret log filename 路径为 keylogfile.log 的绝对路径

使用 termial 启动 chrome

open -a 'Google Chrome' https://www.baidu.com/

注意:从 termial 启动 chrome,为了确保 chrome 可以读取 SSLKEYLOGFILE 环境变量。