/src/ndpi/src/lib/protocols/guildwars2.c
Line | Count | Source |
1 | | /* |
2 | | * guildwars2.c |
3 | | * |
4 | | * Copyright (C) 2009-11 - ipoque GmbH |
5 | | * Copyright (C) 2011-25 - ntop.org |
6 | | * |
7 | | * This file is part of nDPI, an open source deep packet inspection |
8 | | * library based on the OpenDPI and PACE technology by ipoque GmbH |
9 | | * |
10 | | * nDPI is free software: you can redistribute it and/or modify |
11 | | * it under the terms of the GNU Lesser General Public License as published by |
12 | | * the Free Software Foundation, either version 3 of the License, or |
13 | | * (at your option) any later version. |
14 | | * |
15 | | * nDPI is distributed in the hope that it will be useful, |
16 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 | | * GNU Lesser General Public License for more details. |
19 | | * |
20 | | * You should have received a copy of the GNU Lesser General Public License |
21 | | * along with nDPI. If not, see <http://www.gnu.org/licenses/>. |
22 | | * |
23 | | */ |
24 | | |
25 | | #include "ndpi_protocol_ids.h" |
26 | | |
27 | | #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_GUILDWARS2 |
28 | | |
29 | | #include "ndpi_api.h" |
30 | | #include "ndpi_private.h" |
31 | | |
32 | | static void ndpi_search_guildwars2_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) |
33 | 2.05k | { |
34 | 2.05k | struct ndpi_packet_struct const * const packet = &ndpi_struct->packet; |
35 | | |
36 | 2.05k | NDPI_LOG_DBG(ndpi_struct, "search Guild Wars 2\n"); |
37 | | |
38 | 2.05k | if (packet->payload_packet_len > 50) |
39 | 1.28k | { |
40 | | /* The connection starts with this preamble containing client info. |
41 | | * The TLS handshake begins around packet 12. */ |
42 | 1.28k | if ((memcmp(packet->payload, "P /Sts/Connect STS/1.0", 22) == 0) || |
43 | 1.28k | (memcmp(packet->payload, "P /Auth/StartTls STS/1.0", 24) == 0) || |
44 | 1.28k | (memcmp(packet->payload, "STS/1.0 400 Success", 19) == 0)) |
45 | 1 | { |
46 | 1 | NDPI_LOG_INFO(ndpi_struct, "found Guild Wars 2\n"); |
47 | 1 | ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_GUILDWARS2, NDPI_PROTOCOL_UNKNOWN, NDPI_CONFIDENCE_DPI); |
48 | 1 | return; |
49 | 1 | } |
50 | 1.28k | } |
51 | | |
52 | 2.05k | NDPI_EXCLUDE_DISSECTOR(ndpi_struct, flow); |
53 | 2.05k | } |
54 | | |
55 | | |
56 | | void init_guildwars2_dissector(struct ndpi_detection_module_struct *ndpi_struct) |
57 | 7.91k | { |
58 | 7.91k | register_dissector("GuildWars2", ndpi_struct, |
59 | 7.91k | ndpi_search_guildwars2_tcp, |
60 | 7.91k | NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION, |
61 | 7.91k | 1, NDPI_PROTOCOL_GUILDWARS2); |
62 | 7.91k | } |