fuzz: pl7m: add a custom mutator for better fuzzing of pcap files (#2483)
Pl7m is a custom mutator (used for structure aware fuzzing) for network traffic packet captures (i.e. pcap files). The output of the mutator is always a valid pcap file, containing the same flows/sessions of the input file. That's it: the mutator only changes the packet payload after the TCP/UDP header, keeping all the original L2/L3 information (IP addresses and L4 ports). See: https://github.com/IvanNardi/pl7m
This commit is contained in:
@@ -8,6 +8,10 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef ENABLE_PCAP_L7_MUTATOR
|
||||
#include "pl7m.h"
|
||||
#endif
|
||||
|
||||
struct ndpi_workflow_prefs *prefs = NULL;
|
||||
struct ndpi_workflow *workflow = NULL;
|
||||
struct ndpi_global_context *g_ctx;
|
||||
@@ -24,6 +28,13 @@ extern void ndpi_report_payload_stats(FILE *out);
|
||||
extern int force_no_aesni;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_PCAP_L7_MUTATOR
|
||||
size_t LLVMFuzzerCustomMutator(uint8_t *Data, size_t Size,
|
||||
size_t MaxSize, unsigned int Seed) {
|
||||
return pl7m_mutator(Data, Size, MaxSize, Seed);
|
||||
}
|
||||
#endif
|
||||
|
||||
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
||||
pcap_t * pkts;
|
||||
const u_char *pkt;
|
||||
|
||||
Reference in New Issue
Block a user