Wireshark抓https数据包

Wireshark抓https数据包

使用wireshark抓https数据包大概有两种方式。

  1. 设置SSLKEYLOGFILE环境变量,记录SSL密钥信息,利用密钥进行解密
  2. 使用SSL私钥解密

本文主要记录第二中方式。这种方式需要有证书的私钥,即nginx配置中的ssl_certificate_key

还需要修改nginx配置文件,指定加密方式。

示例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
server {
listen 443 ssl;
server_name zhighest.com www.zhighest.com;
ssl_certificate full_chain.pem;
ssl_certificate_key private.key;
ssl_protocols TLSv1.2;
ssl_ciphers AES128-GCM-SHA256; <-------

ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_prefer_server_ciphers on;

location / {
root html;
index index.html index.htm;
}

}

Wireshark配置:

image-20220408112407574

抓包截图:

image-20220408112256796

参考链接

使用wireshark私钥方式解密https流量

https://wiki.wireshark.org/TLS