Replaced malicious JA3-md5/SSL-cert-sha1 ac automata with hashmaps.

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
Toni Uhlig
2022-07-04 16:05:22 +02:00
committed by Ivan Nardi
parent 4ff8aa48b2
commit b3d3e3b210
4 changed files with 56 additions and 85 deletions
+8 -10
View File
@@ -971,6 +971,12 @@ typedef struct _ndpi_automa {
void *ac_automa; /* Real type is AC_AUTOMATA_t */
} ndpi_automa;
typedef struct ndpi_str_hash {
unsigned int hash;
void *value;
u_int8_t private_data[0];
} ndpi_str_hash;
typedef struct ndpi_proto {
/*
Note
@@ -1060,8 +1066,8 @@ struct ndpi_detection_module_struct {
/* HTTP/DNS/HTTPS/QUIC host matching */
ndpi_automa host_automa, /* Used for DNS/HTTPS */
risky_domain_automa, tls_cert_subject_automa,
malicious_ja3_automa, malicious_sha1_automa,
host_risk_mask_automa, common_alpns_automa;
host_risk_mask_automa, common_alpns_automa;
ndpi_str_hash *malicious_ja3_hashmap, *malicious_sha1_hashmap;
/* IMPORTANT: please update ndpi_finalize_initialization() whenever you add a new automa */
ndpi_list *trusted_issuer_dn;
@@ -1623,14 +1629,6 @@ struct ndpi_bin {
/* **************************************** */
typedef struct ndpi_str_hash {
unsigned int hash;
void *value;
u_int8_t private_data[0];
} ndpi_str_hash;
/* **************************************** */
#define HW_HISTORY_LEN 4
#define MAX_SQUARE_ERROR_ITERATIONS 64 /* MUST be < num_values_rollup (256 max) */