Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用 Chrome 的 SSLKEYLOGFILE 在 Wireshark 中解密 HTTPS 流量 #83

Open
luckyyyyy opened this issue Jan 3, 2025 · 0 comments
Open

Comments

@luckyyyyy
Copy link
Owner

luckyyyyy commented Jan 3, 2025

1. 设置 SSLKEYLOGFILE 环境变量

  • SSLKEYLOGFILE 环境变量,Chrome 会用它来记录 SSL/TLS 会话的密钥。
  • 或者使用启动参数--ssl-key-log-file

1.1 在 Windows 上设置

  1. 设置环境变量:

  2. 右键点击“此电脑”或“我的电脑”,选择“属性”。

  3. 点击“高级系统设置”。

  4. 在“系统属性”窗口中,点击“环境变量”。

  5. 在“系统变量”或“用户变量”部分,点击“新建”。

  6. 输入变量名 SSLKEYLOGFILE 和变量值 C:\path\to\sslkeylogfile.log

1.2 在 macOS/Linux 上设置

# 请注意要保证 chrome 已完全关闭 否则不会生效
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --ssl-key-log-file=/path/to/ssl-key-log-file.log

2. 配置 Wireshark 使用 SSLKEYLOGFILE

  1. 打开 Wireshark。
  2. 点击顶部菜单栏的 Edit,然后选择 Preferences
  3. 在左侧导航栏中,找到并展开 Protocols,然后选择 TLS
  4. 在右侧的 TLS 设置中,找到 (Pre)-Master-Secret log filename 这一项。
  5. 点击 Browse 按钮,选择你之前设置的 sslkeylogfile.log 文件。
  6. 点击 OK 保存设置。

3. 注意

  • 安全性sslkeylogfile.log 文件包含了 SSL/TLS 会话密钥,这些密钥非常敏感。请确保不要把这个文件分享给他人,或者在不安全的环境中保存。
  • 浏览器支持:除了 Chrome,其他基于 Chromium 的浏览器(比如 Microsoft Edge)也支持 SSLKEYLOGFILE
  • Wireshark 版本:确保你使用的 Wireshark 版本支持 TLS 解密功能(一般较新的版本都支持)。

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant