|
|
|
@ -60,14 +60,15 @@
|
|
|
|
|
#include "stream-tcp.h"
|
|
|
|
|
#include "detect-http-request-line.h"
|
|
|
|
|
|
|
|
|
|
int DetectHttpRequestLineSetup(DetectEngineCtx *, Signature *, char *);
|
|
|
|
|
void DetectHttpRequestLineRegisterTests(void);
|
|
|
|
|
void DetectHttpRequestLineFree(void *);
|
|
|
|
|
static int DetectHttpRequestLineSetup(DetectEngineCtx *, Signature *, char *);
|
|
|
|
|
static void DetectHttpRequestLineRegisterTests(void);
|
|
|
|
|
static int PrefilterTxHttpRequestLineRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
|
|
|
|
|
static int DetectEngineInspectHttpRequestLine(ThreadVars *tv,
|
|
|
|
|
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
|
|
|
|
|
const Signature *s, const SigMatchData *smd,
|
|
|
|
|
Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id);
|
|
|
|
|
static void DetectHttpRequestLineSetupCallback(Signature *s);
|
|
|
|
|
static int g_http_request_line_buffer_id = 0;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Registers the keyword handlers for the "http_request_line" keyword.
|
|
|
|
@ -85,15 +86,20 @@ void DetectHttpRequestLineRegister(void)
|
|
|
|
|
sigmatch_table[DETECT_AL_HTTP_REQUEST_LINE].flags |= SIGMATCH_NOOPT;
|
|
|
|
|
sigmatch_table[DETECT_AL_HTTP_REQUEST_LINE].flags |= SIGMATCH_PAYLOAD ;
|
|
|
|
|
|
|
|
|
|
DetectMpmAppLayerRegister("http_request_line", SIG_FLAG_TOSERVER,
|
|
|
|
|
DETECT_SM_LIST_HTTP_REQLINEMATCH, 2,
|
|
|
|
|
DetectAppLayerMpmRegister("http_request_line", SIG_FLAG_TOSERVER, 2,
|
|
|
|
|
PrefilterTxHttpRequestLineRegister);
|
|
|
|
|
|
|
|
|
|
DetectAppLayerInspectEngineRegister(ALPROTO_HTTP, SIG_FLAG_TOSERVER,
|
|
|
|
|
DETECT_SM_LIST_HTTP_REQLINEMATCH,
|
|
|
|
|
DetectAppLayerInspectEngineRegister2("http_request_line",
|
|
|
|
|
ALPROTO_HTTP, SIG_FLAG_TOSERVER,
|
|
|
|
|
DetectEngineInspectHttpRequestLine);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
DetectBufferTypeSetDescriptionByName("http_request_line",
|
|
|
|
|
"http request line");
|
|
|
|
|
|
|
|
|
|
DetectBufferTypeRegisterSetupCallback("http_request_line",
|
|
|
|
|
DetectHttpRequestLineSetupCallback);
|
|
|
|
|
|
|
|
|
|
g_http_request_line_buffer_id = DetectBufferTypeGetByName("http_request_line");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -109,13 +115,19 @@ void DetectHttpRequestLineRegister(void)
|
|
|
|
|
* \retval 0 On success
|
|
|
|
|
* \retval -1 On failure
|
|
|
|
|
*/
|
|
|
|
|
int DetectHttpRequestLineSetup(DetectEngineCtx *de_ctx, Signature *s, char *arg)
|
|
|
|
|
static int DetectHttpRequestLineSetup(DetectEngineCtx *de_ctx, Signature *s, char *arg)
|
|
|
|
|
{
|
|
|
|
|
s->init_data->list = DETECT_SM_LIST_HTTP_REQLINEMATCH;
|
|
|
|
|
s->init_data->list = g_http_request_line_buffer_id;
|
|
|
|
|
s->alproto = ALPROTO_HTTP;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void DetectHttpRequestLineSetupCallback(Signature *s)
|
|
|
|
|
{
|
|
|
|
|
SCLogDebug("callback invoked by %u", s->id);
|
|
|
|
|
s->mask |= SIG_MASK_REQUIRE_HTTP_STATE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \brief HTTP request line Mpm prefilter callback
|
|
|
|
|
*
|
|
|
|
|
* \param det_ctx detection engine thread ctx
|
|
|
|
@ -308,7 +320,7 @@ static int DetectHttpRequestLineTest02(void)
|
|
|
|
|
|
|
|
|
|
#endif /* UNITTESTS */
|
|
|
|
|
|
|
|
|
|
void DetectHttpRequestLineRegisterTests(void)
|
|
|
|
|
static void DetectHttpRequestLineRegisterTests(void)
|
|
|
|
|
{
|
|
|
|
|
#ifdef UNITTESTS
|
|
|
|
|
UtRegisterTest("DetectHttpRequestLineTest01", DetectHttpRequestLineTest01);
|
|
|
|
|