improved skype detection

This commit is contained in:
Campus
2017-02-16 20:11:21 +01:00
parent af04f78bd7
commit eb92c6b676
2 changed files with 15 additions and 14 deletions
+5 -1
View File
@@ -317,11 +317,13 @@ static ndpi_network host_protocol_list[] = {
157.60.0.0/16, 157.54.0.0/15
13.107.3.128/32
13.107.3.129/32
111.221.64.0 - 111.221.127.255
13.64.0.0/11
111.221.64.0/18
91.190.216.0/21 (AS198015 Skype Communications Sarl)
91.190.218.0/24
40.126.129.109/32
65.55.223.0/26
23.96.0.0/13
*/
{ 0x9D388740 /* 157.56.135.64 */, 26, NDPI_PROTOCOL_SKYPE },
{ 0x9D38B900 /* 157.56.185.0 */, 26, NDPI_PROTOCOL_SKYPE },
@@ -330,6 +332,7 @@ static ndpi_network host_protocol_list[] = {
{ 0x9D38C600 /* 157.56.198.0 */, 26, NDPI_PROTOCOL_SKYPE },
{ 0x9D3C0000 /* 157.60.0.0 */, 16, NDPI_PROTOCOL_SKYPE },
{ 0x9D360000 /* 157.54.0.0 */, 15, NDPI_PROTOCOL_SKYPE },
{ 0x0D400000 /* 13.64.0.0 */, 11, NDPI_PROTOCOL_SKYPE },
{ 0x0D6B0380 /* 13.107.3.128 */, 32, NDPI_PROTOCOL_SKYPE },
{ 0x0D6B0381 /* 13.107.3.129 */, 32, NDPI_PROTOCOL_SKYPE },
{ 0x6FDD4000 /* 111.221.64.0 */, 18, NDPI_PROTOCOL_SKYPE },
@@ -337,6 +340,7 @@ static ndpi_network host_protocol_list[] = {
{ 0x5BBEDA00 /* 91.190.218.0 */, 24, NDPI_PROTOCOL_SKYPE },
{ 0x287F816D /* 40.126.129.109 */, 32, NDPI_PROTOCOL_SKYPE },
{ 0x4237DF00 /* 65.55.223.0 */, 26, NDPI_PROTOCOL_SKYPE },
{ 0x17600000 /* 23.96.0.0 */, 13, NDPI_PROTOCOL_SKYPE },
/*
route: 5.42.160.0/19
+10 -13
View File
@@ -1,7 +1,7 @@
/*
* skype.c
*
* Copyright (C) 2011-15 - ntop.org
* Copyright (C) 2017 - ntop.org
*
* nDPI is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@@ -17,8 +17,6 @@
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "ndpi_api.h"
#ifdef NDPI_PROTOCOL_SKYPE
@@ -55,18 +53,17 @@ static void ndpi_check_skype(struct ndpi_detection_module_struct *ndpi_struct, s
// const u_int8_t *packet_payload = packet->payload;
u_int32_t payload_len = packet->payload_packet_len;
if(flow->host_server_name[0] != '\0')
return;
/*
Skype AS8220
212.161.8.0/24
*/
if(is_skype_flow(ndpi_struct, flow)) {
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_SKYPE, NDPI_PROTOCOL_UNKNOWN);
return;
}
// UDP check
if(packet->udp != NULL) {
flow->l4.udp.skype_packet_id++;
@@ -75,20 +72,20 @@ static void ndpi_check_skype(struct ndpi_detection_module_struct *ndpi_struct, s
/* skype-to-skype */
if(dport != 1119) /* It can be confused with battle.net */ {
if(((payload_len == 3) && ((packet->payload[2] & 0x0F)== 0x0d))
|| ((payload_len >= 16)
&& (packet->payload[0] != 0x30) /* Avoid invalid SNMP detection */
&& (packet->payload[2] == 0x02))) {
if(((payload_len == 3) && ((packet->payload[2] & 0x0F)== 0x0d)) ||
((payload_len >= 16)
&& (packet->payload[0] != 0x30) /* Avoid invalid SNMP detection */
&& (packet->payload[2] == 0x02))) {
NDPI_LOG(NDPI_PROTOCOL_SKYPE, ndpi_struct, NDPI_LOG_DEBUG, "Found skype.\n");
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_SKYPE, NDPI_PROTOCOL_UNKNOWN);
}
}
return;
}
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_SKYPE);
return;
// TCP check
} else if(packet->tcp != NULL) {
flow->l4.tcp.skype_packet_id++;