aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/ndpi_protocol_ids.h2
-rw-r--r--src/include/ndpi_protocols.h1
-rw-r--r--src/lib/ndpi_main.c9
-rw-r--r--src/lib/protocols/tocaboca.c90
4 files changed, 98 insertions, 4 deletions
diff --git a/src/include/ndpi_protocol_ids.h b/src/include/ndpi_protocol_ids.h
index f2d164850..918e567c7 100644
--- a/src/include/ndpi_protocol_ids.h
+++ b/src/include/ndpi_protocol_ids.h
@@ -183,7 +183,7 @@ typedef enum {
NDPI_PROTOCOL_GTP = 152,
NDPI_PROTOCOL_WSD = 153,
NDPI_PROTOCOL_LLMNR = 154,
- NDPI_PROTOCOL_FREE_155 = 155, /* FREE */
+ NDPI_PROTOCOL_TOCA_BOCA = 155,
NDPI_PROTOCOL_SPOTIFY = 156,
NDPI_PROTOCOL_MESSENGER = 157,
NDPI_PROTOCOL_H323 = 158,
diff --git a/src/include/ndpi_protocols.h b/src/include/ndpi_protocols.h
index 9338d5a71..e225ba04a 100644
--- a/src/include/ndpi_protocols.h
+++ b/src/include/ndpi_protocols.h
@@ -221,6 +221,7 @@ void init_z3950_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_in
void init_avast_securedns_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
void init_cassandra_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
void init_ethernet_ip_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
+void init_toca_boca_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
/* ndpi_main.c */
extern u_int32_t ndpi_ip_port_hash_funct(u_int32_t ip, u_int16_t port);
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c
index b0b98d4a4..2bd3c0a5a 100644
--- a/src/lib/ndpi_main.c
+++ b/src/lib/ndpi_main.c
@@ -1563,10 +1563,10 @@ static void ndpi_init_protocol_defaults(struct ndpi_detection_module_struct *ndp
"LLMNR", NDPI_PROTOCOL_CATEGORY_NETWORK,
ndpi_build_default_ports(ports_a, 5355, 0, 0, 0, 0) /* TCP */,
ndpi_build_default_ports(ports_b, 5355, 0, 0, 0, 0) /* UDP */); /* Missing dissector: port based only */
- ndpi_set_proto_defaults(ndpi_str, 1 /* cleartext */, NDPI_PROTOCOL_POTENTIALLY_DANGEROUS, NDPI_PROTOCOL_FREE_155,
- "FREE155", NDPI_PROTOCOL_CATEGORY_NETWORK,
+ ndpi_set_proto_defaults(ndpi_str, 1 /* cleartext */, NDPI_PROTOCOL_FUN, NDPI_PROTOCOL_TOCA_BOCA,
+ "TocaBoca", NDPI_PROTOCOL_CATEGORY_GAME,
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_build_default_ports(ports_b, 5055, 0, 0, 0, 0) /* UDP */);
ndpi_set_proto_defaults(ndpi_str, 1 /* cleartext */, NDPI_PROTOCOL_ACCEPTABLE, NDPI_PROTOCOL_H323,
"H323", NDPI_PROTOCOL_CATEGORY_VOIP,
ndpi_build_default_ports(ports_a, 1719, 1720, 0, 0, 0) /* TCP */,
@@ -4308,6 +4308,9 @@ static int ndpi_callback_init(struct ndpi_detection_module_struct *ndpi_str) {
/* WSD */
init_wsd_dissector(ndpi_str, &a, detection_bitmask);
+ /* TocaBoca */
+ init_toca_boca_dissector(ndpi_str, &a, detection_bitmask);
+
#ifdef CUSTOM_NDPI_PROTOCOLS
#include "../../../nDPI-custom/custom_ndpi_main_init.c"
#endif
diff --git a/src/lib/protocols/tocaboca.c b/src/lib/protocols/tocaboca.c
new file mode 100644
index 000000000..378f1b753
--- /dev/null
+++ b/src/lib/protocols/tocaboca.c
@@ -0,0 +1,90 @@
+/*
+ * tocaboca.c
+ *
+ * Copyright (C) 2011-22 - ntop.org
+ *
+ * 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_TOCA_BOCA
+
+#include "ndpi_api.h"
+
+static void ndpi_int_toca_boca_add_connection(struct ndpi_detection_module_struct * const ndpi_struct,
+ struct ndpi_flow_struct * const flow)
+{
+ NDPI_LOG_INFO(ndpi_struct, "found TocaBoca\n");
+ ndpi_set_detected_protocol(ndpi_struct, flow,
+ NDPI_PROTOCOL_TOCA_BOCA, NDPI_PROTOCOL_UNKNOWN, NDPI_CONFIDENCE_DPI);
+}
+
+void ndpi_search_toca_boca(struct ndpi_detection_module_struct *ndpi_struct,
+ struct ndpi_flow_struct *flow)
+{
+ struct ndpi_packet_struct *packet = &ndpi_struct->packet;
+ u_int32_t payload_len = packet->payload_packet_len;
+
+ NDPI_LOG_DBG(ndpi_struct, "search TocaBoca\n");
+
+ if (packet->udp != NULL)
+ {
+ if (payload_len >= 13
+ && get_u_int32_t(packet->payload, 0) == 0x7d7d7d7d
+ && get_u_int32_t(packet->payload, 4) == 0x7d7d7d7d)
+ {
+ ndpi_int_toca_boca_add_connection(ndpi_struct, flow);
+ return;
+ }
+
+ if (flow->packet_counter == 1
+ && payload_len >= 24
+ && ntohl(get_u_int32_t(packet->payload, 0)) == 0xffff0001
+ && ntohl(get_u_int32_t(packet->payload, 12)) == 0x02ff0104)
+ {
+ ndpi_int_toca_boca_add_connection(ndpi_struct, flow);
+ return;
+ }
+
+ if (payload_len >= 32
+ && (ntohs(get_u_int16_t(packet->payload, 2)) == 0x0001
+ || ntohs(get_u_int16_t(packet->payload, 2)) == 0x0002
+ || ntohs(get_u_int16_t(packet->payload, 2)) == 0x0003)
+ && (ntohl(get_u_int32_t(packet->payload, 12)) == 0x01ff0000
+ || ntohl(get_u_int32_t(packet->payload, 12)) == 0x01000000)
+ && ntohl(get_u_int32_t(packet->payload, 16)) == 0x00000014)
+ {
+ ndpi_int_toca_boca_add_connection(ndpi_struct, flow);
+ return;
+ }
+ }
+
+ NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
+}
+
+void init_toca_boca_dissector(struct ndpi_detection_module_struct *ndpi_struct,
+ u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
+{
+ ndpi_set_bitmask_protocol_detection("TocaBoca", ndpi_struct, detection_bitmask, *id,
+ NDPI_PROTOCOL_TOCA_BOCA,
+ ndpi_search_toca_boca,
+ NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_UDP_WITH_PAYLOAD,
+ SAVE_DETECTION_BITMASK_AS_UNKNOWN,
+ ADD_TO_DETECTION_BITMASK);
+
+ *id += 1;
+}
+