标签:打开 http shark export pre EDA file avg 解密
概述在复杂的网络环境中,需要通过抓包来排查网络问题,但是有时候 https 的包是 tls 加密,无法看到真实它在做什么, 需要对其进行解密。
export SSLKEYLOGFILE=~/Downloads/ssl.key
发送 https 请求
curl https://baidu.com
<html>
<head><title>302 Found</title></head>
<body bgcolor="white">
<center><h1>302 Found</h1></center>
<hr><center>bfe/1.0.8.18</center>
</body>
</html>
查看 ssl.key 是否有交换 key
cat ~/Downloads/sslkey.log
CLIENT_RANDOM E358B7ECDEDA7FEC4684942DC6395CFFB34B72918CAFACD69AA06713BB25240D F3934E92E3B1562B13CBA7C8613E7DDCE23A46F68B2B489604C99B65628833738230970A6A2940AA55F600AA06E4874E
有交换 key 说明成功,如果没有交换的 key 信息,那就说明使用的 https 的应用程序(客户端)不支持捕捉 SSLKEYLOGFILE
环境变量输出交换的 key 信息,建议换客户端或查询资料排查。
$ ping baidu.com -t 1
PING baidu.com (220.181.38.148): 56 data bytes
64 bytes from 220.181.38.148: icmp_seq=0 ttl=49 time=6.459 ms
--- baidu.com ping statistics ---
2 packets transmitted, 1 packets received, 50.0% packet loss
round-trip min/avg/max/stddev = 6.459/6.459/6.459/0.000 ms
在其他终端执行
sudo tcpdump -i any host 220.181.38.148 -w https_baidu.cap -vv
Password:
tcpdump: data link type PKTAP
tcpdump: listening on any, link-type PKTAP (Apple DLT_PKTAP), capture size 262144 bytes
54 packets captured
1027 packets received by filter
0 packets dropped by kernel
发送两次请求
export SSLKEYLOGFILE=~/Downloads/ssl.key
$ curl https://baidu.com
<html>
<head><title>302 Found</title></head>
<body bgcolor="white">
<center><h1>302 Found</h1></center>
<hr><center>bfe/1.0.8.18</center>
</body>
</html>
$ curl https://baidu.com
<html>
<head><title>302 Found</title></head>
<body bgcolor="white">
<center><h1>302 Found</h1></center>
<hr><center>bfe/1.0.8.18</center>
</body>
</html>
发现大量的 tls 协议包, 无法知道做了什么请求
标签:打开 http shark export pre EDA file avg 解密
原文地址:https://blog.51cto.com/conny/2553056