Go to the documentation of this file.
65 static bool DetectHttpHostValidateCallback(
70 Flow *_f,
const uint8_t _flow_flags,
71 void *txv,
const int list_id);
76 static int g_http_raw_host_buffer_id = 0;
80 const uint8_t _flow_flags,
void *txv,
const int list_id);
84 static int g_http_host_buffer_id = 0;
85 static int g_http2_thread_id = 0;
86 static int g_http2_raw_thread_id = 0;
125 DetectHttpHostValidateCallback);
131 "http_host", SCDetectThreadBufDataInit, NULL, SCDetectThreadBufDataFree);
138 "or the raw hostname from the HTTP uri";
165 "http raw host header");
168 "http_raw_host", SCDetectThreadBufDataInit, NULL, SCDetectThreadBufDataFree);
192 static bool DetectHttpHostValidateCallback(
199 for (; sm != NULL; sm = sm->
next) {
203 *sigerror =
"http.host keyword "
204 "specified along with \"nocase\". "
205 "The hostname buffer is normalized "
206 "to lowercase, specifying "
207 "nocase is redundant.";
217 *sigerror =
"A pattern with "
218 "uppercase characters detected for http.host. "
219 "The hostname buffer is normalized to lowercase, "
220 "please specify a lowercase pattern.";
252 const uint8_t _flow_flags,
void *txv,
const int list_id)
256 htp_tx_t *tx = (htp_tx_t *)txv;
258 if (htp_tx_request_hostname(tx) == NULL)
261 const uint32_t data_len = (uint32_t)bstr_len(htp_tx_request_hostname(tx));
262 const uint8_t *data = bstr_ptr(htp_tx_request_hostname(tx));
265 det_ctx, list_id, buffer, data, data_len, transforms);
278 const uint8_t *b = NULL;
280 if (thread_buf == NULL)
282 if (SCHttp2TxGetHostNorm(txv, &b, &b_len, thread_buf) != 1)
284 if (b == NULL || b_len == 0)
300 const uint8_t *b = NULL;
303 if (thread_buf == NULL)
306 if (SCHttp2TxGetHost(txv, &b, &b_len, thread_buf) != 1)
308 if (b == NULL || b_len == 0)
356 const uint8_t _flow_flags,
void *txv,
const int list_id)
360 htp_tx_t *tx = (htp_tx_t *)txv;
362 const uint8_t *data = NULL;
363 uint32_t data_len = 0;
365 if (htp_uri_hostname(htp_tx_parsed_uri(tx)) == NULL) {
366 if (htp_tx_request_headers(tx) == NULL)
369 const htp_header_t *h = htp_tx_request_header(tx,
"Host");
370 if (h == NULL || htp_header_value(h) == NULL)
373 data = htp_header_value_ptr(h);
374 data_len = (uint32_t)htp_header_value_len(h);
376 data = (
const uint8_t *)bstr_ptr(htp_uri_hostname(htp_tx_parsed_uri(tx)));
377 data_len = (uint32_t)bstr_len(htp_uri_hostname(htp_tx_parsed_uri(tx)));
381 det_ctx, list_id, buffer, data, data_len, transforms);
#define DETECT_CONTENT_NOCASE
void DetectHttpHHRegister(void)
Registers the keyword handlers for the "http_host" keyword.
SigTableElmt * sigmatch_table
uint8_t DetectEngineInspectBufferGeneric(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, const DetectEngineAppInspectionEngine *engine, const Signature *s, Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id)
Do the content inspection & validation for a signature.
InspectionBuffer * SCInspectionBufferGet(DetectEngineThreadCtx *det_ctx, const int list_id)
void * SCDetectThreadCtxGetGlobalKeywordThreadCtx(DetectEngineThreadCtx *det_ctx, int id)
Retrieve thread local keyword ctx by id.
main detection engine ctx
void DetectBufferTypeRegisterValidateCallback(const char *name, bool(*ValidateCallback)(const Signature *, const char **sigerror, const DetectBufferType *))
void SCInspectionBufferSetupAndApplyTransforms(DetectEngineThreadCtx *det_ctx, const int list_id, InspectionBuffer *buffer, const uint8_t *data, const uint32_t data_len, const DetectEngineTransforms *transforms)
setup the buffer with our initial data
int SCDetectBufferSetActiveList(DetectEngineCtx *de_ctx, Signature *s, const int list)
int SCDetectSignatureSetAppProto(Signature *s, AppProto alproto)
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
Handle HTTP host header. HHHD - Http Host Header Data.
void DetectAppLayerMpmRegisterSubState(const char *name, int direction, int priority, PrefilterRegisterFunc PrefilterRegister, InspectionBufferGetDataPtr GetData, AppProto alproto, uint8_t sub_state, uint8_t tx_min_progress)
void DetectAppLayerInspectEngineRegister(const char *name, AppProto alproto, uint32_t dir, uint8_t progress, InspectEngineFuncPtr Callback, InspectionBufferGetDataPtr GetData)
Registers an app inspection engine.
int DetectBufferTypeGetByName(const char *name)
#define SIG_FLAG_TOSERVER
void DetectHttpHHRegisterTests(void)
int PrefilterGenericMpmRegister(DetectEngineCtx *de_ctx, SigGroupHead *sgh, MpmCtx *mpm_ctx, const DetectBufferMpmRegistry *mpm_reg, int list_id)
#define SCLogWarning(...)
Macro used to log WARNING messages.
#define SIGMATCH_INFO_CONTENT_MODIFIER
int DetectEngineContentModifierBufferSetup(DetectEngineCtx *de_ctx, Signature *s, const char *arg, int sm_type, int sm_list, AppProto alproto)
SignatureInitData * init_data
void DetectAppLayerMpmRegister(const char *name, int direction, int priority, PrefilterRegisterFunc PrefilterRegister, InspectionBufferGetDataPtr GetData, AppProto alproto, uint8_t tx_min_progress)
register an app layer keyword for mpm
void DetectAppLayerInspectEngineRegisterSubState(const char *name, AppProto alproto, uint32_t dir, uint8_t sub_state, uint8_t progress, InspectEngineFuncPtr Callback, InspectionBufferGetDataPtr GetData)
register an app inspection engine for a tx type
SignatureInitDataBuffer * buffers
a single match condition for a signature
#define SIGMATCH_INFO_STICKY_BUFFER
void DetectBufferTypeSetDescriptionByName(const char *name, const char *desc)
int SCDetectRegisterThreadCtxGlobalFuncs(const char *name, void *(*InitFunc)(void *), void *data, void(*FreeFunc)(void *))
Register Thread keyword context Funcs (Global)
void(* RegisterTests)(void)