diff options
author | Ravi Kerur <ravi.kerur@viasat.com> | 2019-09-25 15:20:19 -0700 |
---|---|---|
committer | Ravi Kerur <ravi.kerur@viasat.com> | 2019-09-25 15:20:19 -0700 |
commit | c3a5650071b25a2f1eaf8606cd75d3eee28dc503 (patch) | |
tree | faba353803e6b3dd67deb52d1cd3a55f8de22917 /src/lib | |
parent | d2c0b9872d6f57e06a7171a2fcdbfb9b830d9fe9 (diff) |
Initial PS_VUE support based on public IP.
Signed-off-by: Ravi Kerur <ravi.kerur@viasat.com>
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/ndpi_content_match.c.inc | 30 | ||||
-rw-r--r-- | src/lib/ndpi_main.c | 7 | ||||
-rw-r--r-- | src/lib/protocols/ps_vue.c | 90 |
3 files changed, 125 insertions, 2 deletions
diff --git a/src/lib/ndpi_content_match.c.inc b/src/lib/ndpi_content_match.c.inc index fef2fd4e4..46d032ac2 100644 --- a/src/lib/ndpi_content_match.c.inc +++ b/src/lib/ndpi_content_match.c.inc @@ -8276,6 +8276,36 @@ static ndpi_network host_protocol_list[] = { { 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 } }; diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index cd12ee6df..02f3574e5 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, @@ -3312,6 +3312,9 @@ void ndpi_set_protocol_detection_bitmask2(struct ndpi_detection_module_struct *n /* 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..ee91b5f84 --- /dev/null +++ b/src/lib/protocols/ps_vue.c @@ -0,0 +1,90 @@ +/* + * 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 daddr; + + daddr.s_addr = packet->iph->daddr; + + if(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; +} |