// Threat-intel list parsing (downloaded feed bodies) + IOC set loading. #include "strawberry/ioc_set.hpp" #include "strawberry/rule_updater.hpp" #include #include #include #include #include extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (size == 0) return 0; static const char* kinds[] = {"hashes", "domains", "ips", "nets"}; const std::string kind = kinds[data[0] % 4]; const std::string text(reinterpret_cast(data) + 1, size - 1); std::vector out; strawberry::parse_ioc_list(kind, text, 10000, out); // The daemon loads normalized lists from disk: feed the raw text too. static const std::string path = "/tmp/strawberry-fuzz-ioc-" + std::to_string(::getpid()) + ".txt"; if (FILE* f = std::fopen(path.c_str(), "wb")) { std::fwrite(text.data(), 1, text.size(), f); std::fclose(f); strawberry::IocNetSet nets; nets.load({{"ips", path}}, {{"nets", path}}); (void) nets.find("1.2.3.4"); (void) nets.find("2001:db8::1"); strawberry::IocHashSet hashes; hashes.load({{"hashes", path}}); (void) hashes.find(std::string(64, 'a')); } return 0; }