You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
suricata/src/detect-rawbytes.c

48 lines
1.2 KiB
C

/* RAWBYTES part of the detection engine. */
#include "suricata-common.h"
#include "decode.h"
#include "detect.h"
#include "flow-var.h"
#include "detect-content.h"
#include "detect-pcre.h"
#include "util-debug.h"
static int DetectRawbytesSetup (DetectEngineCtx *, Signature *, char *);
void DetectRawbytesRegister (void) {
sigmatch_table[DETECT_RAWBYTES].name = "rawbytes";
sigmatch_table[DETECT_RAWBYTES].Match = NULL;
sigmatch_table[DETECT_RAWBYTES].Setup = DetectRawbytesSetup;
sigmatch_table[DETECT_RAWBYTES].Free = NULL;
sigmatch_table[DETECT_RAWBYTES].RegisterTests = NULL;
sigmatch_table[DETECT_RAWBYTES].flags |= SIGMATCH_NOOPT;
sigmatch_table[DETECT_RAWBYTES].flags |= SIGMATCH_PAYLOAD;
}
int DetectRawbytesSetup (DetectEngineCtx *de_ctx, Signature *s, char *nullstr)
{
if (nullstr != NULL) {
SCLogError(SC_ERR_INVALID_VALUE, "nocase has no value");
return -1;
}
if (s->pmatch_tail == NULL)
return -1;
SigMatch *pm = DetectContentFindPrevApplicableSM(s->pmatch_tail);
if (pm != NULL) {
if (pm->type == DETECT_CONTENT) {
DetectContentData *cd = (DetectContentData *)pm->ctx;
cd->flags |= DETECT_CONTENT_RAWBYTES;
}
}
return 0;
}