aboutsummaryrefslogtreecommitdiff
path: root/fuzz/fuzz_ndpi_reader.c
diff options
context:
space:
mode:
Diffstat (limited to 'fuzz/fuzz_ndpi_reader.c')
-rw-r--r--fuzz/fuzz_ndpi_reader.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/fuzz/fuzz_ndpi_reader.c b/fuzz/fuzz_ndpi_reader.c
index ed0fb96b2..d849ee9ca 100644
--- a/fuzz/fuzz_ndpi_reader.c
+++ b/fuzz/fuzz_ndpi_reader.c
@@ -25,6 +25,7 @@ FILE *fingerprint_fp = NULL;
bool do_load_lists = true;
char *addr_dump_path = NULL;
int monitoring_enabled = 1;
+char *protocolsDirPath = "./lists/protocols/";
extern void ndpi_report_payload_stats(FILE *out);
@@ -65,7 +66,6 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
struct pcap_pkthdr *header;
int r;
char errbuf[PCAP_ERRBUF_SIZE];
- NDPI_PROTOCOL_BITMASK all;
u_int i;
FILE *fd;
@@ -101,17 +101,21 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
ndpi_load_malicious_ja4_file(workflow->ndpi_struct, "ja4_fingerprints.csv");
ndpi_load_malicious_sha1_file(workflow->ndpi_struct, "sha1_fingerprints.csv");
- // enable all protocols
- NDPI_BITMASK_SET_ALL(all);
- ndpi_set_protocol_detection_bitmask2(workflow->ndpi_struct, &all);
+#ifdef ENABLE_ONLY_SUBCLASSIFICATION
+ ndpi_set_config(workflow->ndpi_struct, NULL, "filename.config", "only_classification.conf");
+#else
ndpi_set_config(workflow->ndpi_struct, NULL, "packets_limit_per_flow", "255");
ndpi_set_config(workflow->ndpi_struct, NULL, "flow.track_payload", "1");
ndpi_set_config(workflow->ndpi_struct, NULL, "tcp_ack_payload_heuristic", "1");
+ ndpi_set_config(workflow->ndpi_struct, NULL, "fully_encrypted_heuristic", "1");
+ ndpi_set_config(workflow->ndpi_struct, "dns", "subclassification", "1");
ndpi_set_config(workflow->ndpi_struct, "tls", "application_blocks_tracking", "1");
+#ifndef ENABLE_CONFIG2
ndpi_set_config(workflow->ndpi_struct, "stun", "max_packets_extra_dissection", "40");
ndpi_set_config(workflow->ndpi_struct, "zoom", "max_packets_extra_dissection", "255");
ndpi_set_config(workflow->ndpi_struct, "rtp", "search_for_stun", "1");
+#endif
ndpi_set_config(workflow->ndpi_struct, "openvpn", "dpi.heuristics", "0x01");
ndpi_set_config(workflow->ndpi_struct, "openvpn", "dpi.heuristics.num_messages", "20");
ndpi_set_config(workflow->ndpi_struct, "tls", "metadata.ja4r_fingerprint", "1");
@@ -120,8 +124,19 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
ndpi_set_config(workflow->ndpi_struct, "stun", "monitoring", "1");
ndpi_set_config(workflow->ndpi_struct, NULL, "dpi.address_cache_size", "8192");
+#ifdef ENABLE_CONFIG2
+ ndpi_set_config(workflow->ndpi_struct, NULL, "flow_risk.all.info", "0");
+ ndpi_set_config(workflow->ndpi_struct, NULL, "metadata.tcp_fingerprint_format", "1");
+#endif
+
+#endif /* ENABLE_ONLY_SUBCLASSIFICATION */
+
ndpi_finalize_initialization(workflow->ndpi_struct);
+#ifdef ENABLE_FINGERPRINT_FP
+ fingerprint_fp = stdout;
+#endif
+
#ifdef CRYPT_FORCE_NO_AESNI
force_no_aesni = 1;
#endif