Go to the documentation of this file.
62 static int g_http_method_buffer_id = 0;
69 static bool DetectHttpMethodValidateCallback(
73 const uint8_t _flow_flags,
void *txv,
const int list_id);
86 "content modifier to match only on the HTTP method-buffer";
117 "http request method");
120 DetectHttpMethodValidateCallback);
124 SCLogDebug(
"registering http_method rule option");
168 static bool DetectHttpMethodValidateCallback(
175 for (; sm != NULL; sm = sm->
next) {
181 *sigerror =
"http_method pattern with trailing space";
184 }
else if (cd->
content[0] == 0x20) {
185 *sigerror =
"http_method pattern with leading space";
189 *sigerror =
"http_method pattern with trailing tab";
192 }
else if (cd->
content[0] == 0x09) {
193 *sigerror =
"http_method pattern with leading tab";
205 const uint8_t _flow_flags,
void *txv,
const int list_id)
209 htp_tx_t *tx = (htp_tx_t *)txv;
211 if (htp_tx_request_method(tx) == NULL)
214 const uint32_t data_len = (uint32_t)bstr_len(htp_tx_request_method(tx));
215 const uint8_t *data = bstr_ptr(htp_tx_request_method(tx));
218 det_ctx, list_id, buffer, data, data_len, transforms);
231 const uint8_t *b = NULL;
233 if (SCHttp2TxGetMethod(txv, &b, &b_len) != 1)
235 if (b == NULL || b_len == 0)
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)
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 *)
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
int PrefilterGenericMpmRegister(DetectEngineCtx *de_ctx, SigGroupHead *sgh, MpmCtx *mpm_ctx, const DetectBufferMpmRegistry *mpm_reg, int list_id)
void DetectHttpMethodRegisterTests(void)
this function registers unit tests for DetectHttpMethod
#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
int(* Match)(DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *)
void DetectHttpMethodFree(void *)
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
#define SCLogError(...)
Macro used to log ERROR messages.
Handle HTTP method match.
a single match condition for a signature
#define SIGMATCH_INFO_STICKY_BUFFER
void DetectBufferTypeSetDescriptionByName(const char *name, const char *desc)
void DetectHttpMethodRegister(void)
Registration function for keyword: http_method.
void(* RegisterTests)(void)