2
我需要檢測網絡通信中的https數據包。到目前爲止,我將所有的「443」標記爲https,但我不想再爲這種情況使用端口信息。使用客戶端hello消息檢測TLS協議
是否足夠?檢查像客戶端hello消息:因爲我的項目設計的
//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
}
,我無法檢查多個數據包。你可以請建議,如果只是檢查客戶你好像上面是好還是不好?
感謝您對「包」的糾正,我會注意到這一點。我在重新組合段後檢查(例如重新組裝客戶端hello)。但下一條消息(例如「server hello」)將位於另一個數據包中。由於我的設計,我將無法檢查有效負載兩次或更多次。 – 2013-04-24 14:24:48