Improved google duo detection

This commit is contained in:
Luca
2019-08-12 11:59:57 +02:00
parent e226f99e4e
commit 51ac583d83
+26 -2
View File
@@ -30,7 +30,7 @@
#define MAX_NUM_STUN_PKTS 8 #define MAX_NUM_STUN_PKTS 8
/* #define DEBUG_STUN 1 */ /* #define DEBUG_STUN 1 */
struct stun_packet_header { struct stun_packet_header {
u_int16_t msg_type, msg_len; u_int16_t msg_type, msg_len;
@@ -214,6 +214,28 @@ static ndpi_int_stun_t ndpi_int_check_stun(struct ndpi_detection_module_struct *
/* These are the only messages apparently whatsapp voice can use */ /* These are the only messages apparently whatsapp voice can use */
break; break;
case 0x0014: /* Realm */
{
u_int16_t realm_len = ntohs(*((u_int16_t*)&payload[offset+2]));
if(flow->host_server_name[0] == '\0') {
u_int j, i = (realm_len > sizeof(flow->host_server_name)) ? sizeof(flow->host_server_name) : realm_len;
u_int k = offset+4;
memset(flow->host_server_name, 0, sizeof(flow->host_server_name));
for(j=0; j<i; j++)
flow->host_server_name[j] = payload[k++];
if(strstr((char*)flow->host_server_name, "google.com") != NULL) {
*is_duo = 1;
flow->guessed_protocol_id = NDPI_PROTOCOL_HANGOUT_DUO;
return(NDPI_IS_STUN);
}
}
}
break;
case 0xC057: /* Messeger */ case 0xC057: /* Messeger */
if(msg_type == 0x0001) { if(msg_type == 0x0001) {
if((msg_len == 100) || (msg_len == 104)) { if((msg_len == 100) || (msg_len == 104)) {
@@ -221,8 +243,10 @@ static ndpi_int_stun_t ndpi_int_check_stun(struct ndpi_detection_module_struct *
return(NDPI_IS_STUN); return(NDPI_IS_STUN);
} else if(msg_len == 76) { } else if(msg_len == 76) {
*is_duo = 1; *is_duo = 1;
if(1) { if(1) {
flow->guessed_protocol_id = NDPI_PROTOCOL_HANGOUT_DUO; flow->guessed_host_protocol_id = NDPI_PROTOCOL_HANGOUT_DUO;
flow->guessed_protocol_id = NDPI_PROTOCOL_STUN;
return(NDPI_IS_NOT_STUN); /* This case is found also with signal traffic */ return(NDPI_IS_NOT_STUN); /* This case is found also with signal traffic */
} else } else
return(NDPI_IS_STUN); return(NDPI_IS_STUN);