added adobe flash host name - fix twitter and netflix detection - removed twitter dissector (useless have a dissector that looking for ip range; moved matching in ndpi_content_match.c.inc)

This commit is contained in:
Campus
2016-09-24 13:45:28 +02:00
parent 054f8376e4
commit f8a9faf2fa
6 changed files with 19 additions and 112 deletions
-2
View File
@@ -180,7 +180,6 @@ void ndpi_search_pando(struct ndpi_detection_module_struct *ndpi_struct, struct
void ndpi_search_megaco(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
void ndpi_search_redis(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
void ndpi_search_zmq(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
void ndpi_search_twitter(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
void ndpi_search_vhua(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
void ndpi_search_telegram(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
void ndpi_search_quic(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
@@ -311,7 +310,6 @@ void init_thunder_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_
void init_tor_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
void init_tvants_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
void init_tvuplayer_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
void init_twitter_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
void init_usenet_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
void init_veohtv_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
void init_vhua_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
-1
View File
@@ -140,7 +140,6 @@ libndpi_la_SOURCES = ndpi_content_match.c.inc \
protocols/teredo.c \
protocols/tvants.c \
protocols/tvuplayer.c \
protocols/twitter.c \
protocols/ubntac2.c \
protocols/usenet.c \
protocols/viber.c \
+18
View File
@@ -22,6 +22,20 @@
static ndpi_network host_protocol_list[] = {
/*
Twitter
199.59.148.0/22
192.133.76.0/22
199.16.156.0/22
199.96.58.0/23
199.96.62.0/23
*/
{ 0xC73B9400 /* 199.59.148.0/22 */, 22, NDPI_SERVICE_TWITTER },
{ 0xC0854C00 /* 199.133.76.0/22 */, 22, NDPI_SERVICE_TWITTER },
{ 0xC7109C00 /* 199.16.156.0/22 */, 22, NDPI_SERVICE_TWITTER },
{ 0xC7603A00 /* 199.96.58.0/23 */, 23, NDPI_SERVICE_TWITTER },
{ 0xC7603E00 /* 199.96.62.0/23 */, 23, NDPI_SERVICE_TWITTER },
/*
OpenDNS
208.67.216.0/21
@@ -62,9 +76,12 @@ static ndpi_network host_protocol_list[] = {
Netflix
23.246.0.0/18
23.21.190.124/32
69.53.224.0/19
*/
{ 0x17F60000 /* 23.246.0.0/18 */, 18, NDPI_SERVICE_NETFLIX },
{ 0x1715BE7C /* 23.21.190.124/32 */, 32, NDPI_SERVICE_NETFLIX },
{ 0x4535E000 /* 69.53.224.0/19 */, 19, NDPI_SERVICE_NETFLIX },
/*
Cloudflare
@@ -7444,6 +7461,7 @@ ndpi_protocol_match content_match[] = {
{ "audio/ogg", NULL, NDPI_CONTENT_OGG, NDPI_PROTOCOL_FUN },
{ "video/ogg", NULL, NDPI_CONTENT_OGG, NDPI_PROTOCOL_FUN },
{ "application/ogg", NULL, NDPI_CONTENT_OGG, NDPI_PROTOCOL_FUN },
{ ".adobe.", NULL, NDPI_CONTENT_FLASH, NDPI_PROTOCOL_FUN },
{ "video/flv", NULL, NDPI_CONTENT_FLASH, NDPI_PROTOCOL_FUN },
{ "video/x-flv", NULL, NDPI_CONTENT_FLASH, NDPI_PROTOCOL_FUN },
{ "application/x-fcs", NULL, NDPI_CONTENT_FLASH, NDPI_PROTOCOL_FUN },
-3
View File
@@ -2556,9 +2556,6 @@ void ndpi_set_protocol_detection_bitmask2(struct ndpi_detection_module_struct *n
/* ZMQ */
init_zmq_dissector(ndpi_struct, &a, detection_bitmask);
/* TWITTER */
init_twitter_dissector(ndpi_struct, &a, detection_bitmask);
/* TELEGRAM */
init_telegram_dissector(ndpi_struct, &a, detection_bitmask);
+1 -30
View File
@@ -166,39 +166,10 @@ static void parseHttpSubprotocol(struct ndpi_detection_module_struct *ndpi_struc
// int i = 0;
struct ndpi_packet_struct *packet = &flow->packet;
if(packet->iph /* IPv4 only */) {
/*
Twitter Inc. TWITTER-NETWORK (NET-199-59-148-0-1) 199.59.148.0 - 199.59.151.255
199.59.148.0/22
*/
if(((ntohl(packet->iph->saddr) & 0xFFFFFC00 /* 255.255.252.0 */) == 0xC73B9400 /* 199.59.148.0 */)
|| ((ntohl(packet->iph->daddr) & 0xFFFFFC00 /* 255.255.252.0 */) == 0xC73B9400 /* 199.59.148.0 */)) {
packet->detected_protocol_stack[0] = NDPI_SERVICE_TWITTER,
packet->detected_protocol_stack[1] = NDPI_PROTOCOL_HTTP;
return;
}
/*
CIDR: 69.53.224.0/19
OriginAS: AS2906
NetName: NETFLIX-INC
*/
if(((ntohl(packet->iph->saddr) & 0xFFFFE000 /* 255.255.224.0 */) == 0x4535E000 /* 69.53.224.0 */)
|| ((ntohl(packet->iph->daddr) & 0xFFFFE000 /* 255.255.224.0 */) == 0x4535E000 /* 69.53.224.0 */)) {
packet->detected_protocol_stack[0] = NDPI_SERVICE_NETFLIX,
packet->detected_protocol_stack[1] = NDPI_PROTOCOL_HTTP;
return;
}
}
if((flow->l4.tcp.http_stage == 0)
|| (flow->http.url && flow->http_detected)) {
/* Try matching subprotocols */
// ndpi_match_host_subprotocol(ndpi_struct, flow, (char*)packet->host_line.ptr, packet->host_line.len);
/*
NOTE
NOTE
If http_dont_dissect_response = 1 dissection of HTTP response
mime types won't happen
*/
-76
View File
@@ -1,76 +0,0 @@
/*
* twitter.c
*
* Copyright (C) 2014 - ntop.org
*
* This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* nDPI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "ndpi_protocols.h"
#ifdef NDPI_SERVICE_TWITTER
static void ndpi_int_twitter_add_connection(struct ndpi_detection_module_struct
*ndpi_struct, struct ndpi_flow_struct *flow)
{
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_SERVICE_TWITTER, NDPI_PROTOCOL_UNKNOWN);
}
void ndpi_search_twitter(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
{
/*
Twitter AS34702
http://bgp.he.net/AS13414
*/
if(flow->packet.iph) {
// IPv4
u_int32_t src = ntohl(flow->packet.iph->saddr);
u_int32_t dst = ntohl(flow->packet.iph->daddr);
if(ndpi_ips_match(src, dst, 0xC0854C00, 22) /* 192.133.76.0/22 */
|| ndpi_ips_match(src, dst, 0xC7109C00, 22) /* 199.16.156.0/22 */
|| ndpi_ips_match(src, dst, 0xC73B9400, 22) /* 199.59.148.0/22 */
|| ndpi_ips_match(src, dst, 0xC7603A00, 23) /* 199.96.58.0/23 */
|| ndpi_ips_match(src, dst, 0xC7603E00, 23) /* 199.96.62.0/23 */
) {
ndpi_int_twitter_add_connection(ndpi_struct, flow);
return;
}
}
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_SERVICE_TWITTER);
}
void init_twitter_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{
ndpi_set_bitmask_protocol_detection("TWITTER", ndpi_struct, detection_bitmask, *id,
NDPI_SERVICE_TWITTER,
ndpi_search_twitter,
NDPI_SELECTION_BITMASK_PROTOCOL_TCP,
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK);
*id += 1;
}
#endif