Fixed false positive with FTP_DATA protocol
Added coherency in application protol guess by exploiting the host server name Various protocol optimizations
This commit is contained in:
@@ -204,8 +204,7 @@ void cb_data(bt_parse_data_cb_t *cbd,int *ret) {
|
||||
if(cbd->t == 0) return;
|
||||
|
||||
if(cbd->t == 1) {
|
||||
|
||||
DEBUG_TRACE(printf("%s %lld\n",cbd->buf,cbd->v.i));
|
||||
DEBUG_TRACE(printf("%s %lld\n",cbd->buf, (long long)cbd->v.i));
|
||||
|
||||
if(STREQ(cbd->buf,"a.port")) {
|
||||
p->a.port = (u_int16_t)(cbd->v.i & 0xffff);
|
||||
@@ -234,7 +233,7 @@ void cb_data(bt_parse_data_cb_t *cbd,int *ret) {
|
||||
p->h_mint = 1;
|
||||
return;
|
||||
}
|
||||
DEBUG_TRACE(printf("UNKNOWN %s %lld\n",cbd->buf,cbd->v.i));
|
||||
DEBUG_TRACE(printf("UNKNOWN %s %lld\n",cbd->buf, (long long)cbd->v.i));
|
||||
return;
|
||||
}
|
||||
if(cbd->t != 2) {
|
||||
|
||||
@@ -130,7 +130,7 @@ void ndpi_search_coap (struct ndpi_detection_module_struct *ndpi_struct,
|
||||
if(h->version == 1) {
|
||||
if(h->type == CON || h->type == NO_CON || h->type == ACK || h->type == RST ) {
|
||||
if(h->tkl < 8) {
|
||||
if((h->code >= 0 && h->code <= 5) || (h->code >= 65 && h->code <= 69) ||
|
||||
if((/* h->code >= 0 && */ h->code <= 5) || (h->code >= 65 && h->code <= 69) ||
|
||||
(h->code >= 128 && h->code <= 134) || (h->code >= 140 && h->code <= 143) ||
|
||||
(h->code >= 160 && h->code <= 165)) {
|
||||
|
||||
|
||||
@@ -318,7 +318,6 @@ static void ndpi_search_directconnect_udp(struct ndpi_detection_module_struct
|
||||
struct ndpi_id_struct *dst = flow->dst;
|
||||
int pos, count = 0;
|
||||
|
||||
|
||||
if (dst != NULL && dst->detected_directconnect_udp_port == packet->udp->dest) {
|
||||
if ((u_int32_t)
|
||||
(packet->tick_timestamp -
|
||||
|
||||
@@ -177,7 +177,6 @@ static void ndpi_check_edonkey(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
/* Encode the direction of the packet in the stage, so we will know when we need to look for the response packet. */
|
||||
flow->edonkey_stage = packet->packet_direction + 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
NDPI_LOG_DBG2(ndpi_struct, "EDONKEY stage %u: \n", flow->edonkey_stage);
|
||||
|
||||
@@ -187,7 +186,7 @@ static void ndpi_check_edonkey(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
}
|
||||
|
||||
/* This is a packet in another direction. Check if we find the proper response. */
|
||||
if((payload_len == 0) || (ndpi_edonkey_payload_check(packet->payload, payload_len))) {
|
||||
if(ndpi_edonkey_payload_check(packet->payload, payload_len)) {
|
||||
NDPI_LOG_INFO(ndpi_struct, "found EDONKEY\n");
|
||||
ndpi_int_edonkey_add_connection(ndpi_struct, flow);
|
||||
} else {
|
||||
|
||||
@@ -62,9 +62,11 @@ static int ndpi_match_ftp_data_directory(struct ndpi_detection_module_struct *nd
|
||||
;
|
||||
} else
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ndpi_match_file_header(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
|
||||
@@ -68,7 +68,6 @@ void ndpi_search_gnutella(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
|
||||
struct ndpi_id_struct *src = flow->src;
|
||||
struct ndpi_id_struct *dst = flow->dst;
|
||||
|
||||
u_int16_t c;
|
||||
|
||||
NDPI_LOG_DBG(ndpi_struct, "search GNUTELLA\n");
|
||||
|
||||
@@ -64,6 +64,8 @@ void ndpi_search_icecast_tcp(struct ndpi_detection_module_struct *ndpi_struct, s
|
||||
goto icecast_exclude;
|
||||
}
|
||||
|
||||
if(flow == NULL) return;
|
||||
|
||||
if((packet->packet_direction == flow->setup_packet_direction)
|
||||
&& (flow->packet_counter < 10)) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user