HTTP: improve detection of WindowsUpdate (#1658)

WindowsUpdate is also transported over HTTP, using a numeric IP as
hostname (some kinds of CDN?)
This commit is contained in:
Ivan Nardi
2022-07-10 17:08:37 +02:00
committed by GitHub
parent 1fcd03a6b6
commit df599e5eff
3 changed files with 22 additions and 0 deletions
+14
View File
@@ -848,6 +848,20 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_
}
}
if(packet->user_agent_line.ptr != NULL && packet->user_agent_line.len != 0 &&
flow->http.url) {
/* WindowsUpdate over some kind of CDN */
if(flow->detected_protocol_stack[1] == NDPI_PROTOCOL_UNKNOWN &&
flow->detected_protocol_stack[0] == NDPI_PROTOCOL_HTTP &&
(strstr(flow->http.url, "delivery.mp.microsoft.com/") ||
strstr(flow->http.url, "download.windowsupdate.com/")) &&
ndpi_strnstr((const char *)packet->user_agent_line.ptr, "Microsoft-Delivery-Optimization/",
packet->user_agent_line.len) &&
ndpi_isset_risk(ndpi_struct, flow, NDPI_HTTP_NUMERIC_IP_HOST)) {
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_WINDOWS_UPDATE, NDPI_PROTOCOL_HTTP, NDPI_CONFIDENCE_DPI);
}
}
if(ndpi_get_http_method(ndpi_struct, flow) != NDPI_HTTP_METHOD_UNKNOWN) {
ndpi_int_http_add_connection(ndpi_struct, flow, flow->detected_protocol_stack[0], NDPI_PROTOCOL_CATEGORY_WEB);
}