diff options
author | Luca Deri <lucaderi@users.noreply.github.com> | 2019-09-26 19:37:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-26 19:37:49 +0200 |
commit | ce40155377fe7211da546c76de42d3c8024032b9 (patch) | |
tree | 51bc5a093196526f331f326dc69dad7575f451c2 /src | |
parent | 4dc60f151d39efda0be794cfedbc326961c1ae4d (diff) | |
parent | 4170eb3a1de350b100946239eaad7d4358d7ee1c (diff) |
Merge pull request #783 from ntop/ndpi_ps_vue
Ndpi ps vue
Diffstat (limited to 'src')
-rw-r--r-- | src/include/ndpi_protocol_ids.h | 4 | ||||
-rw-r--r-- | src/include/ndpi_protocols.h | 2 | ||||
-rw-r--r-- | src/lib/ndpi_content_match.c.inc | 90 | ||||
-rw-r--r-- | src/lib/ndpi_main.c | 14 | ||||
-rw-r--r-- | src/lib/protocols/ps_vue.c | 92 | ||||
-rw-r--r-- | src/lib/protocols/zoom.c | 130 |
6 files changed, 325 insertions, 7 deletions
diff --git a/src/include/ndpi_protocol_ids.h b/src/include/ndpi_protocol_ids.h index c22c6f815..77b244bca 100644 --- a/src/include/ndpi_protocol_ids.h +++ b/src/include/ndpi_protocol_ids.h @@ -98,7 +98,7 @@ typedef enum { NDPI_PROTOCOL_QQLIVE = 61, NDPI_PROTOCOL_THUNDER = 62, NDPI_PROTOCOL_SOULSEEK = 63, - NDPI_PROTOCOL_FREE_64 = 64, + NDPI_PROTOCOL_PS_VUE = 64, NDPI_PROTOCOL_IRC = 65, NDPI_PROTOCOL_AYIYA = 66, NDPI_PROTOCOL_UNENCRYPTED_JABBER = 67, @@ -223,7 +223,7 @@ typedef enum { NDPI_PROTOCOL_VEVO = 186, NDPI_PROTOCOL_PANDORA = 187, NDPI_PROTOCOL_QUIC = 188, /* Andrea Buscarinu <andrea.buscarinu@gmail.com> - Michele Campus <michelecampus5@gmail.com> */ - NDPI_PROTOCOL_FREE_189 = 189, + NDPI_PROTOCOL_ZOOM = 189, /* Zoom video conference. */ NDPI_PROTOCOL_EAQ = 190, NDPI_PROTOCOL_OOKLA = 191, NDPI_PROTOCOL_AMQP = 192, diff --git a/src/include/ndpi_protocols.h b/src/include/ndpi_protocols.h index 5091b458d..74ac55e38 100644 --- a/src/include/ndpi_protocols.h +++ b/src/include/ndpi_protocols.h @@ -372,5 +372,7 @@ void init_modbus_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_i void init_line_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask); void init_wireguard_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask); void init_targus_getdata_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask); +void init_zoom_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask); +void init_ps_vue_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask); #endif /* __NDPI_PROTOCOLS_H__ */ diff --git a/src/lib/ndpi_content_match.c.inc b/src/lib/ndpi_content_match.c.inc index 1693db9fd..46d032ac2 100644 --- a/src/lib/ndpi_content_match.c.inc +++ b/src/lib/ndpi_content_match.c.inc @@ -8220,6 +8220,92 @@ static ndpi_network host_protocol_list[] = { /* Line */ { 0x7DD1FC00 /* 125.209.252.0/24 */, 24, NDPI_PROTOCOL_LINE }, + /* Zoom video conference app. */ + { 0x03501480 /* 3.80.20.128/25 */, 25, NDPI_PROTOCOL_ZOOM }, + { 0x03787900 /* 3.120.121.0/25 */, 25, NDPI_PROTOCOL_ZOOM }, + { 0x03682280 /* 3.104.34.128/25 */, 25, NDPI_PROTOCOL_ZOOM }, + { 0x03D04800 /* 3.208.72.0/25 */, 25, NDPI_PROTOCOL_ZOOM }, + { 0x03D3F100 /* 3.211.241.0/25 */, 25, NDPI_PROTOCOL_ZOOM }, + { 0x04227D80 /* 4.34.125.128/25 */, 25, NDPI_PROTOCOL_ZOOM }, + { 0x04234080 /* 4.35.64.128/25 */, 25, NDPI_PROTOCOL_ZOOM }, + { 0x08058000 /* 8.5.128.0/23 */, 25, NDPI_PROTOCOL_ZOOM }, + { 0x0D340680 /* 13.52.6.128/25 */, 25, NDPI_PROTOCOL_ZOOM }, + { 0x0D349200 /* 13.52.146.0/25 */, 25, NDPI_PROTOCOL_ZOOM }, + { 0x0D726AA6 /* 13.114.106.166/32 */, 32, NDPI_PROTOCOL_ZOOM }, + { 0x12CD5D80 /* 18.205.93.128/25 */, 25, NDPI_PROTOCOL_ZOOM }, + { 0x32EFCA00 /* 50.239.202.0/23 */, 25, NDPI_PROTOCOL_ZOOM }, + { 0x32EFCC00 /* 50.239.204.0/24 */, 24, NDPI_PROTOCOL_ZOOM }, + { 0x343D6480 /* 52.61.100.128/25 */, 25, NDPI_PROTOCOL_ZOOM }, + { 0x34519780 /* 52.81.151.128/25 */, 25, NDPI_PROTOCOL_ZOOM }, + { 0x34C56115 /* 52.197.97.21/32 */, 32, NDPI_PROTOCOL_ZOOM }, + { 0x34CA3EC0 /* 52.202.62.192/26 */, 26, NDPI_PROTOCOL_ZOOM }, + { 0x34D7A800 /* 52.215.168.0/25 */, 25, NDPI_PROTOCOL_ZOOM }, + { 0x40454A00 /* 64.69.74.0/24 */, 24, NDPI_PROTOCOL_ZOOM }, + { 0x407D3E00 /* 64.125.62.0/24 */, 24, NDPI_PROTOCOL_ZOOM }, + { 0x40D39000 /* 64.211.144.0/24 */, 24, NDPI_PROTOCOL_ZOOM }, + { 0x41279800 /* 65.39.152.0/24 */, 24, NDPI_PROTOCOL_ZOOM }, + { 0x45AE3900 /* 69.174.57.0/24 */, 24, NDPI_PROTOCOL_ZOOM }, + { 0x45AE6C00 /* 69.174.108.0/22 */, 22, NDPI_PROTOCOL_ZOOM }, + { 0x634F1400 /* 99.79.20.0/25 */, 25, NDPI_PROTOCOL_ZOOM }, + { 0x677AA600 /* 103.122.166.0/23 */, 23, NDPI_PROTOCOL_ZOOM }, + { 0x6D5EA000 /* 109.94.160.0/24 */, 24, NDPI_PROTOCOL_ZOOM }, + { 0x736E9AC0 /* 115.110.154.192/26 */, 26, NDPI_PROTOCOL_ZOOM }, + { 0x737238C0 /* 115.114.56.192/26 */, 26, NDPI_PROTOCOL_ZOOM }, + { 0x73727300 /* 115.114.115.0/26 */, 26, NDPI_PROTOCOL_ZOOM }, + { 0x73728300 /* 115.114.131.0/26 */, 26, NDPI_PROTOCOL_ZOOM }, + { 0x781D9400 /* 120.29.148.0/24 */, 24, NDPI_PROTOCOL_ZOOM }, + { 0xA0013880 /* 160.1.56.128/25 */, 25, NDPI_PROTOCOL_ZOOM }, + { 0xA1C78800 /* 161.199.136.0/22 */, 22, NDPI_PROTOCOL_ZOOM }, + { 0xA20CE800 /* 162.12.232.0/22 */, 22, NDPI_PROTOCOL_ZOOM }, + { 0xA2FF2400 /* 162.255.36.0/22 */, 22, NDPI_PROTOCOL_ZOOM }, + { 0xA5FE5800 /* 165.254.88.0/23 */, 23, NDPI_PROTOCOL_ZOOM }, + { 0xC0CC0C00 /* 192.204.12.0/22 */, 22, NDPI_PROTOCOL_ZOOM }, + { 0xCAB1CF80 /* 202.177.207.128/27 */, 27, NDPI_PROTOCOL_ZOOM }, + { 0xCAB1D560 /* 202.177.213.96/27 */, 27, NDPI_PROTOCOL_ZOOM }, + { 0xCC506800 /* 204.80.104.0/21 */, 21, NDPI_PROTOCOL_ZOOM }, + { 0xCC8D1C00 /* 204.141.28.0/22 */, 22, NDPI_PROTOCOL_ZOOM }, + { 0xCFE28400 /* 207.226.132.0/24 */, 24, NDPI_PROTOCOL_ZOOM }, + { 0xD109D300 /* 209.9.211.0/24 */, 24, NDPI_PROTOCOL_ZOOM }, + { 0xD109D700 /* 209.9.215.0/24 */, 24, NDPI_PROTOCOL_ZOOM }, + { 0xD2393700 /* 210.57.55.0/24 */, 24, NDPI_PROTOCOL_ZOOM }, + { 0xD5139000 /* 213.19.144.0/24 */, 24, NDPI_PROTOCOL_ZOOM }, + { 0xD5139900 /* 213.19.153.0/24 */, 24, NDPI_PROTOCOL_ZOOM }, + { 0xD5F48C00 /* 213.244.140.0/24 */, 24, NDPI_PROTOCOL_ZOOM }, + { 0xDD7A5840 /* 221.122.88.64/27 */, 27, NDPI_PROTOCOL_ZOOM }, + { 0xDD7A5880 /* 221.122.88.128/25 */, 25, NDPI_PROTOCOL_ZOOM }, + { 0xDD7A5980 /* 221.122.89.128/25 */, 25, NDPI_PROTOCOL_ZOOM }, + /* 2620:123:2000::/44 IPV6 */ + + { 0x08F8DA14 /* 8.248.218.20/32 */, 32, NDPI_PROTOCOL_PS_VUE }, + { 0x08FA6E14 /* 8.250.110.20/32 */, 32, NDPI_PROTOCOL_PS_VUE }, + { 0x08FC028B /* 8.252.2.139/32 */, 32, NDPI_PROTOCOL_PS_VUE }, + { 0x08FD6803 /* 8.253.104.3/32 */, 32, NDPI_PROTOCOL_PS_VUE }, + { 0x08FE6813 /* 8.253.104.19/32 */, 32, NDPI_PROTOCOL_PS_VUE }, + { 0x08FE8C0F /* 8.253.140.15/32 */, 32, NDPI_PROTOCOL_PS_VUE }, + { 0x08FE8C10 /* 8.253.140.16/32 */, 32, NDPI_PROTOCOL_PS_VUE }, + { 0x08FE8C77 /* 8.253.140.119/32 */, 32, NDPI_PROTOCOL_PS_VUE }, + { 0x08FC8CA8 /* 8.253.140.168/32 */, 32, NDPI_PROTOCOL_PS_VUE }, + { 0x08FC8CA9 /* 8.253.140.169/32 */, 32, NDPI_PROTOCOL_PS_VUE }, + { 0x4318881E /* 67.24.136.30/32*/, 32, NDPI_PROTOCOL_PS_VUE }, + { 0x431889FE /* 67.24.137.254/32*/, 32, NDPI_PROTOCOL_PS_VUE }, + { 0x43188DFE /* 67.24.141.254/32*/, 32, NDPI_PROTOCOL_PS_VUE }, + { 0x43188E1E /* 67.24.142.30/32*/, 32, NDPI_PROTOCOL_PS_VUE }, + { 0x4318901E /* 67.24.144.30/32*/, 32, NDPI_PROTOCOL_PS_VUE }, + { 0x4318921E /* 67.24.146.30/32*/, 32, NDPI_PROTOCOL_PS_VUE }, + { 0x43189630 /* 67.24.150.30/32*/, 32, NDPI_PROTOCOL_PS_VUE }, + { 0xA2D83A20 /* 162.216.58.32/32*/, 32, NDPI_PROTOCOL_PS_VUE }, + { 0xA2D83A2B /* 162.216.58.43/32*/, 32, NDPI_PROTOCOL_PS_VUE }, + { 0xA2D83A39 /* 162.216.58.57/32*/, 32, NDPI_PROTOCOL_PS_VUE }, + { 0xA2D83A40 /* 162.216.58.64/32*/, 32, NDPI_PROTOCOL_PS_VUE }, + { 0xA2D83A48 /* 162.216.58.72/32*/, 32, NDPI_PROTOCOL_PS_VUE }, + { 0xA2D83A51 /* 162.216.58.81/32*/, 32, NDPI_PROTOCOL_PS_VUE }, + { 0xA7CE74AA /* 167.206.116.170/32*/, 32, NDPI_PROTOCOL_PS_VUE }, + { 0xA7CEDA60 /* 167.206.218.96/32*/, 32, NDPI_PROTOCOL_PS_VUE }, + { 0xA7CEDA72 /* 167.206.218.114/32*/, 32, NDPI_PROTOCOL_PS_VUE }, + { 0xA7CEDA7B /* 167.206.218.123/32*/, 32, NDPI_PROTOCOL_PS_VUE }, + { 0xA7CEDA82 /* 167.206.218.130/32*/, 32, NDPI_PROTOCOL_PS_VUE }, + { 0xA7CEDA8A /* 167.206.218.138/32*/, 32, NDPI_PROTOCOL_PS_VUE }, + { 0x0, 0, 0 } }; @@ -8593,7 +8679,9 @@ ndpi_protocol_match host_match[] = { { "hotspotshield.com", NULL, "hotspotshield" TLD, "HotspotShield", NDPI_PROTOCOL_HOTSPOT_SHIELD, NDPI_PROTOCOL_CATEGORY_VPN, NDPI_PROTOCOL_POTENTIALLY_DANGEROUS }, { ".northghost.com", NULL, "\\.northghost" TLD, "HotspotShield", NDPI_PROTOCOL_HOTSPOT_SHIELD, NDPI_PROTOCOL_CATEGORY_VPN, NDPI_PROTOCOL_POTENTIALLY_DANGEROUS }, - { ".webex.com", NULL, "\\.webex" TLD, "Webex", NDPI_PROTOCOL_WEBEX, NDPI_PROTOCOL_CATEGORY_VOIP, NDPI_PROTOCOL_ACCEPTABLE }, + { ".webex.com", NULL, "\\.webex" TLD, "Webex", NDPI_PROTOCOL_WEBEX, NDPI_PROTOCOL_CATEGORY_VOIP, NDPI_PROTOCOL_ACCEPTABLE }, + { ".zoom.us", NULL, "\\.zoom" TLD, "Zoom", NDPI_PROTOCOL_ZOOM, NDPI_PROTOCOL_CATEGORY_VIDEO, NDPI_PROTOCOL_ACCEPTABLE }, + { ".cloudfront.net", NULL, "\\.cloudfront" TLD, "Zoom", NDPI_PROTOCOL_ZOOM, NDPI_PROTOCOL_CATEGORY_VIDEO, NDPI_PROTOCOL_ACCEPTABLE }, { ".ocsdomain.com", NULL, "\\.ocsdomain" TLD, "OCS", NDPI_PROTOCOL_OCS, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "ocs.fr", NULL, "ocs" TLD, "OCS", NDPI_PROTOCOL_OCS, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index 56031e299..48404fcfd 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -1122,9 +1122,9 @@ static void ndpi_init_protocol_defaults(struct ndpi_detection_module_struct *ndp 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_mod, NDPI_PROTOCOL_FUN, NDPI_PROTOCOL_FREE_64, + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_ACCEPTABLE, NDPI_PROTOCOL_PS_VUE, 0 /* can_have_a_subprotocol */, no_master, - no_master, "Free64", NDPI_PROTOCOL_CATEGORY_DOWNLOAD_FT, + no_master, "PS_VUE", NDPI_PROTOCOL_CATEGORY_VIDEO, 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_mod, NDPI_PROTOCOL_UNSAFE, NDPI_PROTOCOL_IRC, @@ -1249,9 +1249,9 @@ static void ndpi_init_protocol_defaults(struct ndpi_detection_module_struct *ndp no_master, "PcAnywhere", NDPI_PROTOCOL_CATEGORY_REMOTE_ACCESS, 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_mod, NDPI_PROTOCOL_ACCEPTABLE, NDPI_PROTOCOL_FREE_189, + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_ACCEPTABLE, NDPI_PROTOCOL_ZOOM, 0 /* can_have_a_subprotocol */, no_master, - no_master, "Free189", NDPI_PROTOCOL_CATEGORY_VOIP, + no_master, "Zoom", NDPI_PROTOCOL_CATEGORY_VIDEO, 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_mod, NDPI_PROTOCOL_ACCEPTABLE, NDPI_PROTOCOL_WHATSAPP_FILES, @@ -3309,6 +3309,12 @@ void ndpi_set_protocol_detection_bitmask2(struct ndpi_detection_module_struct *n /* Targus Getdata */ init_targus_getdata_dissector(ndpi_struct, &a, detection_bitmask); + /* ZOOM */ + init_zoom_dissector(ndpi_struct, &a, detection_bitmask); + + /* PS Vue */ + init_ps_vue_dissector(ndpi_struct, &a, detection_bitmask); + /* ----------------------------------------------------------------- */ ndpi_struct->callback_buffer_size = a; diff --git a/src/lib/protocols/ps_vue.c b/src/lib/protocols/ps_vue.c new file mode 100644 index 000000000..a608c96c6 --- /dev/null +++ b/src/lib/protocols/ps_vue.c @@ -0,0 +1,92 @@ +/* + * ps_vue.c + * + * Copyright (C) 2018 by ntop.org + * + * 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_PS_VUE + +#include "ndpi_api.h" + +static u_int8_t ps_vue_ptree_match(struct ndpi_detection_module_struct *ndpi_struct, struct in_addr *pin) { + return((ndpi_network_ptree_match(ndpi_struct, pin) == NDPI_PROTOCOL_PS_VUE) ? 1 : 0); +} + +/* ******************************************* */ + +static u_int8_t is_ps_vue_flow(struct ndpi_detection_module_struct *ndpi_struct, + struct ndpi_flow_struct *flow) { + struct ndpi_packet_struct *packet = &flow->packet; + + if(packet->iph) { + struct in_addr saddr, daddr; + + saddr.s_addr = packet->iph->saddr; + daddr.s_addr = packet->iph->daddr; + + if(ps_vue_ptree_match(ndpi_struct, &saddr) || + ps_vue_ptree_match(ndpi_struct, &daddr)) { + return(1); + } + } + + return(0); +} + +static void ndpi_check_ps_vue(struct ndpi_detection_module_struct *ndpi_struct, + struct ndpi_flow_struct *flow) { + + NDPI_LOG_DBG(ndpi_struct, "search ps_vue video \n"); + + if (is_ps_vue_flow(ndpi_struct, flow)){ + NDPI_LOG_INFO(ndpi_struct, "found ps_vue\n"); + + ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_PS_VUE, + NDPI_PROTOCOL_UNKNOWN); + return; + } else { + NDPI_EXCLUDE_PROTO(ndpi_struct, flow); + } +} + +void ndpi_search_ps_vue(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) +{ + struct ndpi_packet_struct *packet = &flow->packet; + + NDPI_LOG_DBG(ndpi_struct, "search ps_vue\n"); + + /* skip marked packets */ + if(packet->detected_protocol_stack[0] != NDPI_PROTOCOL_PS_VUE) + ndpi_check_ps_vue(ndpi_struct, flow); +} + + +void init_ps_vue_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask) +{ + ndpi_set_bitmask_protocol_detection("PS_VUE", ndpi_struct, detection_bitmask, *id, + NDPI_PROTOCOL_PS_VUE, + ndpi_search_ps_vue, + NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP_WITH_PAYLOAD, + SAVE_DETECTION_BITMASK_AS_UNKNOWN, + ADD_TO_DETECTION_BITMASK); + *id += 1; +} diff --git a/src/lib/protocols/zoom.c b/src/lib/protocols/zoom.c new file mode 100644 index 000000000..341fb1c0f --- /dev/null +++ b/src/lib/protocols/zoom.c @@ -0,0 +1,130 @@ +/* + * zoom.c + * + * Copyright (C) 2018 by ntop.org + * + * 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_ZOOM + +#include "ndpi_api.h" + +static u_int8_t is_zoom_tcp_port(struct ndpi_flow_struct *flow) { + + struct ndpi_packet_struct *packet = &flow->packet; + u_int16_t dport = ntohs(packet->tcp->dest); + + if((dport == 8801) || (dport == 8802) || (dport == 5090) || (dport == 5091)){ + return 1; + } + return 0; +} + +static u_int8_t is_zoom_udp_port(struct ndpi_flow_struct *flow) { + + struct ndpi_packet_struct *packet = &flow->packet; + u_int16_t dport = ntohs(packet->tcp->dest); + + if((dport == 3478) || (dport == 3479) || (dport == 5090) || + (dport >= 8801 && dport <= 8810) || (dport >= 20000 && dport <= 64000)){ + return 1; + } + return 0; +} + +static u_int8_t zoom_ptree_match(struct ndpi_detection_module_struct *ndpi_struct, struct in_addr *pin) { + return((ndpi_network_ptree_match(ndpi_struct, pin) == NDPI_PROTOCOL_ZOOM) ? 1 : 0); +} + +/* ******************************************* */ + +static u_int8_t is_zoom_flow(struct ndpi_detection_module_struct *ndpi_struct, + struct ndpi_flow_struct *flow) { + struct ndpi_packet_struct *packet = &flow->packet; + + if(packet->iph) { + struct in_addr daddr; + + daddr.s_addr = packet->iph->daddr; + + if(zoom_ptree_match(ndpi_struct, &daddr)) { + return(1); + } + } + + return(0); +} + +static void ndpi_check_zoom(struct ndpi_detection_module_struct *ndpi_struct, + struct ndpi_flow_struct *flow) { + + struct ndpi_packet_struct *packet = &flow->packet; + + NDPI_LOG_DBG(ndpi_struct, "search Zoom video \n"); + + if(packet->tcp != NULL) + { + if (is_zoom_flow(ndpi_struct, flow) && is_zoom_tcp_port(flow)){ + NDPI_LOG_INFO(ndpi_struct, "found zoom on tcp\n"); + + ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_ZOOM, + NDPI_PROTOCOL_UNKNOWN); + return; + } + } + else if(packet->udp != NULL) + { + if (is_zoom_flow(ndpi_struct, flow) && is_zoom_udp_port(flow)){ + NDPI_LOG_INFO(ndpi_struct, "found zoom on udp\n"); + + ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_ZOOM, + NDPI_PROTOCOL_UNKNOWN); + return; + } + } + else + { + NDPI_EXCLUDE_PROTO(ndpi_struct, flow); + } +} + +void ndpi_search_zoom(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) +{ + struct ndpi_packet_struct *packet = &flow->packet; + + NDPI_LOG_DBG(ndpi_struct, "search zoom\n"); + + /* skip marked packets */ + if(packet->detected_protocol_stack[0] != NDPI_PROTOCOL_ZOOM) + ndpi_check_zoom(ndpi_struct, flow); +} + + +void init_zoom_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask) +{ + ndpi_set_bitmask_protocol_detection("Zoom", ndpi_struct, detection_bitmask, *id, + NDPI_PROTOCOL_ZOOM, + ndpi_search_zoom, + NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP_WITH_PAYLOAD, + SAVE_DETECTION_BITMASK_AS_UNKNOWN, + ADD_TO_DETECTION_BITMASK); + *id += 1; +} |