* fixed [h]euristic typo Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
@@ -963,9 +963,6 @@ extern "C" {
|
||||
void set_ndpi_flow_free(void (*__ndpi_flow_free)(void *ptr));
|
||||
void set_ndpi_debug_function(struct ndpi_detection_module_struct *ndpi_str,
|
||||
ndpi_debug_function_ptr ndpi_debug_printf);
|
||||
//void * ndpi_malloc(size_t size);
|
||||
//void * ndpi_calloc(unsigned long count, size_t size);
|
||||
//void ndpi_free(void *ptr);
|
||||
u_int16_t ndpi_get_api_version(void);
|
||||
const char *ndpi_get_gcrypt_version(void);
|
||||
|
||||
@@ -986,6 +983,9 @@ extern "C" {
|
||||
char *buffer, u_int buffer_size,
|
||||
u_int8_t min_string_match_len, /* Will return 0 if no string > min_string_match_len have been found */
|
||||
char *outbuf, u_int outbuf_len);
|
||||
/* Return a flow info string (summarized). Does only work for DNS/HTTP/TLS/QUIC. */
|
||||
const char* ndpi_get_flow_info(struct ndpi_flow_struct const * const flow,
|
||||
ndpi_protocol const * const l7_protocol);
|
||||
char* ndpi_ssl_version2str(struct ndpi_flow_struct *flow,
|
||||
u_int16_t version, u_int8_t *unknown_tls_version);
|
||||
int ndpi_netbios_name_interpret(u_char *in, u_int in_len, u_char *out, u_int out_len);
|
||||
|
||||
@@ -1245,9 +1245,9 @@ typedef enum {
|
||||
|
||||
#define MAX_NUM_TLS_SIGNATURE_ALGORITHMS 16
|
||||
|
||||
struct tls_euristics {
|
||||
struct tls_heuristics {
|
||||
/*
|
||||
TLS euristics for detecting browsers usage
|
||||
TLS heuristics for detecting browsers usage
|
||||
NOTE: expect false positives
|
||||
*/
|
||||
u_int8_t is_safari_tls:1, is_firefox_tls:1, is_chrome_tls:1, notused:5;
|
||||
@@ -1364,7 +1364,7 @@ struct ndpi_flow_struct {
|
||||
u_int16_t client_signature_algorithms[MAX_NUM_TLS_SIGNATURE_ALGORITHMS];
|
||||
#endif
|
||||
|
||||
struct tls_euristics browser_euristics;
|
||||
struct tls_heuristics browser_heuristics;
|
||||
|
||||
struct {
|
||||
u_int16_t cipher_suite;
|
||||
|
||||
@@ -846,6 +846,41 @@ int ndpi_has_human_readeable_string(struct ndpi_detection_module_struct *ndpi_st
|
||||
|
||||
/* ********************************** */
|
||||
|
||||
static const char* ndpi_get_flow_info_by_proto_id(struct ndpi_flow_struct const * const flow,
|
||||
u_int16_t proto_id)
|
||||
{
|
||||
switch (proto_id)
|
||||
{
|
||||
case NDPI_PROTOCOL_DNS:
|
||||
case NDPI_PROTOCOL_HTTP:
|
||||
return (char const *)flow->host_server_name;
|
||||
case NDPI_PROTOCOL_QUIC:
|
||||
case NDPI_PROTOCOL_TLS:
|
||||
if (flow->l4.tcp.tls.hello_processed != 0)
|
||||
{
|
||||
return flow->protos.tls_quic_stun.tls_quic.client_requested_server_name;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* ndpi_get_flow_info(struct ndpi_flow_struct const * const flow,
|
||||
ndpi_protocol const * const l7_protocol)
|
||||
{
|
||||
char const * const app_protocol_info = ndpi_get_flow_info_by_proto_id(flow, l7_protocol->app_protocol);
|
||||
|
||||
if (app_protocol_info != NULL)
|
||||
{
|
||||
return app_protocol_info;
|
||||
}
|
||||
|
||||
return ndpi_get_flow_info_by_proto_id(flow, l7_protocol->master_protocol);
|
||||
}
|
||||
|
||||
/* ********************************** */
|
||||
|
||||
char* ndpi_ssl_version2str(struct ndpi_flow_struct *flow,
|
||||
u_int16_t version, u_int8_t *unknown_tls_version) {
|
||||
|
||||
|
||||
+13
-13
@@ -1593,12 +1593,12 @@ int processClientServerHello(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
this is time consuming and we want to avoid overhead whem possible
|
||||
*/
|
||||
if(this_is_not_safari)
|
||||
flow->protos.tls_quic_stun.tls_quic.browser_euristics.is_safari_tls = 0;
|
||||
flow->protos.tls_quic_stun.tls_quic.browser_heuristics.is_safari_tls = 0;
|
||||
else if((safari_ciphers == 12) || (this_is_not_safari && looks_like_safari_on_big_sur))
|
||||
flow->protos.tls_quic_stun.tls_quic.browser_euristics.is_safari_tls = 1;
|
||||
flow->protos.tls_quic_stun.tls_quic.browser_heuristics.is_safari_tls = 1;
|
||||
|
||||
if(chrome_ciphers == 13)
|
||||
flow->protos.tls_quic_stun.tls_quic.browser_euristics.is_chrome_tls = 1;
|
||||
flow->protos.tls_quic_stun.tls_quic.browser_heuristics.is_chrome_tls = 1;
|
||||
|
||||
/* Note that both Safari and Chrome can overlap */
|
||||
#ifdef DEBUG_HEURISTIC
|
||||
@@ -1865,7 +1865,7 @@ int processClientServerHello(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
#endif
|
||||
switch(signature_algo) {
|
||||
case ECDSA_SECP521R1_SHA512:
|
||||
flow->protos.tls_quic_stun.tls_quic.browser_euristics.is_firefox_tls = 1;
|
||||
flow->protos.tls_quic_stun.tls_quic.browser_heuristics.is_firefox_tls = 1;
|
||||
break;
|
||||
|
||||
case ECDSA_SECP256R1_SHA256:
|
||||
@@ -1891,23 +1891,23 @@ int processClientServerHello(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
safari_signature_algorithms, chrome_signature_algorithms);
|
||||
#endif
|
||||
|
||||
if(flow->protos.tls_quic_stun.tls_quic.browser_euristics.is_firefox_tls)
|
||||
flow->protos.tls_quic_stun.tls_quic.browser_euristics.is_safari_tls = 0,
|
||||
flow->protos.tls_quic_stun.tls_quic.browser_euristics.is_chrome_tls = 0;
|
||||
if(flow->protos.tls_quic_stun.tls_quic.browser_heuristics.is_firefox_tls)
|
||||
flow->protos.tls_quic_stun.tls_quic.browser_heuristics.is_safari_tls = 0,
|
||||
flow->protos.tls_quic_stun.tls_quic.browser_heuristics.is_chrome_tls = 0;
|
||||
|
||||
if(safari_signature_algorithms != 8)
|
||||
flow->protos.tls_quic_stun.tls_quic.browser_euristics.is_safari_tls = 0;
|
||||
flow->protos.tls_quic_stun.tls_quic.browser_heuristics.is_safari_tls = 0;
|
||||
|
||||
if((chrome_signature_algorithms != 8) || duplicate_found)
|
||||
flow->protos.tls_quic_stun.tls_quic.browser_euristics.is_chrome_tls = 0;
|
||||
flow->protos.tls_quic_stun.tls_quic.browser_heuristics.is_chrome_tls = 0;
|
||||
|
||||
/* Avoid Chrome and Safari overlaps, thing that cannot happen with Firefox */
|
||||
if(flow->protos.tls_quic_stun.tls_quic.browser_euristics.is_safari_tls)
|
||||
flow->protos.tls_quic_stun.tls_quic.browser_euristics.is_chrome_tls = 0;
|
||||
if(flow->protos.tls_quic_stun.tls_quic.browser_heuristics.is_safari_tls)
|
||||
flow->protos.tls_quic_stun.tls_quic.browser_heuristics.is_chrome_tls = 0;
|
||||
|
||||
if((flow->protos.tls_quic_stun.tls_quic.browser_euristics.is_chrome_tls == 0)
|
||||
if((flow->protos.tls_quic_stun.tls_quic.browser_heuristics.is_chrome_tls == 0)
|
||||
&& duplicate_found)
|
||||
flow->protos.tls_quic_stun.tls_quic.browser_euristics.is_safari_tls = 1; /* Safari */
|
||||
flow->protos.tls_quic_stun.tls_quic.browser_heuristics.is_safari_tls = 1; /* Safari */
|
||||
|
||||
#ifdef DEBUG_HEURISTIC
|
||||
printf("[SIGNATURE] [is_firefox_tls: %u][is_chrome_tls: %u][is_safari_tls: %u][duplicate_found: %u]\n",
|
||||
|
||||
Reference in New Issue
Block a user