|
|
|
@ -47,25 +47,18 @@
|
|
|
|
|
#include "util-unittest-helper.h"
|
|
|
|
|
#include "stream-tcp.h"
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_RUST
|
|
|
|
|
#include "rust.h"
|
|
|
|
|
#include "rust-smb-detect-gen.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#define PARSE_REGEX "^\\s*([0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12})(?:\\s*,(<|>|=|!)([0-9]{1,5}))?(?:\\s*,(any_frag))?\\s*$"
|
|
|
|
|
|
|
|
|
|
static pcre *parse_regex = NULL;
|
|
|
|
|
static pcre_extra *parse_regex_study = NULL;
|
|
|
|
|
|
|
|
|
|
static int DetectDceIfaceMatch(ThreadVars *, DetectEngineThreadCtx *,
|
|
|
|
|
Flow *, uint8_t, void *, void *,
|
|
|
|
|
const Signature *, const SigMatchCtx *);
|
|
|
|
|
#ifdef HAVE_RUST
|
|
|
|
|
static int DetectDceIfaceMatchRust(ThreadVars *t,
|
|
|
|
|
DetectEngineThreadCtx *det_ctx,
|
|
|
|
|
Flow *f, uint8_t flags, void *state, void *txv,
|
|
|
|
|
const Signature *s, const SigMatchCtx *m);
|
|
|
|
|
#endif
|
|
|
|
|
static int DetectDceIfaceSetup(DetectEngineCtx *, Signature *, const char *);
|
|
|
|
|
static void DetectDceIfaceFree(void *);
|
|
|
|
|
static void DetectDceIfaceRegisterTests(void);
|
|
|
|
@ -84,11 +77,7 @@ void DetectDceIfaceRegister(void)
|
|
|
|
|
{
|
|
|
|
|
sigmatch_table[DETECT_DCE_IFACE].name = "dce_iface";
|
|
|
|
|
sigmatch_table[DETECT_DCE_IFACE].Match = NULL;
|
|
|
|
|
#ifdef HAVE_RUST
|
|
|
|
|
sigmatch_table[DETECT_DCE_IFACE].AppLayerTxMatch = DetectDceIfaceMatchRust;
|
|
|
|
|
#else
|
|
|
|
|
sigmatch_table[DETECT_DCE_IFACE].AppLayerTxMatch = DetectDceIfaceMatch;
|
|
|
|
|
#endif
|
|
|
|
|
sigmatch_table[DETECT_DCE_IFACE].Setup = DetectDceIfaceSetup;
|
|
|
|
|
sigmatch_table[DETECT_DCE_IFACE].Free = DetectDceIfaceFree;
|
|
|
|
|
sigmatch_table[DETECT_DCE_IFACE].RegisterTests = DetectDceIfaceRegisterTests;
|
|
|
|
@ -246,11 +235,6 @@ static DetectDceIfaceData *DetectDceIfaceArgParse(const char *arg)
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DCERPCState *DetectDceGetState(AppProto alproto, void *alstate)
|
|
|
|
|
{
|
|
|
|
|
return alstate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \internal
|
|
|
|
|
* \brief Internal function that compares the dce interface version for this
|
|
|
|
@ -302,7 +286,7 @@ static int DetectDceIfaceMatch(ThreadVars *t, DetectEngineThreadCtx *det_ctx,
|
|
|
|
|
const DetectDceIfaceData *dce_data = (DetectDceIfaceData *)m;
|
|
|
|
|
|
|
|
|
|
DCERPCUuidEntry *item = NULL;
|
|
|
|
|
const DCERPCState *dcerpc_state = DetectDceGetState(f->alproto, f->alstate);
|
|
|
|
|
const DCERPCState *dcerpc_state = state;
|
|
|
|
|
if (dcerpc_state == NULL) {
|
|
|
|
|
SCLogDebug("No DCERPCState for the flow");
|
|
|
|
|
SCReturnInt(0);
|
|
|
|
@ -356,7 +340,6 @@ end:
|
|
|
|
|
SCReturnInt(ret);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_RUST
|
|
|
|
|
static int DetectDceIfaceMatchRust(ThreadVars *t,
|
|
|
|
|
DetectEngineThreadCtx *det_ctx,
|
|
|
|
|
Flow *f, uint8_t flags, void *state, void *txv,
|
|
|
|
@ -381,7 +364,6 @@ static int DetectDceIfaceMatchRust(ThreadVars *t,
|
|
|
|
|
}
|
|
|
|
|
SCReturnInt(ret);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Creates a SigMatch for the "dce_iface" keyword being sent as argument,
|
|
|
|
|