Go to the documentation of this file.
34 static int g_file_match_list_id = 0;
38 static void DetectFileMd5RegisterTests(
void);
77 static int MD5MatchLookupString(
ROHashTable *hash,
const char *
string)
81 void *ptr =
ROHashLookup(hash, &md5, (uint16_t)
sizeof(md5));
90 static int MD5MatchTest01(
void)
107 FAIL_IF(MD5MatchLookupString(hash,
"d80f93a93dc5f3ee945704754d6e0a36") != 1);
108 FAIL_IF(MD5MatchLookupString(hash,
"92a49985b384f0d993a36e4c2d45e206") != 1);
109 FAIL_IF(MD5MatchLookupString(hash,
"11adeaacc8c309815f7bc3e33888f281") != 1);
110 FAIL_IF(MD5MatchLookupString(hash,
"22e10a8fe02344ade0bea8836a1714af") != 1);
111 FAIL_IF(MD5MatchLookupString(hash,
"c3db2cbf02c68f073afcaee5634677bc") != 1);
112 FAIL_IF(MD5MatchLookupString(hash,
"7ed095da259638f42402fb9e74287a17") != 1);
114 FAIL_IF(MD5MatchLookupString(hash,
"33333333333333333333333333333333") == 1);
119 void DetectFileMd5RegisterTests(
void)
#define FAIL_IF_NULL(expr)
Fail a test if expression evaluates to NULL.
SigTableElmt * sigmatch_table
void(* Free)(DetectEngineCtx *, void *)
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
int(* FileMatch)(DetectEngineThreadCtx *, Flow *, uint8_t flags, File *, const Signature *, const SigMatchCtx *)
main detection engine ctx
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
int ROHashInitFinalize(ROHashTable *table)
create final hash data structure
void DetectFileHashFree(DetectEngineCtx *de_ctx, void *ptr)
this function will free memory associated with DetectFileHashData
#define PASS
Pass the test.
int DetectFileHashSetup(DetectEngineCtx *de_ctx, Signature *s, const char *str, uint16_t type, int list)
this function is used to parse filemd5, filesha1 and filesha256 options
void * ROHashLookup(ROHashTable *table, void *data, uint16_t size)
int DetectFileHashMatch(DetectEngineThreadCtx *det_ctx, Flow *f, uint8_t flags, File *file, const Signature *s, const SigMatchCtx *m)
Match the specified file hash.
#define FAIL_IF(expr)
Fail a test if expression evaluates to true.
int DetectBufferTypeRegister(const char *name)
ROHashTable * ROHashInit(uint8_t hash_bits, uint16_t item_size)
initialize a new rohash
void ROHashFree(ROHashTable *table)
int LoadHashTable(ROHashTable *hash_table, const char *string, const char *filename, int line_no, uint32_t type)
Store a hash into the hash table.
int ReadHashString(uint8_t *hash, const char *string, const char *filename, int line_no, uint16_t expected_len)
Read the bytes of a hash from an hexadecimal string.
void(* RegisterTests)(void)
void DetectFileMd5Register(void)
Registration function for keyword: filemd5.