SMTP and SSH dissection fixes
This commit is contained in:
@@ -89,7 +89,7 @@ static u_int8_t stats_flag = 0, bpf_filter_flag = 0;
|
||||
static u_int8_t file_first_time = 1;
|
||||
#endif
|
||||
u_int8_t human_readeable_string_len = 5;
|
||||
u_int8_t max_num_udp_dissected_pkts = 16 /* 8 is enough for most protocols, Signal requires more */, max_num_tcp_dissected_pkts = 10;
|
||||
u_int8_t max_num_udp_dissected_pkts = 16 /* 8 is enough for most protocols, Signal requires more */, max_num_tcp_dissected_pkts = 16;
|
||||
static u_int32_t pcap_analysis_duration = (u_int32_t)-1;
|
||||
static u_int16_t decode_tunnels = 0;
|
||||
static u_int16_t num_loops = 1;
|
||||
|
||||
@@ -488,6 +488,7 @@ static ndpi_network host_protocol_list[] = {
|
||||
{ 0x344E0000 /* 52.78.0.0/16 */, 16, NDPI_PROTOCOL_AMAZON },
|
||||
{ 0x344F0000 /* 52.79.0.0/16 */, 16, NDPI_PROTOCOL_AMAZON },
|
||||
{ 0x34520000 /* 52.82.0.0/14 */, 14, NDPI_PROTOCOL_AMAZON },
|
||||
{ 0x34540000 /* 52.84.0.0/14 */, 14, NDPI_PROTOCOL_AMAZON },
|
||||
{ 0x34580000 /* 52.88.0.0/13 */, 13, NDPI_PROTOCOL_AMAZON },
|
||||
{ 0x345A0000 /* 52.90.0.0/15 */, 15, NDPI_PROTOCOL_AMAZON },
|
||||
{ 0x345EE000 /* 52.94.224.0/19 */, 19, NDPI_PROTOCOL_AMAZON },
|
||||
|
||||
@@ -283,12 +283,14 @@ int ndpi_extra_search_mail_smtp_tcp(struct ndpi_detection_module_struct *ndpi_st
|
||||
|
||||
static void smtpInitExtraPacketProcessing(struct ndpi_flow_struct *flow) {
|
||||
#ifdef SMTP_DEBUG
|
||||
printf("**** %s()\n", __FUNCTION__);
|
||||
static u_int num = 0;
|
||||
|
||||
printf("**** %s(%u)\n", __FUNCTION__, ++num);
|
||||
#endif
|
||||
|
||||
flow->check_extra_packets = 1;
|
||||
/* At most 7 packets should almost always be enough */
|
||||
flow->max_extra_packets_to_check = 7;
|
||||
flow->max_extra_packets_to_check = 12;
|
||||
flow->extra_packets_func = ndpi_extra_search_mail_smtp_tcp;
|
||||
}
|
||||
|
||||
|
||||
+27
-1
@@ -56,6 +56,8 @@
|
||||
|
||||
/* #define SSH_DEBUG 1 */
|
||||
|
||||
static void ndpi_search_ssh_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
|
||||
/* ************************************************************************ */
|
||||
|
||||
static void ndpi_int_ssh_add_connection(struct ndpi_detection_module_struct
|
||||
@@ -213,7 +215,23 @@ static void ndpi_ssh_zap_cr(char *str, int len) {
|
||||
|
||||
/* ************************************************************************ */
|
||||
|
||||
void ndpi_search_ssh_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
static int search_ssh_again(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
ndpi_search_ssh_tcp(ndpi_struct, flow);
|
||||
|
||||
if((flow->protos.ssh.hassh_client[0] != '\0')
|
||||
&& (flow->protos.ssh.hassh_server[0] == '\0')) {
|
||||
/* stop extra processing */
|
||||
flow->extra_packets_func = NULL; /* We're good now */
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Possibly more processing */
|
||||
return(1);
|
||||
}
|
||||
|
||||
/* ************************************************************************ */
|
||||
|
||||
static void ndpi_search_ssh_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
#ifdef SSH_DEBUG
|
||||
@@ -238,6 +256,13 @@ void ndpi_search_ssh_tcp(struct ndpi_detection_module_struct *ndpi_struct, struc
|
||||
NDPI_LOG_DBG2(ndpi_struct, "ssh stage 0 passed\n");
|
||||
flow->l4.tcp.ssh_stage = 1 + packet->packet_direction;
|
||||
flow->guessed_host_protocol_id = flow->guessed_protocol_id = NDPI_PROTOCOL_SSH;
|
||||
ndpi_int_ssh_add_connection(ndpi_struct, flow);
|
||||
|
||||
/* This is necessary to inform the core to call this dissector again */
|
||||
flow->check_extra_packets = 1;
|
||||
flow->max_extra_packets_to_check = 8;
|
||||
flow->extra_packets_func = search_ssh_again;
|
||||
|
||||
return;
|
||||
}
|
||||
} else if(flow->l4.tcp.ssh_stage == (2 - packet->packet_direction)) {
|
||||
@@ -327,6 +352,7 @@ void ndpi_search_ssh_tcp(struct ndpi_detection_module_struct *ndpi_struct, struc
|
||||
if(flow->l4.tcp.ssh_stage++ == 4) {
|
||||
NDPI_LOG_INFO(ndpi_struct, "found ssh\n");
|
||||
ndpi_int_ssh_add_connection(ndpi_struct, flow);
|
||||
flow->extra_packets_func = NULL; /* We're good now */
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user