Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a configuration knob to enable/disable loading of gambling list #2047

Merged
merged 1 commit into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/include/ndpi_typedefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,7 @@ struct ndpi_detection_module_struct {
u_int64_t current_ts;
u_int16_t max_packets_to_process;
u_int16_t num_tls_blocks_to_follow;
u_int8_t skip_tls_blocks_until_change_cipher:1, enable_ja3_plus:1, _notused:6;
u_int8_t skip_tls_blocks_until_change_cipher:1, enable_ja3_plus:1, enable_load_gambling_list:1, _notused:5;
u_int8_t tls_certificate_expire_in_x_days;

void *user_data;
Expand Down Expand Up @@ -1744,6 +1744,7 @@ typedef enum {
ndpi_enable_tcp_ack_payload_heuristic = (1 << 17),
ndpi_dont_load_crawlers_list = (1 << 18),
ndpi_dont_load_protonvpn_list = (1 << 19),
ndpi_dont_load_gambling_list = (1 << 20),
} ndpi_prefs;

typedef struct {
Expand Down
9 changes: 7 additions & 2 deletions src/lib/ndpi_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -941,8 +941,9 @@ static void init_string_based_protocols(struct ndpi_detection_module_struct *ndp
for(i = 0; host_match[i].string_to_match != NULL; i++)
ndpi_init_protocol_match(ndpi_str, &host_match[i]);

for(i = 0; ndpi_protocol_gambling_hostname_list[i].string_to_match != NULL; i++)
ndpi_init_protocol_match(ndpi_str, &ndpi_protocol_gambling_hostname_list[i]);
if(ndpi_str->enable_load_gambling_list)
for(i = 0; ndpi_protocol_gambling_hostname_list[i].string_to_match != NULL; i++)
ndpi_init_protocol_match(ndpi_str, &ndpi_protocol_gambling_hostname_list[i]);

/* ************************ */

Expand Down Expand Up @@ -2776,6 +2777,10 @@ struct ndpi_detection_module_struct *ndpi_init_detection_module(ndpi_init_prefs
if(prefs & ndpi_enable_ja3_plus)
ndpi_str->enable_ja3_plus = 1;

ndpi_str->enable_load_gambling_list = 1;
if(prefs & ndpi_dont_load_gambling_list)
ndpi_str->enable_load_gambling_list = 0;

if(!(prefs & ndpi_dont_init_libgcrypt)) {
if(!gcry_control (GCRYCTL_INITIALIZATION_FINISHED_P)) {
const char *gcrypt_ver = gcry_check_version(NULL);
Expand Down
Loading