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:
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user