config: allow configuration of guessing algorithms
This commit is contained in:
+11
-2
@@ -194,6 +194,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
sprintf(cfg_value, "%d", value);
|
||||
ndpi_set_config(ndpi_info_mod, NULL, "libgcrypt.init", cfg_value);
|
||||
}
|
||||
if(fuzzed_data.ConsumeBool()) {
|
||||
value = fuzzed_data.ConsumeIntegralInRange(0, 0x03 + 1);
|
||||
sprintf(cfg_value, "%d", value);
|
||||
ndpi_set_config(ndpi_info_mod, NULL, "guess_on_giveup", cfg_value);
|
||||
}
|
||||
if(fuzzed_data.ConsumeBool()) {
|
||||
value = fuzzed_data.ConsumeIntegralInRange(0, 1 + 1);
|
||||
sprintf(cfg_value, "%d", value);
|
||||
@@ -214,7 +219,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
sprintf(cfg_value, "%d", value);
|
||||
ndpi_set_config(ndpi_info_mod, NULL, "flow_risk.crawler_bot.list.load", cfg_value);
|
||||
}
|
||||
|
||||
if(fuzzed_data.ConsumeBool()) {
|
||||
value = fuzzed_data.ConsumeIntegralInRange(0, 3 + 1);
|
||||
sprintf(cfg_value, "%d", value);
|
||||
ndpi_set_config(ndpi_info_mod, NULL, "log.level", cfg_value);
|
||||
}
|
||||
if(fuzzed_data.ConsumeBool()) {
|
||||
value = fuzzed_data.ConsumeIntegralInRange(0, 16777215 / 2); /* max / 2 instead of max + 1 to avoid oom on oss-fuzzer */
|
||||
sprintf(cfg_value, "%d", value);
|
||||
@@ -344,7 +353,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
std::vector<uint8_t>pkt = fuzzed_data.ConsumeRemainingBytes<uint8_t>();
|
||||
|
||||
ndpi_detection_process_packet(ndpi_info_mod, &flow, pkt.data(), pkt.size(), 0, &input_info);
|
||||
p = ndpi_detection_giveup(ndpi_info_mod, &flow, 1, &protocol_was_guessed);
|
||||
p = ndpi_detection_giveup(ndpi_info_mod, &flow, &protocol_was_guessed);
|
||||
|
||||
assert(p.master_protocol == ndpi_get_flow_masterprotocol(ndpi_info_mod, &flow));
|
||||
assert(p.app_protocol == ndpi_get_flow_appprotocol(ndpi_info_mod, &flow));
|
||||
|
||||
@@ -12,7 +12,7 @@ struct ndpi_workflow_prefs *prefs = NULL;
|
||||
struct ndpi_workflow *workflow = NULL;
|
||||
|
||||
u_int32_t current_ndpi_memory = 0, max_ndpi_memory = 0;
|
||||
u_int8_t enable_protocol_guess = 1, enable_payload_analyzer = 0;
|
||||
u_int8_t enable_payload_analyzer = 0;
|
||||
u_int8_t enable_flow_stats = 1;
|
||||
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 = 80 /* due to telnet */;
|
||||
|
||||
@@ -23,7 +23,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
||||
ndpi_protocol detected_protocol =
|
||||
ndpi_detection_process_packet(ndpi_info_mod, &ndpi_flow, Data, Size, 0, NULL);
|
||||
ndpi_protocol guessed_protocol =
|
||||
ndpi_detection_giveup(ndpi_info_mod, &ndpi_flow, 1, &protocol_was_guessed);
|
||||
ndpi_detection_giveup(ndpi_info_mod, &ndpi_flow, &protocol_was_guessed);
|
||||
|
||||
ndpi_reset_serializer(&json_serializer);
|
||||
ndpi_reset_serializer(&csv_serializer);
|
||||
|
||||
@@ -6,10 +6,8 @@
|
||||
#include <stdio.h>
|
||||
#include "fuzzer/FuzzedDataProvider.h"
|
||||
|
||||
char *_debug_protocols;
|
||||
int nDPI_LogLevel = 0;
|
||||
u_int32_t current_ndpi_memory = 0, max_ndpi_memory = 0;
|
||||
u_int8_t enable_protocol_guess = 1, enable_payload_analyzer = 0;
|
||||
u_int8_t enable_payload_analyzer = 0;
|
||||
u_int8_t enable_flow_stats = 0;
|
||||
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 = 80 /* due to telnet */;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
extern u_int8_t enable_doh_dot_detection;
|
||||
|
||||
u_int32_t current_ndpi_memory = 0, max_ndpi_memory = 0;
|
||||
u_int8_t enable_protocol_guess = 1, enable_payload_analyzer = 0;
|
||||
u_int8_t enable_payload_analyzer = 0;
|
||||
u_int8_t enable_flow_stats = 0;
|
||||
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 = 80 /* due to telnet */;
|
||||
|
||||
Reference in New Issue
Block a user