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)
183 for ( ; sm != NULL; sm = sm->
next) {
187 *sigerror =
"http.host keyword "
188 "specified along with \"nocase\". "
189 "The hostname buffer is normalized "
190 "to lowercase, specifying "
191 "nocase is redundant.";
201 *sigerror =
"A pattern with "
202 "uppercase characters detected for http.host. "
203 "The hostname buffer is normalized to lowercase, "
204 "please specify a lowercase pattern.";
235 const uint8_t _flow_flags,
void *txv,
const int list_id)
239 htp_tx_t *tx = (htp_tx_t *)txv;
241 if (tx->request_hostname == NULL)
244 const uint32_t data_len = bstr_len(tx->request_hostname);
245 const uint8_t *data = bstr_ptr(tx->request_hostname);
261 const uint8_t *b = NULL;
263 if (rs_http2_tx_get_host_norm(txv, &b, &b_len) != 1)
265 if (b == NULL || b_len == 0)
282 const uint8_t *b = NULL;
284 if (rs_http2_tx_get_host(txv, &b, &b_len) != 1)
286 if (b == NULL || b_len == 0)
335 const uint8_t _flow_flags,
void *txv,
const int list_id)
339 htp_tx_t *tx = (htp_tx_t *)txv;
341 const uint8_t *data = NULL;
342 uint32_t data_len = 0;
344 if (tx->parsed_uri == NULL || tx->parsed_uri->hostname == NULL) {
345 if (tx->request_headers == NULL)
348 htp_header_t *h = (htp_header_t *)htp_table_get_c(tx->request_headers,
350 if (h == NULL || h->value == NULL)
353 data = (
const uint8_t *)bstr_ptr(h->value);
354 data_len = bstr_len(h->value);
356 data = (
const uint8_t *)bstr_ptr(tx->parsed_uri->hostname);
357 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
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 PrefilterGenericMpmRegister(DetectEngineCtx *de_ctx, SigGroupHead *sgh, MpmCtx *mpm_ctx, const DetectBufferMpmRegistery *mpm_reg, int list_id)
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)
#define SCLogWarning(...)
Macro used to log WARNING messages.
int DetectEngineContentModifierBufferSetup(DetectEngineCtx *de_ctx, Signature *s, const char *arg, int sm_type, int sm_list, AppProto alproto)
void DetectAppLayerInspectEngineRegister2(const char *name, AppProto alproto, uint32_t dir, int progress, InspectEngineFuncPtr2 Callback2, InspectionBufferGetDataPtr GetData)
register inspect engine at start up time
SignatureInitData * init_data
struct SigMatch_ ** smlists
void DetectAppLayerMpmRegister2(const char *name, int direction, int priority, int(*PrefilterRegister)(DetectEngineCtx *de_ctx, SigGroupHead *sgh, MpmCtx *mpm_ctx, const DetectBufferMpmRegistery *mpm_reg, int list_id), InspectionBufferGetDataPtr GetData, AppProto alproto, int tx_min_progress)
register a MPM engine
void InspectionBufferApplyTransforms(InspectionBuffer *buffer, const DetectEngineTransforms *transforms)
SigTableElmt sigmatch_table[DETECT_TBLSIZE]
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
int DetectBufferSetActiveList(Signature *s, const int list)
void DetectBufferTypeSetDescriptionByName(const char *name, const char *desc)
void(* RegisterTests)(void)