我需要检测网络流量中的 https 数据包。到目前为止,我将所有“443”标记为 https,但我不想再在这种情况下使用端口信息。
检查客户端问候消息是否足够:
//Check 22 and version info 0300 0301 or 0302
if (packet->payload[0] == 0x16 && packet->payload[1] == 0x03
&& (packet->payload[2] == 0x00 || packet->payload[2] == 0x01 || packet->payload[2] == 0x02)
{
int temp = ntohs(get_u16(packet->payload, 3)) + 5;//Get lenght
//Check lenght is valid and 6th byte is client hello(which is 1)
if (temp < packet->payload_length && temp > 50 && packet->payload[5]) == 1)
MARK AS HTTPS
}
由于我的项目设计,我不能检查多个数据包。你能告诉我像上面这样检查客户你好是否可以?