Improved heuristics

Used the host guessed protocol if upper protocol has not been detected
This commit is contained in:
Luca
2018-11-29 08:44:41 +01:00
parent 622519e90e
commit c09284ba27
22 changed files with 378 additions and 380 deletions
+1 -3
View File
@@ -118,8 +118,6 @@ static ndpi_network host_protocol_list[] = {
{ 0x67071E25 /* 103.7.30.37/32 */, 32, NDPI_PROTOCOL_WECHAT },
{ 0XCBCDB000 /* 203.205.176.0/20 */, 20, NDPI_PROTOCOL_WECHAT },
{ 0XCBCDC000 /* 203.205.192.0/18 */, 18, NDPI_PROTOCOL_WECHAT },
/*
OpenDNS, LLC
@@ -814,7 +812,7 @@ static ndpi_network host_protocol_list[] = {
/*
Canonical Ltd (Ubuntu)
origin AS41231
origin AS41231z
*/
{ 0x5BBD5800 /* 91.189.88.0/21 */, 21, NDPI_PROTOCOL_UBUNTUONE },
+9
View File
@@ -5179,6 +5179,15 @@ void ndpi_int_change_protocol(struct ndpi_detection_module_struct *ndpi_struct,
if(upper_detected_protocol == lower_detected_protocol)
lower_detected_protocol = NDPI_PROTOCOL_UNKNOWN;
if((upper_detected_protocol != NDPI_PROTOCOL_UNKNOWN)
&& (lower_detected_protocol == NDPI_PROTOCOL_UNKNOWN)) {
if((flow->guessed_host_protocol_id != NDPI_PROTOCOL_UNKNOWN)
&& (upper_detected_protocol != flow->guessed_host_protocol_id)) {
lower_detected_protocol = upper_detected_protocol;
upper_detected_protocol = flow->guessed_host_protocol_id;
}
}
ndpi_int_change_flow_protocol(ndpi_struct, flow,
upper_detected_protocol, lower_detected_protocol);
ndpi_int_change_packet_protocol(ndpi_struct, flow,
+4 -1
View File
@@ -72,7 +72,10 @@ static void ndpi_check_skype(struct ndpi_detection_module_struct *ndpi_struct, s
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
return;
// TCP check
} else if(packet->tcp != NULL) {
} else if((packet->tcp != NULL)
/* As the TCP skype heuristic is weak, we need to make sure no other protocols overlap */
&& (flow->guessed_host_protocol_id == NDPI_PROTOCOL_UNKNOWN)
&& (flow->guessed_protocol_id == NDPI_PROTOCOL_UNKNOWN)) {
flow->l4.tcp.skype_packet_id++;
if(flow->l4.tcp.skype_packet_id < 3) {