Skip to content

Instantly share code, notes, and snippets.

@asd1245dss
Created October 11, 2017 08:40
Show Gist options
  • Save asd1245dss/3427f331cf4161174b879846fbcd5eda to your computer and use it in GitHub Desktop.
Save asd1245dss/3427f331cf4161174b879846fbcd5eda to your computer and use it in GitHub Desktop.
详细描述mysql handshake数据包的信息
4e 00 00 // 数据长度,3字节,0x4e = 79字节
00 // 序号,1字节
# 具体内容
0a // 协议,1字节,0x0A = 10,表示第10版协议
35 2e 37 2e 31 38 2d 6c 6f 67 00 // MySQL版本信息,5.7.18-log,以\0结尾
12 7a 29 00 // 连接ID,四字节
33 58 38 18 44 5e 16 48 // 加密串的前半部分,定长8字节,为了兼容旧版本协议
00 // 固定填充0
ff ff // MySQL服务器的属性,2字节,低16位
21 // 字符集
02 00 // MySQL服务器状态,2字节
ff c1 // MySQL服务器的属性,2字节,高16位
15 // 加密串长度,0x15 = 21,前半部分 8 + 后半部分 12 + '\0'结束符 = 21
00 00 00 00 00 00 00 00 00 00 // 保留字段,10字节
40 79 11 30 2a 41 61 55 64 77 6e 0d 00 // 加密串的后半部分,定长12字节,以\0结尾
6d 79 73 71 6c 5f 6e 61 74 69 76 65 5f 70 61 73 73 77 6f 72 64 // mysql_native_password,认证采用mysql_native_password插件,老版本采用mysql_old_password
00 // 当前响应包的结束符,\0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment