Go to the documentation of this file.
61 static int g_http_method_buffer_id = 0;
68 static bool DetectHttpMethodValidateCallback(
const Signature *s,
const char **sigerror);
71 const uint8_t _flow_flags,
void *txv,
const int list_id);
113 "http request method");
116 DetectHttpMethodValidateCallback);
120 SCLogDebug(
"registering http_method rule option");
164 static bool DetectHttpMethodValidateCallback(
const Signature *s,
const char **sigerror)
167 for ( ; sm != NULL; sm = sm->
next) {
173 *sigerror =
"http_method pattern with trailing space";
176 }
else if (cd->
content[0] == 0x20) {
177 *sigerror =
"http_method pattern with leading space";
181 *sigerror =
"http_method pattern with trailing tab";
184 }
else if (cd->
content[0] == 0x09) {
185 *sigerror =
"http_method pattern with leading tab";
196 const uint8_t _flow_flags,
void *txv,
const int list_id)
200 htp_tx_t *tx = (htp_tx_t *)txv;
202 if (tx->request_method == NULL)
205 const uint32_t data_len = bstr_len(tx->request_method);
206 const uint8_t *data = bstr_ptr(tx->request_method);
222 const uint8_t *b = NULL;
224 if (rs_http2_tx_get_method(txv, &b, &b_len) != 1)
226 if (b == NULL || b_len == 0)
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.
#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 *)
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 DetectHttpMethodRegisterTests(void)
this function registers unit tests for DetectHttpMethod
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
int(* Match)(DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *)
struct SigMatch_ ** smlists
void DetectHttpMethodFree(void *)
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]
#define SCLogError(...)
Macro used to log ERROR messages.
Handle HTTP method match.
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 DetectHttpMethodRegister(void)
Registration function for keyword: http_method.
void(* RegisterTests)(void)