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");
|
||||
|
||||
if (flow->packet_counter > 3)
|
||||
{
|
||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||
}
|
||||
|
||||
/* dnscrypt protocol version 1: check magic */
|
||||
if (packet->payload_packet_len >= 64 &&
|
||||
strncmp((char*)packet->payload, "r6fnvWj8", strlen("r6fnvWj8")) == 0)
|
||||
{
|
||||
ndpi_int_dnscrypt_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
/* dnscrypt protocol version 1 and 2: resolver ping */
|
||||
if (packet->payload_packet_len > 13 + strlen(dnscrypt_initial) &&
|
||||
strncasecmp((char*)packet->payload + 13, dnscrypt_initial, strlen(dnscrypt_initial)) == 0)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
if (flow->steam_stage1 == 0) {
|
||||
NDPI_LOG_DBG2(ndpi_struct, "STEAM stage 0: \n");
|
||||
|
||||
Reference in New Issue
Block a user