From 599cc0f4b83a96c247a92aaaa3f39acfec9e1dbe Mon Sep 17 00:00:00 2001 From: Vladimir Gavrilov <105977161+0xA50C1A1@users.noreply.github.com> Date: Thu, 28 Mar 2024 18:01:01 +0300 Subject: [PATCH] Improve LoL: Wild Rift detection (#2359) --- src/lib/protocols/lol_wild_rift.c | 21 ++++++++++++++---- .../cfgs/default/pcap/lol_wild_rift_udp.pcap | Bin 1572 -> 1704 bytes .../default/result/lol_wild_rift_udp.pcap.out | 16 +++++++------ 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/lib/protocols/lol_wild_rift.c b/src/lib/protocols/lol_wild_rift.c index 214c74dcb..eb0328112 100644 --- a/src/lib/protocols/lol_wild_rift.c +++ b/src/lib/protocols/lol_wild_rift.c @@ -31,6 +31,14 @@ #include "ndpi_api.h" #include "ndpi_private.h" +static void ndpi_int_lolwildrift_add_connection(struct ndpi_detection_module_struct *ndpi_struct, + struct ndpi_flow_struct *flow) +{ + NDPI_LOG_INFO(ndpi_struct, "found League of Legends: Wild Rift\n"); + ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_LOLWILDRIFT, + NDPI_PROTOCOL_UNKNOWN, NDPI_CONFIDENCE_DPI); +} + static void ndpi_search_lolwildrift(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { @@ -38,6 +46,14 @@ static void ndpi_search_lolwildrift(struct ndpi_detection_module_struct *ndpi_st NDPI_LOG_DBG(ndpi_struct, "search League of Legends: Wild Rift\n"); + if (packet->payload_packet_len == 22 && + ntohl(get_u_int32_t(packet->payload, 0)) == 0x102C841 && + ntohl(get_u_int32_t(packet->payload, packet->payload_packet_len-4)) == 0x41304231) + { + ndpi_int_lolwildrift_add_connection(ndpi_struct, flow); + return; + } + if (packet->payload_packet_len == 69 && ntohl(get_u_int32_t(packet->payload, 0)) == 0x4000000) { @@ -49,10 +65,7 @@ static void ndpi_search_lolwildrift(struct ndpi_detection_module_struct *ndpi_st packet->payload_packet_len == 359 && ntohl(get_u_int32_t(packet->payload, 0)) == 0x10000000) { - NDPI_LOG_INFO(ndpi_struct, "found League of Legends: Wild Rift\n"); - ndpi_set_detected_protocol(ndpi_struct, flow, - NDPI_PROTOCOL_LOLWILDRIFT, NDPI_PROTOCOL_UNKNOWN, - NDPI_CONFIDENCE_DPI); + ndpi_int_lolwildrift_add_connection(ndpi_struct, flow); return; } diff --git a/tests/cfgs/default/pcap/lol_wild_rift_udp.pcap b/tests/cfgs/default/pcap/lol_wild_rift_udp.pcap index fd9827feb50be56b74b39e2dde59e43afe2db314..32a7e2b184e8f4c4a9d74ecc4a6e40dc7b1e8e43 100644 GIT binary patch delta 141 zcmZ3&vx0Yn3R}JQN#?YQpBxNE3=ClG3Z&$wIxsj0%Cd7^U(3jAY9+Mxp<5t>-2O?7 zOeY+H${2x=fkBReg@MJ 13.51.213.131:15007 [proto: 407/LoLWildRift][IP: 265/AmazonAWS][ClearText][Confidence: DPI][DPI packets: 2][cat: Game/8][1 pkts/97 bytes <-> 1 pkts/387 bytes][Goodput ratio: 70/93][0.03 sec][Plen Bins: 0,0,50,0,0,0,0,0,0,0,0,50,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 UDP 10.215.173.1:46702 <-> 51.20.230.207:15007 [proto: 407/LoLWildRift][IP: 265/AmazonAWS][ClearText][Confidence: DPI][DPI packets: 2][cat: Game/8][1 pkts/97 bytes <-> 1 pkts/387 bytes][Goodput ratio: 70/93][0.08 sec][Plen Bins: 0,0,50,0,0,0,0,0,0,0,0,50,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 UDP 10.215.173.1:47462 <-> 51.20.230.207:15004 [proto: 407/LoLWildRift][IP: 265/AmazonAWS][ClearText][Confidence: DPI][DPI packets: 2][cat: Game/8][1 pkts/97 bytes <-> 1 pkts/387 bytes][Goodput ratio: 70/93][0.09 sec][Plen Bins: 0,0,50,0,0,0,0,0,0,0,0,50,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 UDP 10.215.173.1:41440 -> 13.53.58.18:18001 [proto: 407/LoLWildRift][IP: 265/AmazonAWS][ClearText][Confidence: DPI][DPI packets: 1][cat: Game/8][1 pkts/50 bytes -> 0 pkts/0 bytes][Goodput ratio: 43/0][< 1 sec][Risk: ** Unidirectional Traffic **][Risk Score: 10][Risk Info: No server to client traffic][Plen Bins: 100,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,0,0,0,0,0] + 5 UDP 10.215.173.1:44513 -> 13.53.58.18:18001 [proto: 407/LoLWildRift][IP: 265/AmazonAWS][ClearText][Confidence: DPI][DPI packets: 1][cat: Game/8][1 pkts/50 bytes -> 0 pkts/0 bytes][Goodput ratio: 43/0][< 1 sec][Risk: ** Unidirectional Traffic **][Risk Score: 10][Risk Info: No server to client traffic][Plen Bins: 100,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,0,0,0,0,0]