|
|
@ -70,6 +70,29 @@ static InspectionBuffer *GetData(DetectEngineThreadCtx *det_ctx,
|
|
|
|
void *txv, const int list_id);
|
|
|
|
void *txv, const int list_id);
|
|
|
|
static int g_http_response_line_id = 0;
|
|
|
|
static int g_http_response_line_id = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static InspectionBuffer *GetData2(DetectEngineThreadCtx *det_ctx,
|
|
|
|
|
|
|
|
const DetectEngineTransforms *transforms, Flow *_f, const uint8_t _flow_flags, void *txv,
|
|
|
|
|
|
|
|
const int list_id)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SCEnter();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
InspectionBuffer *buffer = InspectionBufferGet(det_ctx, list_id);
|
|
|
|
|
|
|
|
if (buffer->inspect == NULL) {
|
|
|
|
|
|
|
|
uint32_t b_len = 0;
|
|
|
|
|
|
|
|
const uint8_t *b = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (rs_http2_tx_get_response_line(txv, &b, &b_len) != 1)
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if (b == NULL || b_len == 0)
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
InspectionBufferSetup(det_ctx, list_id, buffer, b, b_len);
|
|
|
|
|
|
|
|
InspectionBufferApplyTransforms(buffer, transforms);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return buffer;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* \brief Registers the keyword handlers for the "http_response_line" keyword.
|
|
|
|
* \brief Registers the keyword handlers for the "http_response_line" keyword.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -91,6 +114,11 @@ void DetectHttpResponseLineRegister(void)
|
|
|
|
DetectAppLayerMpmRegister2("http_response_line", SIG_FLAG_TOCLIENT, 2,
|
|
|
|
DetectAppLayerMpmRegister2("http_response_line", SIG_FLAG_TOCLIENT, 2,
|
|
|
|
PrefilterGenericMpmRegister, GetData, ALPROTO_HTTP1, HTP_RESPONSE_LINE);
|
|
|
|
PrefilterGenericMpmRegister, GetData, ALPROTO_HTTP1, HTP_RESPONSE_LINE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DetectAppLayerInspectEngineRegister2("http_response_line", ALPROTO_HTTP2, SIG_FLAG_TOCLIENT,
|
|
|
|
|
|
|
|
HTTP2StateDataServer, DetectEngineInspectBufferGeneric, GetData2);
|
|
|
|
|
|
|
|
DetectAppLayerMpmRegister2("http_response_line", SIG_FLAG_TOCLIENT, 2,
|
|
|
|
|
|
|
|
PrefilterGenericMpmRegister, GetData2, ALPROTO_HTTP2, HTTP2StateDataServer);
|
|
|
|
|
|
|
|
|
|
|
|
DetectBufferTypeSetDescriptionByName("http_response_line",
|
|
|
|
DetectBufferTypeSetDescriptionByName("http_response_line",
|
|
|
|
"http response line");
|
|
|
|
"http response line");
|
|
|
|
|
|
|
|
|
|
|
@ -115,7 +143,7 @@ static int DetectHttpResponseLineSetup(DetectEngineCtx *de_ctx, Signature *s, co
|
|
|
|
if (DetectBufferSetActiveList(de_ctx, s, g_http_response_line_id) < 0)
|
|
|
|
if (DetectBufferSetActiveList(de_ctx, s, g_http_response_line_id) < 0)
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
|
|
if (DetectSignatureSetAppProto(s, ALPROTO_HTTP1) < 0)
|
|
|
|
if (DetectSignatureSetAppProto(s, ALPROTO_HTTP) < 0)
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|