fix ftp on tcp

This commit is contained in:
Campus
2016-09-22 18:59:56 +02:00
parent 730c8d6879
commit d601b0ce20
2 changed files with 48 additions and 45 deletions
+5 -2
View File
@@ -1,7 +1,7 @@
/* /*
* ftp_control.c * ftp_control.c
* *
* Copyright (C) 2014 Tomasz Bujlow <tomasz@skatnet.dk> * Copyright (C) 2016 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -938,6 +938,9 @@ static void ndpi_check_ftp_control(struct ndpi_detection_module_struct *ndpi_str
struct ndpi_packet_struct *packet = &flow->packet; struct ndpi_packet_struct *packet = &flow->packet;
u_int32_t payload_len = packet->payload_packet_len; u_int32_t payload_len = packet->payload_packet_len;
/* Check connection over TCP */
if(packet->tcp) {
/* Exclude SMTP, which uses similar commands. */ /* Exclude SMTP, which uses similar commands. */
if (packet->tcp->dest == htons(25) || packet->tcp->source == htons(25)) { if (packet->tcp->dest == htons(25) || packet->tcp->source == htons(25)) {
NDPI_LOG(NDPI_PROTOCOL_FTP_CONTROL, ndpi_struct, NDPI_LOG_DEBUG, "Exclude FTP_CONTROL.\n"); NDPI_LOG(NDPI_PROTOCOL_FTP_CONTROL, ndpi_struct, NDPI_LOG_DEBUG, "Exclude FTP_CONTROL.\n");
@@ -979,7 +982,7 @@ static void ndpi_check_ftp_control(struct ndpi_detection_module_struct *ndpi_str
NDPI_LOG(NDPI_PROTOCOL_FTP_CONTROL, ndpi_struct, NDPI_LOG_DEBUG, "The reply did not seem to belong to FTP_CONTROL, resetting the stage to 0...\n"); NDPI_LOG(NDPI_PROTOCOL_FTP_CONTROL, ndpi_struct, NDPI_LOG_DEBUG, "The reply did not seem to belong to FTP_CONTROL, resetting the stage to 0...\n");
flow->ftp_control_stage = 0; flow->ftp_control_stage = 0;
} }
}
} }
} }
+4 -4
View File
@@ -1,8 +1,7 @@
/* /*
* ftp_data.c * ftp_data.c
* *
* Copyright (C) 2014 Tomasz Bujlow <tomasz@skatnet.dk> * Copyright (C) 2016 - ntop.org
* Copyright (C) 2014 - ntop.org
* *
* The signature is based on the Libprotoident library. * The signature is based on the Libprotoident library.
* *
@@ -34,12 +33,13 @@ static void ndpi_int_ftp_data_add_connection(struct ndpi_detection_module_struct
static int ndpi_match_ftp_data_port(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { static int ndpi_match_ftp_data_port(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
struct ndpi_packet_struct *packet = &flow->packet; struct ndpi_packet_struct *packet = &flow->packet;
/* Check connection over TCP */
if(packet->tcp) {
if(packet->tcp->dest == htons(20) || packet->tcp->source == htons(20)) { if(packet->tcp->dest == htons(20) || packet->tcp->source == htons(20)) {
return 1; return 1;
} }
}
return 0; return 0;
} }
static int ndpi_match_ftp_data_directory(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { static int ndpi_match_ftp_data_directory(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {