aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/ndpi_private.h1
-rw-r--r--src/include/ndpi_protocol_ids.h2
-rw-r--r--src/lib/ndpi_main.c7
-rw-r--r--src/lib/protocols/egd.c65
4 files changed, 72 insertions, 3 deletions
diff --git a/src/include/ndpi_private.h b/src/include/ndpi_private.h
index 65cdd9891..975f44510 100644
--- a/src/include/ndpi_private.h
+++ b/src/include/ndpi_private.h
@@ -917,6 +917,7 @@ void init_ldp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int3
void init_knxnet_ip_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id);
void init_bfcp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id);
void init_iqiyi_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id);
+void init_egd_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id);
#endif
diff --git a/src/include/ndpi_protocol_ids.h b/src/include/ndpi_protocol_ids.h
index 1a0ea5745..7dcee82f0 100644
--- a/src/include/ndpi_protocol_ids.h
+++ b/src/include/ndpi_protocol_ids.h
@@ -177,7 +177,7 @@ typedef enum {
NDPI_PROTOCOL_RADIUS = 146,
NDPI_PROTOCOL_WINDOWS_UPDATE = 147,
NDPI_PROTOCOL_TEAMVIEWER = 148,
- NDPI_PROTOCOL_FREE_149 = 149, /* FREE */
+ NDPI_PROTOCOL_EGD = 149,
NDPI_PROTOCOL_LOTUS_NOTES = 150,
NDPI_PROTOCOL_SAP = 151,
NDPI_PROTOCOL_GTP = 152,
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c
index 5278aa722..f15d0cb8f 100644
--- a/src/lib/ndpi_main.c
+++ b/src/lib/ndpi_main.c
@@ -2292,8 +2292,8 @@ static void ndpi_init_protocol_defaults(struct ndpi_detection_module_struct *ndp
"KNXnet_IP", NDPI_PROTOCOL_CATEGORY_IOT_SCADA,
ndpi_build_default_ports(ports_a, 3671, 0, 0, 0, 0) /* TCP */,
ndpi_build_default_ports(ports_b, 3671, 0, 0, 0, 0) /* UDP */);
- ndpi_set_proto_defaults(ndpi_str, 1 /* cleartext */, 0 /* nw proto */, NDPI_PROTOCOL_ACCEPTABLE, NDPI_PROTOCOL_FREE_149,
- "Free149", NDPI_PROTOCOL_CATEGORY_VOIP,
+ ndpi_set_proto_defaults(ndpi_str, 1 /* cleartext */, 0 /* nw proto */, NDPI_PROTOCOL_ACCEPTABLE, NDPI_PROTOCOL_EGD,
+ "EthernetGlobalData", 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 */);
ndpi_set_proto_defaults(ndpi_str, 1 /* cleartext */, 0 /* nw proto */, NDPI_PROTOCOL_ACCEPTABLE, NDPI_PROTOCOL_BFCP,
@@ -6220,6 +6220,9 @@ static int ndpi_callback_init(struct ndpi_detection_module_struct *ndpi_str) {
/* iQIYI */
init_iqiyi_dissector(ndpi_str, &a);
+ /* Ethernet Global Data */
+ init_egd_dissector(ndpi_str, &a);
+
#ifdef CUSTOM_NDPI_PROTOCOLS
#include "../../../nDPI-custom/custom_ndpi_main_init.c"
#endif
diff --git a/src/lib/protocols/egd.c b/src/lib/protocols/egd.c
new file mode 100644
index 000000000..e91ac4792
--- /dev/null
+++ b/src/lib/protocols/egd.c
@@ -0,0 +1,65 @@
+/*
+ * egd.c
+ *
+ * Ethernet Global Data
+ *
+ * Copyright (C) 2024 - ntop.org
+ * Copyright (C) 2024 - V.G <v.gavrilov@securitycode.ru>
+ *
+ * This file is part of nDPI, an open source deep packet inspection
+ * library based on the OpenDPI and PACE technology by ipoque GmbH
+ *
+ * nDPI is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * nDPI is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with nDPI. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ndpi_protocol_ids.h"
+
+#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_EGD
+
+#include "ndpi_api.h"
+#include "ndpi_private.h"
+
+static void ndpi_search_egd(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
+{
+ struct ndpi_packet_struct const * const packet = &ndpi_struct->packet;
+
+ NDPI_LOG_DBG(ndpi_struct, "search Ethernet Global Data\n");
+
+ if (packet->payload_packet_len > 32 && ntohs(get_u_int16_t(packet->payload, 0)) == 0x0D01)
+ {
+ if (get_u_int32_t(packet->payload, 4) == packet->iph->saddr && /* ProducerID */
+ ntohl(get_u_int32_t(packet->payload, 24)) < 31 && /* Status */
+ get_u_int32_t(packet->payload, 28) == 0) /* Reserved */
+ {
+ NDPI_LOG_INFO(ndpi_struct, "found Ethernet Global Data\n");
+ ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_EGD, NDPI_PROTOCOL_UNKNOWN, NDPI_CONFIDENCE_DPI);
+ return;
+ }
+ }
+
+ NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
+}
+
+void init_egd_dissector(struct ndpi_detection_module_struct *ndpi_struct,u_int32_t *id)
+{
+ ndpi_set_bitmask_protocol_detection("EthernetGlobalData", ndpi_struct, *id,
+ NDPI_PROTOCOL_EGD,
+ ndpi_search_egd,
+ NDPI_SELECTION_BITMASK_PROTOCOL_UDP_WITH_PAYLOAD,
+ SAVE_DETECTION_BITMASK_AS_UNKNOWN,
+ ADD_TO_DETECTION_BITMASK);
+
+ *id += 1;
+}