[SCANNER]add hyperscan libs

This commit is contained in:
liuwentan
2022-10-27 17:58:52 +08:00
parent 6d7354a866
commit 6881611975
18 changed files with 3254 additions and 11 deletions

31
src/maat_api.cpp Normal file
View File

@@ -0,0 +1,31 @@
#include <stdio.h>
#include <hs/hs.h>
#include "../include/maat/maat.h"
int maat_scan_ipv4(struct maat_feather *feather, struct maat_scan_state *state,
const struct ipv4_tuple4 *tuple4, unsigned int *matched_ids, size_t n_match_id)
{
return 0;
}
int maat_scan_string(struct maat_feather *feather, int table_id, struct maat_scan_state *state,
const char *data, size_t length)
{
return 0;
}
int maat_hyperscan_compile(char *pattern)
{
hs_database_t *database;
hs_compile_error_t *compile_err;
if (hs_compile(pattern, HS_FLAG_DOTALL, HS_MODE_BLOCK, NULL, &database,
&compile_err) != HS_SUCCESS) {
fprintf(stderr, "ERROR: Unable to compile pattern \"%s\": %s\n",
pattern, compile_err->message);
hs_free_compile_error(compile_err);
return -1;
}
return 0;
}