FIX missing Application Data pkt for TLS

This commit is contained in:
kyrol
2018-11-09 14:52:32 +01:00
parent 875b1e0dd5
commit de9b2b202e
+14 -6
View File
@@ -512,13 +512,10 @@ static u_int8_t ndpi_search_sslv3_direction1(struct ndpi_detection_module_struct
struct ndpi_packet_struct *packet = &flow->packet; struct ndpi_packet_struct *packet = &flow->packet;
if((packet->payload_packet_len >= 5) if((packet->payload_packet_len >= 5)
&& (packet->payload[0] == 0x16) && ((packet->payload[0] == 0x16) || packet->payload[0] == 0x17)
&& (packet->payload[1] == 0x03) && (packet->payload[1] == 0x03)
&& ((packet->payload[2] == 0x00) && ((packet->payload[2] == 0x00) || (packet->payload[2] == 0x01) ||
|| (packet->payload[2] == 0x01) (packet->payload[2] == 0x02) || (packet->payload[2] == 0x03))) {
|| (packet->payload[2] == 0x02)
|| (packet->payload[2] == 0x03)
)) {
u_int32_t temp; u_int32_t temp;
NDPI_LOG_DBG2(ndpi_struct, "search sslv3\n"); NDPI_LOG_DBG2(ndpi_struct, "search sslv3\n");
// SSLv3 Record // SSLv3 Record
@@ -680,6 +677,17 @@ void ndpi_search_ssl_tcp(struct ndpi_detection_module_struct *ndpi_struct, struc
flow->l4.tcp.ssl_stage = 1 + packet->packet_direction; flow->l4.tcp.ssl_stage = 1 + packet->packet_direction;
return; return;
} }
// Application Data pkt
if(packet->payload[0] == 0x17 && packet->payload[1] == 0x03
&& (packet->payload[2] == 0x00 || packet->payload[2] == 0x01 ||
packet->payload[2] == 0x02 || packet->payload[2] == 0x03)) {
if(packet->payload_packet_len - ntohs(get_u_int16_t(packet->payload, 3)) == 5) {
NDPI_LOG_DBG2(ndpi_struct, "TLS len match\n");
flow->l4.tcp.ssl_stage = 1 + packet->packet_direction;
return;
}
}
} }
if(packet->payload_packet_len > 40 && if(packet->payload_packet_len > 40 &&