|
|
|
|
@ -60,14 +60,15 @@
|
|
|
|
|
#include "stream-tcp.h"
|
|
|
|
|
#include "detect-http-response-line.h"
|
|
|
|
|
|
|
|
|
|
int DetectHttpResponseLineSetup(DetectEngineCtx *, Signature *, char *);
|
|
|
|
|
void DetectHttpResponseLineRegisterTests(void);
|
|
|
|
|
void DetectHttpResponseLineFree(void *);
|
|
|
|
|
static int DetectHttpResponseLineSetup(DetectEngineCtx *, Signature *, char *);
|
|
|
|
|
static void DetectHttpResponseLineRegisterTests(void);
|
|
|
|
|
static int PrefilterTxHttpResponseLineRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
|
|
|
|
|
static int DetectEngineInspectHttpResponseLine(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 DetectHttpResponseLineSetupCallback(Signature *s);
|
|
|
|
|
static int g_http_response_line_id = 0;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Registers the keyword handlers for the "http_response_line" keyword.
|
|
|
|
|
@ -85,15 +86,20 @@ void DetectHttpResponseLineRegister(void)
|
|
|
|
|
sigmatch_table[DETECT_AL_HTTP_RESPONSE_LINE].flags |= SIGMATCH_NOOPT;
|
|
|
|
|
sigmatch_table[DETECT_AL_HTTP_RESPONSE_LINE].flags |= SIGMATCH_PAYLOAD ;
|
|
|
|
|
|
|
|
|
|
DetectMpmAppLayerRegister("http_response_line", SIG_FLAG_TOCLIENT,
|
|
|
|
|
DETECT_SM_LIST_HTTP_RESLINEMATCH, 2,
|
|
|
|
|
DetectAppLayerMpmRegister("http_response_line", SIG_FLAG_TOCLIENT, 2,
|
|
|
|
|
PrefilterTxHttpResponseLineRegister);
|
|
|
|
|
|
|
|
|
|
DetectAppLayerInspectEngineRegister(ALPROTO_HTTP, SIG_FLAG_TOCLIENT,
|
|
|
|
|
DETECT_SM_LIST_HTTP_RESLINEMATCH,
|
|
|
|
|
DetectAppLayerInspectEngineRegister2("http_response_line",
|
|
|
|
|
ALPROTO_HTTP, SIG_FLAG_TOCLIENT,
|
|
|
|
|
DetectEngineInspectHttpResponseLine);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
DetectBufferTypeSetDescriptionByName("http_response_line",
|
|
|
|
|
"http response line");
|
|
|
|
|
|
|
|
|
|
DetectBufferTypeRegisterSetupCallback("http_response_line",
|
|
|
|
|
DetectHttpResponseLineSetupCallback);
|
|
|
|
|
|
|
|
|
|
g_http_response_line_id = DetectBufferTypeGetByName("http_response_line");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -109,13 +115,19 @@ void DetectHttpResponseLineRegister(void)
|
|
|
|
|
* \retval 0 On success
|
|
|
|
|
* \retval -1 On failure
|
|
|
|
|
*/
|
|
|
|
|
int DetectHttpResponseLineSetup(DetectEngineCtx *de_ctx, Signature *s, char *arg)
|
|
|
|
|
static int DetectHttpResponseLineSetup(DetectEngineCtx *de_ctx, Signature *s, char *arg)
|
|
|
|
|
{
|
|
|
|
|
s->init_data->list = DETECT_SM_LIST_HTTP_RESLINEMATCH;
|
|
|
|
|
s->init_data->list = g_http_response_line_id;
|
|
|
|
|
s->alproto = ALPROTO_HTTP;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void DetectHttpResponseLineSetupCallback(Signature *s)
|
|
|
|
|
{
|
|
|
|
|
SCLogDebug("callback invoked by %u", s->id);
|
|
|
|
|
s->mask |= SIG_MASK_REQUIRE_HTTP_STATE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \brief HTTP response line Mpm prefilter callback
|
|
|
|
|
*
|
|
|
|
|
* \param det_ctx detection engine thread ctx
|
|
|
|
|
|