Improved WhatsAppVoice detection

This commit is contained in:
Luca Deri
2016-02-15 22:16:39 +01:00
parent e1481f3a90
commit 15ccb70ae6
9 changed files with 434 additions and 430 deletions
+1 -1
View File
@@ -3006,7 +3006,7 @@ void check_ndpi_udp_flow_func(struct ndpi_detection_module_struct *ndpi_struct,
}
for(a = 0; a < ndpi_struct->callback_buffer_size_udp; a++) {
if((func != ndpi_struct->callback_buffer_tcp_payload[a].func)
if((func != ndpi_struct->callback_buffer_udp[a].func)
&& (ndpi_struct->callback_buffer_udp[a].ndpi_selection_bitmask & *ndpi_selection_packet) ==
ndpi_struct->callback_buffer_udp[a].ndpi_selection_bitmask
&& NDPI_BITMASK_COMPARE(flow->excluded_protocol_bitmask,
+9 -7
View File
@@ -27,7 +27,7 @@
#ifdef NDPI_PROTOCOL_STUN
#define MAX_NUM_STUN_PKTS 6
#define MAX_NUM_STUN_PKTS 10
struct stun_packet_header {
@@ -55,8 +55,13 @@ static ndpi_int_stun_t ndpi_int_check_stun(struct ndpi_detection_module_struct *
u_int16_t msg_type, msg_len;
struct stun_packet_header *h = (struct stun_packet_header*)payload;
if(payload_length < sizeof(struct stun_packet_header))
return(NDPI_IS_NOT_STUN);
if(payload_length < sizeof(struct stun_packet_header)) {
if(flow->num_stun_udp_pkts > 0) {
*is_whatsapp = 1;
return NDPI_IS_STUN; /* This is WhatsApp Voice */
} else
return(NDPI_IS_NOT_STUN);
}
if((strncmp((const char*)payload, (const char*)"RSP/", 4) == 0)
&& (strncmp((const char*)&payload[7], (const char*)" STUN_", 6) == 0)) {
@@ -215,10 +220,7 @@ static ndpi_int_stun_t ndpi_int_check_stun(struct ndpi_detection_module_struct *
#endif
if(
((flow->num_stun_udp_pkts > 0) && (msg_type == 0x0800))
|| ((msg_type == 0x0800) && (msg_len == 106))
) {
if((flow->num_stun_udp_pkts > 0) && (msg_type <= 0x00FF)) {
*is_whatsapp = 1;
return NDPI_IS_STUN; /* This is WhatsApp Voice */
} else