Add Schneider Electric’s UMAS detection support (#2180)

* Add Schneider Electric’s UMAS detection support

* Swap proto IDs in ndpi_set_detected_protocol

* Update unit test result
This commit is contained in:
Vladimir Gavrilov
2023-11-28 18:03:00 +01:00
committed by GitHub
parent 688a197b85
commit c60c03766c
9 changed files with 62 additions and 13 deletions
+1
View File
@@ -392,6 +392,7 @@ typedef enum {
NDPI_PROTOCOL_S7COMM_PLUS = 361,
NDPI_PROTOCOL_FINS = 362,
NDPI_PROTOCOL_ETHERSIO = 363,
NDPI_PROTOCOL_UMAS = 364,
#ifdef CUSTOM_NDPI_PROTOCOLS
#include "../../../nDPI-custom/custom_ndpi_protocol_ids.h"
+4
View File
@@ -2154,6 +2154,10 @@ static void ndpi_init_protocol_defaults(struct ndpi_detection_module_struct *ndp
"EtherSIO", NDPI_PROTOCOL_CATEGORY_IOT_SCADA,
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
ndpi_build_default_ports(ports_b, 6060, 0, 0, 0, 0) /* UDP */);
ndpi_set_proto_defaults(ndpi_str, 1 /* cleartext */, 0 /* nw proto */, NDPI_PROTOCOL_ACCEPTABLE, NDPI_PROTOCOL_UMAS,
"UMAS", NDPI_PROTOCOL_CATEGORY_IOT_SCADA,
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
#ifdef CUSTOM_NDPI_PROTOCOLS
#include "../../../nDPI-custom/custom_ndpi_main.c"
+10 -3
View File
@@ -47,9 +47,16 @@ static void ndpi_search_modbus_tcp(struct ndpi_detection_module_struct *ndpi_str
// the fourth parameter of the payload is the length of the segment
if((modbus_len-1) == (packet->payload_packet_len - 7 /* ModbusTCP header len */)) {
NDPI_LOG_INFO(ndpi_struct, "found MODBUS\n");
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MODBUS, NDPI_PROTOCOL_UNKNOWN, NDPI_CONFIDENCE_DPI);
return;
/* Check Modbus function code. 0x5A (90) is reserved for UMAS protocol */
if (packet->payload[7] == 0x5A) {
NDPI_LOG_INFO(ndpi_struct, "found Schneider Electric UMAS\n");
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_UMAS, NDPI_PROTOCOL_MODBUS, NDPI_CONFIDENCE_DPI);
return;
}
NDPI_LOG_INFO(ndpi_struct, "found MODBUS\n");
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MODBUS, NDPI_PROTOCOL_UNKNOWN, NDPI_CONFIDENCE_DPI);
return;
}
}
}