Go to the documentation of this file.
65 static bool DetectHttpHostValidateCallback(
const Signature *s,
const char **sigerror);
69 Flow *_f,
const uint8_t _flow_flags,
70 void *txv,
const int list_id);
75 static int g_http_raw_host_buffer_id = 0;
79 const uint8_t _flow_flags,
void *txv,
const int list_id);
83 static int g_http_host_buffer_id = 0;
121 DetectHttpHostValidateCallback);
156 "http raw host header");
180 static bool DetectHttpHostValidateCallback(
const Signature *s,
const char **sigerror)
186 for (; sm != NULL; sm = sm->
next) {
190 *sigerror =
"http.host keyword "
191 "specified along with \"nocase\". "
192 "The hostname buffer is normalized "
193 "to lowercase, specifying "
194 "nocase is redundant.";
204 *sigerror =
"A pattern with "
205 "uppercase characters detected for http.host. "
206 "The hostname buffer is normalized to lowercase, "
207 "please specify a lowercase pattern.";
239 const uint8_t _flow_flags,
void *txv,
const int list_id)
243 htp_tx_t *tx = (htp_tx_t *)txv;
245 if (tx->request_hostname == NULL)
248 const uint32_t data_len = bstr_len(tx->request_hostname);
249 const uint8_t *data = bstr_ptr(tx->request_hostname);
265 const uint8_t *b = NULL;
267 if (rs_http2_tx_get_host_norm(txv, &b, &b_len) != 1)
269 if (b == NULL || b_len == 0)
286 const uint8_t *b = NULL;
288 if (rs_http2_tx_get_host(txv, &b, &b_len) != 1)
290 if (b == NULL || b_len == 0)
339 const uint8_t _flow_flags,
void *txv,
const int list_id)
343 htp_tx_t *tx = (htp_tx_t *)txv;
345 const uint8_t *data = NULL;
346 uint32_t data_len = 0;
348 if (tx->parsed_uri == NULL || tx->parsed_uri->hostname == NULL) {
349 if (tx->request_headers == NULL)
352 htp_header_t *h = (htp_header_t *)htp_table_get_c(tx->request_headers,
354 if (h == NULL || h->value == NULL)
357 data = (
const uint8_t *)bstr_ptr(h->value);
358 data_len = bstr_len(h->value);
360 data = (
const uint8_t *)bstr_ptr(tx->parsed_uri->hostname);
361 data_len = bstr_len(tx->parsed_uri->hostname);
#define DETECT_CONTENT_NOCASE
void DetectHttpHHRegister(void)
Registers the keyword handlers for the "http_host" keyword.
int DetectSignatureSetAppProto(Signature *s, AppProto alproto)
#define SIGMATCH_INFO_STICKY_BUFFER
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.
@ DETECT_AL_HTTP_RAW_HOST
#define SIGMATCH_INFO_CONTENT_MODIFIER
int DetectBufferSetActiveList(DetectEngineCtx *de_ctx, Signature *s, const int list)
main detection engine ctx
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
Handle HTTP host header. HHHD - Http Host Header Data.
InspectionBuffer * InspectionBufferGet(DetectEngineThreadCtx *det_ctx, const int list_id)
int DetectBufferTypeGetByName(const char *name)
#define SIG_FLAG_TOSERVER
void DetectBufferTypeRegisterValidateCallback(const char *name, bool(*ValidateCallback)(const Signature *, const char **sigerror))
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.
void DetectAppLayerMpmRegister(const char *name, int direction, int priority, PrefilterRegisterFunc PrefilterRegister, InspectionBufferGetDataPtr GetData, AppProto alproto, int tx_min_progress)
register an app layer keyword for mpm
int DetectEngineContentModifierBufferSetup(DetectEngineCtx *de_ctx, Signature *s, const char *arg, int sm_type, int sm_list, AppProto alproto)
SignatureInitData * init_data
void InspectionBufferApplyTransforms(InspectionBuffer *buffer, const DetectEngineTransforms *transforms)
SignatureInitDataBuffer * buffers
void InspectionBufferSetup(DetectEngineThreadCtx *det_ctx, const int list_id, InspectionBuffer *buffer, const uint8_t *data, const uint32_t data_len)
setup the buffer with our initial data
a single match condition for a signature
void DetectAppLayerInspectEngineRegister(const char *name, AppProto alproto, uint32_t dir, int progress, InspectEngineFuncPtr Callback, InspectionBufferGetDataPtr GetData)
Registers an app inspection engine.
void DetectBufferTypeSetDescriptionByName(const char *name, const char *desc)
void(* RegisterTests)(void)