Merge pull request #1014 from lnslbrty/improved/teamspeak

Improved Teamspeak(3) protocol detection.
This commit is contained in:
Luca Deri
2020-09-09 23:28:21 +02:00
committed by GitHub
3 changed files with 28 additions and 43 deletions
+8 -26
View File
@@ -36,49 +36,31 @@ void ndpi_search_teamspeak(struct ndpi_detection_module_struct *ndpi_struct, str
NDPI_LOG_DBG(ndpi_struct, "search teamspeak\n"); NDPI_LOG_DBG(ndpi_struct, "search teamspeak\n");
if (packet->payload_packet_len >= 20) {
#ifdef WEAK_DETECTION_CODE_DISABLED
if (packet->udp != NULL) { if (packet->udp != NULL) {
u_int16_t udport, usport; if (memcmp(packet->payload, "TS3INIT1", strlen("TS3INIT1")) == 0)
{
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_LOG_INFO(ndpi_struct, "found TEAMSPEAK udp\n");
ndpi_int_teamspeak_add_connection(ndpi_struct, flow); ndpi_int_teamspeak_add_connection(ndpi_struct, flow);
} }
} } else if(packet->tcp != NULL) {
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 */ /* 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)) || if(((memcmp(packet->payload, "\xf4\xbe\x03\x00", 4) == 0)) ||
((memcmp(packet->payload, "\xf4\xbe\x02\x00", 4) == 0)) || ((memcmp(packet->payload, "\xf4\xbe\x02\x00", 4) == 0)) ||
((memcmp(packet->payload, "\xf4\xbe\x01\x00", 4) == 0))) { ((memcmp(packet->payload, "\xf4\xbe\x01\x00", 4) == 0)))
{
NDPI_LOG_INFO(ndpi_struct, "found TEAMSPEAK tcp\n"); NDPI_LOG_INFO(ndpi_struct, "found TEAMSPEAK tcp\n");
ndpi_int_teamspeak_add_connection(ndpi_struct, flow); ndpi_int_teamspeak_add_connection(ndpi_struct, flow);
} /* http://www.imfirewall.com/en/protocols/teamSpeak.htm */ } /* 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); NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
return; 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_set_bitmask_protocol_detection("TeamSpeak", ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_TEAMSPEAK, NDPI_PROTOCOL_TEAMSPEAK,
Binary file not shown.
+3
View File
@@ -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]