Improved Steam detection (Steam Datagram Relay - SDR). (#1243)
* improved DNSCrypt midstream detection again (sufficient for all tested use-cases) Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
@@ -38,22 +38,31 @@ void ndpi_search_dnscrypt(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
|
|
||||||
NDPI_LOG_DBG(ndpi_struct, "search dnscrypt\n");
|
NDPI_LOG_DBG(ndpi_struct, "search dnscrypt\n");
|
||||||
|
|
||||||
if (flow->packet_counter > 3)
|
|
||||||
{
|
|
||||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* dnscrypt protocol version 1: check magic */
|
/* dnscrypt protocol version 1: check magic */
|
||||||
if (packet->payload_packet_len >= 64 &&
|
if (packet->payload_packet_len >= 64 &&
|
||||||
strncmp((char*)packet->payload, "r6fnvWj8", strlen("r6fnvWj8")) == 0)
|
strncmp((char*)packet->payload, "r6fnvWj8", strlen("r6fnvWj8")) == 0)
|
||||||
{
|
{
|
||||||
ndpi_int_dnscrypt_add_connection(ndpi_struct, flow);
|
ndpi_int_dnscrypt_add_connection(ndpi_struct, flow);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
/* dnscrypt protocol version 1 and 2: resolver ping */
|
/* dnscrypt protocol version 1 and 2: resolver ping */
|
||||||
if (packet->payload_packet_len > 13 + strlen(dnscrypt_initial) &&
|
if (packet->payload_packet_len > 13 + strlen(dnscrypt_initial) &&
|
||||||
strncasecmp((char*)packet->payload + 13, dnscrypt_initial, strlen(dnscrypt_initial)) == 0)
|
strncasecmp((char*)packet->payload + 13, dnscrypt_initial, strlen(dnscrypt_initial)) == 0)
|
||||||
{
|
{
|
||||||
ndpi_int_dnscrypt_add_connection(ndpi_struct, flow);
|
ndpi_int_dnscrypt_add_connection(ndpi_struct, flow);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((flow->packet_direction_counter[packet->packet_direction] >= 1 &&
|
||||||
|
flow->packet_direction_counter[1 - packet->packet_direction] >= 1) ||
|
||||||
|
flow->packet_counter >= 10)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Wait for at least one packet per direction, but not more then 10 packets.
|
||||||
|
* Required as we need to wait for the server response which contains the ASCII pattern below.
|
||||||
|
*/
|
||||||
|
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -113,6 +113,15 @@ static void ndpi_check_steam_udp1(struct ndpi_detection_module_struct *ndpi_stru
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check for Steam Datagram Relay (SDR) packets. */
|
||||||
|
if (payload_len > 8 &&
|
||||||
|
ndpi_ntohll(get_u_int64_t(packet->payload, 0)) == 0x0101736470696e67 /* "\x01\x01sdping" */)
|
||||||
|
{
|
||||||
|
NDPI_LOG_INFO(ndpi_struct, "found STEAM (Steam Datagram Relay)\n");
|
||||||
|
ndpi_int_steam_add_connection(ndpi_struct, flow);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check if we so far detected the protocol in the request or not. */
|
/* Check if we so far detected the protocol in the request or not. */
|
||||||
if (flow->steam_stage1 == 0) {
|
if (flow->steam_stage1 == 0) {
|
||||||
NDPI_LOG_DBG2(ndpi_struct, "STEAM stage 0: \n");
|
NDPI_LOG_DBG2(ndpi_struct, "STEAM stage 0: \n");
|
||||||
|
|||||||
Binary file not shown.
@@ -0,0 +1,7 @@
|
|||||||
|
Guessed flow protos: 0
|
||||||
|
|
||||||
|
DPI Packets (UDP): 1 (1.00 pkts/flow)
|
||||||
|
|
||||||
|
Steam 2 2684 1
|
||||||
|
|
||||||
|
1 UDP 192.168.2.100:52157 -> 139.45.193.10:27018 [proto: 74/Steam][cat: Game/8][2 pkts/2684 bytes -> 0 pkts/0 bytes][Goodput ratio: 97/0][2.52 sec][PLAIN TEXT (sdping)][Plen Bins: 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,100,0,0,0,0,0,0,0]
|
||||||
Reference in New Issue
Block a user