1、客户端的Client Hello开始
发送此消息的时间:
当客户端首次连接到服务器时,它必须发送ClientHello作为其第一条消息。客户端还可以响应HelloRequest消息或主动发送ClientHello消息以重新协商现有连接中的安全参数。
记录层 | 1字节 | 2字节 | 3字节 | 4字节 | 5字节 |
Content Type: Handshake | Version: TLS 1.2 | Length | |||
0x22 | 0x0303 | --- | |||
握手层 | Handshake Type: Client Hello | Length | Version: TLS 1.2 | ||
0x01 | 0x0303 | ||||
Version: TLS 1.2 | Random: (GMT Unix Time: Jun 26, 2024 11:04:47.000000000 中国标准时间) | ||||
0x0303 | |||||
Random: (Random Bytes) | |||||
Random: (Random Bytes) | |||||
Random: (Random Bytes) | |||||
Random: (Random Bytes) | |||||
Random: (Random Bytes) | |||||
Random: (Random Bytes) | Session ID Length: 0 | ||||
接着上面就是密钥,压缩算法
Cipher Suites Length: 208Cipher Suites Length: 208(密钥长度) | Cipher Suites (104 suites)(密钥) |
Compression Methods Length: 1(压缩算法长度) | Compression Methods (1 method)(压缩算法) |
Extensions Length: 80(扩展长度) | Extensions (扩展) |
接下来我们用python进行组包
from scapy.all import *
from scapy.layers.tls.all import *
from scapy.layers.inet import *
tls_ClientHello =TLS(type=22,version=0x0303,msg=TLSClientHello(version="TLS 1.2"))
tls_ClientHello.show()
sip = Ether() / IP(src=ip, dst=ip) / TCP(sport=port,
dport=port)/tls_ClientHello
sendp(sip)
print(sip.