Improved Teamspeak(3) protocol detection.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
#include "ndpi_api.h"
|
||||
|
||||
static void ndpi_int_teamspeak_add_connection(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_TEAMSPEAK, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
@@ -36,56 +36,38 @@ void ndpi_search_teamspeak(struct ndpi_detection_module_struct *ndpi_struct, str
|
||||
|
||||
NDPI_LOG_DBG(ndpi_struct, "search teamspeak\n");
|
||||
|
||||
|
||||
#ifdef WEAK_DETECTION_CODE_DISABLED
|
||||
if(packet->udp != NULL) {
|
||||
u_int16_t udport, usport;
|
||||
|
||||
usport = ntohs(packet->udp->source), udport = ntohs(packet->udp->dest);
|
||||
|
||||
/* http://www.imfirewall.com/en/protocols/teamSpeak.htm */
|
||||
if(((usport == 9987 || udport == 9987) || (usport == 8767 || udport == 8767)) && packet->payload_packet_len >= 20) {
|
||||
NDPI_LOG_INFO(ndpi_struct, "found TEAMSPEAK udp\n");
|
||||
ndpi_int_teamspeak_add_connection(ndpi_struct, flow);
|
||||
if (packet->payload_packet_len >= 20) {
|
||||
if (packet->udp != NULL) {
|
||||
if (memcmp(packet->payload, "TS3INIT1", strlen("TS3INIT1")) == 0)
|
||||
{
|
||||
NDPI_LOG_INFO(ndpi_struct, "found TEAMSPEAK udp\n");
|
||||
ndpi_int_teamspeak_add_connection(ndpi_struct, flow);
|
||||
}
|
||||
} else if(packet->tcp != NULL) {
|
||||
/* https://github.com/Youx/soliloque-server/wiki/Connection-packet */
|
||||
if(((memcmp(packet->payload, "\xf4\xbe\x03\x00", 4) == 0)) ||
|
||||
((memcmp(packet->payload, "\xf4\xbe\x02\x00", 4) == 0)) ||
|
||||
((memcmp(packet->payload, "\xf4\xbe\x01\x00", 4) == 0)))
|
||||
{
|
||||
NDPI_LOG_INFO(ndpi_struct, "found TEAMSPEAK tcp\n");
|
||||
ndpi_int_teamspeak_add_connection(ndpi_struct, flow);
|
||||
} /* http://www.imfirewall.com/en/protocols/teamSpeak.htm */
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
if(packet->tcp != NULL) {
|
||||
#if WEAK_DETECTION_CODE_DISABLED
|
||||
u_int16_t tdport, tsport;
|
||||
tsport = ntohs(packet->tcp->source), tdport = ntohs(packet->tcp->dest);
|
||||
#endif
|
||||
/* https://github.com/Youx/soliloque-server/wiki/Connection-packet */
|
||||
if(packet->payload_packet_len >= 20) {
|
||||
if(((memcmp(packet->payload, "\xf4\xbe\x03\x00", 4) == 0)) ||
|
||||
((memcmp(packet->payload, "\xf4\xbe\x02\x00", 4) == 0)) ||
|
||||
((memcmp(packet->payload, "\xf4\xbe\x01\x00", 4) == 0))) {
|
||||
NDPI_LOG_INFO(ndpi_struct, "found TEAMSPEAK tcp\n");
|
||||
ndpi_int_teamspeak_add_connection(ndpi_struct, flow);
|
||||
} /* http://www.imfirewall.com/en/protocols/teamSpeak.htm */
|
||||
}
|
||||
#if WEAK_DETECTION_CODE_DISABLED
|
||||
else if((tsport == 14534 || tdport == 14534) || (tsport == 51234 || tdport == 51234)) {
|
||||
NDPI_LOG_INFO(ndpi_struct, "found TEAMSPEAK\n");
|
||||
ndpi_int_teamspeak_add_connection(ndpi_struct, flow);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
void init_teamspeak_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
void init_teamspeak_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id,
|
||||
NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("TeamSpeak", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_TEAMSPEAK,
|
||||
ndpi_search_teamspeak,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
NDPI_PROTOCOL_TEAMSPEAK,
|
||||
ndpi_search_teamspeak,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,3 @@
|
||||
TeamSpeak 13 1911 1
|
||||
|
||||
1 UDP 10.0.0.1:53187 -> 10.0.0.2:9987 [proto: 162/TeamSpeak][cat: VoIP/10][13 pkts/1911 bytes -> 0 pkts/0 bytes][Goodput ratio: 71/0][37.01 sec][bytes ratio: 1.000 (Upload)][IAT c2s/s2c min/avg/max/stddev: 0/0 387/0 1301/0 449/0][Pkt Len c2s/s2c min/avg/max/stddev: 76/0 147/0 230/0 77/0][PLAIN TEXT (DDDDDDffffff)][Plen Bins: 0,53,0,0,0,46,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
|
||||
Reference in New Issue
Block a user