diff options
author | Campus <campus@ntop.org> | 2016-03-29 00:05:56 +0200 |
---|---|---|
committer | Campus <campus@ntop.org> | 2016-03-29 00:05:56 +0200 |
commit | a59427398921b234bf152cc8f938f83fca07ee2b (patch) | |
tree | bb761624c5b4f1649b49fa4761703fc9f63c6b74 /src/lib/protocols/dropbox.c | |
parent | d9264e415c1325946c9b638e6455b0126ee9c8ad (diff) |
fixed coap.c and dropbox.c after detecting wrong detection - added test for dropbox
Diffstat (limited to 'src/lib/protocols/dropbox.c')
-rw-r--r-- | src/lib/protocols/dropbox.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/lib/protocols/dropbox.c b/src/lib/protocols/dropbox.c index ec546d356..63a1f5531 100644 --- a/src/lib/protocols/dropbox.c +++ b/src/lib/protocols/dropbox.c @@ -25,6 +25,10 @@ #include "ndpi_api.h" #ifdef NDPI_PROTOCOL_DROPBOX + +#define DB_LSP_PORT 17500 + + static void ndpi_int_dropbox_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow, u_int8_t due_to_correlation) @@ -40,12 +44,25 @@ static void ndpi_check_dropbox(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t payload_len = packet->payload_packet_len; if(packet->udp != NULL) { - u_int16_t dropbox_port = htons(17500); + + u_int16_t dropbox_port = htons(DB_LSP_PORT); if((packet->udp->source == dropbox_port) && (packet->udp->dest == dropbox_port)) { if(payload_len > 2) { - if(strncmp((const char *)packet->payload, "{\"", 2) == 0) { + if(strncmp((const char *)packet->payload, "{\"host_int\"", 11) == 0) { + + NDPI_LOG(NDPI_PROTOCOL_DROPBOX, ndpi_struct, NDPI_LOG_DEBUG, "Found dropbox.\n"); + ndpi_int_dropbox_add_connection(ndpi_struct, flow, 0); + return; + } + } + } + if((packet->udp->dest == dropbox_port)) { + if(payload_len > 2) { + char * p = (char *) packet->payload; + while(*p++ != '{'); + if(strncmp(p,"\"messageType\"", 13) == 0) { NDPI_LOG(NDPI_PROTOCOL_DROPBOX, ndpi_struct, NDPI_LOG_DEBUG, "Found dropbox.\n"); ndpi_int_dropbox_add_connection(ndpi_struct, flow, 0); return; |