diff options
-rw-r--r-- | src/include/ndpi_protocol_ids.h | 5 | ||||
-rw-r--r-- | src/include/ndpi_protocols.h | 1 | ||||
-rw-r--r-- | src/lib/ndpi_main.c | 8 | ||||
-rw-r--r-- | src/lib/protocols/hpvirtgrp.c | 71 | ||||
-rw-r--r-- | tests/pcap/hpvirtgrp.pcap | bin | 0 -> 14923 bytes | |||
-rw-r--r-- | tests/result/hpvirtgrp.pcap.out | 11 |
6 files changed, 94 insertions, 2 deletions
diff --git a/src/include/ndpi_protocol_ids.h b/src/include/ndpi_protocol_ids.h index cbcde77af..b289362f5 100644 --- a/src/include/ndpi_protocol_ids.h +++ b/src/include/ndpi_protocol_ids.h @@ -264,8 +264,8 @@ typedef enum { NDPI_PROTOCOL_LINKEDIN = 233, /* Paulo Angelo <pa@pauloangelo.com> */ NDPI_PROTOCOL_SOUNDCLOUD = 234, NDPI_PROTOCOL_CSGO = 235, /* Counter-Strike Global Offensive, Dota = 2 */ - NDPI_PROTOCOL_LISP = 236, - NDPI_PROTOCOL_DIAMETER = 237, + NDPI_PROTOCOL_LISP = 236, + NDPI_PROTOCOL_DIAMETER = 237, NDPI_PROTOCOL_APPLE_PUSH = 238, NDPI_PROTOCOL_GOOGLE_SERVICES = 239, NDPI_PROTOCOL_AMAZON_VIDEO = 240, @@ -284,6 +284,7 @@ typedef enum { NDPI_PROTOCOL_SOAP = 253, /* Toni Uhlig <matzeton@googlemail.com> */ NDPI_PROTOCOL_APPLE_SIRI = 254, /* Zied Aouini <aouinizied@gmail.com> */ NDPI_PROTOCOL_SNAPCHAT_CALL = 255, + NDPI_PROTOCOL_HPVIRTGRP = 256, /* Toni Uhlig <matzeton@googlemail.com> */ #ifdef CUSTOM_NDPI_PROTOCOLS diff --git a/src/include/ndpi_protocols.h b/src/include/ndpi_protocols.h index 1b541360e..b753def52 100644 --- a/src/include/ndpi_protocols.h +++ b/src/include/ndpi_protocols.h @@ -212,5 +212,6 @@ void init_soap_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int void init_dnscrypt_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask); void init_mongodb_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask); void init_among_us_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask); +void init_hpvirtgrp_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_main.c b/src/lib/ndpi_main.c index 3ae724391..42d867fd0 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -1620,6 +1620,10 @@ static void ndpi_init_protocol_defaults(struct ndpi_detection_module_struct *ndp "SnapchatCall", NDPI_PROTOCOL_CATEGORY_VOIP, 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, NDPI_PROTOCOL_ACCEPTABLE, NDPI_PROTOCOL_HPVIRTGRP, + "HP Virtual Machine Group Management", NDPI_PROTOCOL_CATEGORY_NETWORK, + 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" @@ -3765,8 +3769,12 @@ void ndpi_set_protocol_detection_bitmask2(struct ndpi_detection_module_struct *n /* MongoDB */ init_mongodb_dissector(ndpi_str, &a, detection_bitmask); + /* AmongUS */ init_among_us_dissector(ndpi_str, &a, detection_bitmask); + /* HP Virtual Machine Group Management */ + init_hpvirtgrp_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/hpvirtgrp.c b/src/lib/protocols/hpvirtgrp.c new file mode 100644 index 000000000..b1ce092e7 --- /dev/null +++ b/src/lib/protocols/hpvirtgrp.c @@ -0,0 +1,71 @@ +/* + * hpvirtgrp.c + * + * Copyright (C) 2012-21 - ntop.org + * + * This module 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. + * + * This module 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. + * If not, see <http://www.gnu.org/licenses/>. + * + */ + +#include "ndpi_protocol_ids.h" + +#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_HPVIRTGRP + +#include <stdlib.h> +#include "ndpi_api.h" + + +static void ndpi_int_hpvirtgrp_add_connection( + struct ndpi_detection_module_struct *ndpi_struct, + struct ndpi_flow_struct *flow) +{ + ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_HPVIRTGRP, NDPI_PROTOCOL_UNKNOWN); +} + +static void ndpi_search_hpvirtgrp(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 hpvirtgrp\n"); + + if (packet->tcp != NULL) + { + if (flow->packet_counter == 1 && packet->payload_packet_len >= 4 && + packet->payload_packet_len == ntohs(*(u_int16_t*)&packet->payload[1]) && + packet->payload[0] == 0x16 && packet->payload[3] == 0x00) + { + ndpi_int_hpvirtgrp_add_connection(ndpi_struct, flow); + } + } + + NDPI_EXCLUDE_PROTO(ndpi_struct, flow); +} + + +/* ***************************************************************** */ + +void init_hpvirtgrp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, + NDPI_PROTOCOL_BITMASK *detection_bitmask) +{ + ndpi_set_bitmask_protocol_detection("HP Virtual Machine Group Management", + ndpi_struct, detection_bitmask, *id, + NDPI_PROTOCOL_HPVIRTGRP, + ndpi_search_hpvirtgrp, + NDPI_SELECTION_BITMASK_PROTOCOL_TCP_WITH_PAYLOAD, + SAVE_DETECTION_BITMASK_AS_UNKNOWN, + ADD_TO_DETECTION_BITMASK); + + *id += 1; +} diff --git a/tests/pcap/hpvirtgrp.pcap b/tests/pcap/hpvirtgrp.pcap Binary files differnew file mode 100644 index 000000000..4d43dc237 --- /dev/null +++ b/tests/pcap/hpvirtgrp.pcap diff --git a/tests/result/hpvirtgrp.pcap.out b/tests/result/hpvirtgrp.pcap.out new file mode 100644 index 000000000..5def54f93 --- /dev/null +++ b/tests/result/hpvirtgrp.pcap.out @@ -0,0 +1,11 @@ +HP Virtual Machine Group Management 135 12739 9 + + 1 TCP 192.168.2.100:40152 <-> 160.44.194.66:5223 [proto: 256/HP Virtual Machine Group Management][cat: Network/14][7 pkts/1019 bytes <-> 8 pkts/613 bytes][Goodput ratio: 61/26][1.18 sec][bytes ratio: 0.249 (Upload)][IAT c2s/s2c min/avg/max/stddev: 1/0 92/192 380/409 144/135][Pkt Len c2s/s2c min/avg/max/stddev: 54/60 146/77 217/106 74/17][Plen Bins: 0,50,0,0,12,37,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] + 2 TCP 192.168.2.100:35634 <-> 160.44.194.66:5223 [proto: 256/HP Virtual Machine Group Management][cat: Network/14][8 pkts/945 bytes <-> 7 pkts/524 bytes][Goodput ratio: 52/23][233.89 sec][bytes ratio: 0.287 (Upload)][IAT c2s/s2c min/avg/max/stddev: 4/0 38973/46772 233376/233402 86940/93315][Pkt Len c2s/s2c min/avg/max/stddev: 54/60 118/75 217/106 70/18][Plen Bins: 0,57,0,0,14,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] + 3 TCP 192.168.2.100:49838 <-> 160.44.194.66:5223 [proto: 256/HP Virtual Machine Group Management][cat: Network/14][9 pkts/1019 bytes <-> 6 pkts/435 bytes][Goodput ratio: 48/20][129.59 sec][bytes ratio: 0.402 (Upload)][IAT c2s/s2c min/avg/max/stddev: 0/0 18430/32235 128357/128902 44878/55811][Pkt Len c2s/s2c min/avg/max/stddev: 54/60 113/72 217/106 68/18][Plen Bins: 0,50,0,0,16,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] + 4 TCP 192.168.2.100:42552 <-> 160.44.194.66:5223 [proto: 256/HP Virtual Machine Group Management][cat: Network/14][9 pkts/871 bytes <-> 6 pkts/493 bytes][Goodput ratio: 42/32][389.17 sec][bytes ratio: 0.277 (Upload)][IAT c2s/s2c min/avg/max/stddev: 7/0 12720/22254 88714/88744 31024/38388][Pkt Len c2s/s2c min/avg/max/stddev: 54/60 97/82 217/106 58/17][Plen Bins: 0,75,0,0,12,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] + 5 TCP 192.168.2.100:42764 <-> 160.44.194.66:5223 [proto: 256/HP Virtual Machine Group Management][cat: Network/14][9 pkts/871 bytes <-> 6 pkts/493 bytes][Goodput ratio: 42/32][233.96 sec][bytes ratio: 0.277 (Upload)][IAT c2s/s2c min/avg/max/stddev: 20/0 28027/49038 195881/195911 68526/84797][Pkt Len c2s/s2c min/avg/max/stddev: 54/60 97/82 217/106 58/17][Plen Bins: 0,75,0,0,12,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] + 6 TCP 192.168.2.100:46570 <-> 160.44.194.66:5223 [proto: 256/HP Virtual Machine Group Management][cat: Network/14][9 pkts/871 bytes <-> 6 pkts/493 bytes][Goodput ratio: 42/32][237.74 sec][bytes ratio: 0.277 (Upload)][IAT c2s/s2c min/avg/max/stddev: 7/0 7786/13618 54289/54319 18985/23499][Pkt Len c2s/s2c min/avg/max/stddev: 54/60 97/82 217/106 58/17][Plen Bins: 0,75,0,0,12,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] + 7 TCP 192.168.2.100:59200 <-> 160.44.194.66:5223 [proto: 256/HP Virtual Machine Group Management][cat: Network/14][9 pkts/871 bytes <-> 6 pkts/493 bytes][Goodput ratio: 42/32][5.19 sec][bytes ratio: 0.277 (Upload)][IAT c2s/s2c min/avg/max/stddev: 30/0 731/1280 4423/4494 1515/1865][Pkt Len c2s/s2c min/avg/max/stddev: 54/60 97/82 217/106 58/17][Plen Bins: 0,75,0,0,12,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] + 8 TCP 192.168.2.100:59324 <-> 160.44.194.66:5223 [proto: 256/HP Virtual Machine Group Management][cat: Network/14][9 pkts/871 bytes <-> 6 pkts/493 bytes][Goodput ratio: 42/32][61.99 sec][bytes ratio: 0.277 (Upload)][IAT c2s/s2c min/avg/max/stddev: 13/0 704/1215 4368/4399 1501/1845][Pkt Len c2s/s2c min/avg/max/stddev: 54/60 97/82 217/106 58/17][Plen Bins: 0,75,0,0,12,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] + 9 TCP 192.168.2.100:59920 <-> 160.44.194.66:5223 [proto: 256/HP Virtual Machine Group Management][cat: Network/14][9 pkts/871 bytes <-> 6 pkts/493 bytes][Goodput ratio: 42/32][118.33 sec][bytes ratio: 0.277 (Upload)][IAT c2s/s2c min/avg/max/stddev: 32/0 16865/867 95461/3170 32744/1332][Pkt Len c2s/s2c min/avg/max/stddev: 54/60 97/82 217/106 58/17][Plen Bins: 0,75,0,0,12,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] |