Go to the documentation of this file.
55 int Ja4IsDisabled(
const char *
type);
60 static void DetectJa4RegisterTests(
void);
63 static int g_ja4_hash_buffer_id = 0;
123 SCLogError(
"rule contains conflicting protocols.");
171 const uint8_t *b = NULL;
173 if (SCQuicTxGetJa4(txv, &b, &b_len) != 1)
175 if (b == NULL || b_len == 0)
186 static int DetectJa4TestParse01(
void)
192 SigInit(
de_ctx,
"alert ip any any -> any any (sid: 1; file.data; content: \"toto\"; "
193 "ja4.hash; content: \"q13d0310h3_55b375c5d22e_cd85d2d88918\";)");
197 "ja4.hash; content: \"q13d0310h3_55b375c5d22e_cd85d2d88918\"; file.data; "
198 "content: \"toto\";)");
202 "ja4.hash; content: \"q13d0310h3_55b375c5d22e_cd85d2d88918\";)");
206 "ja4.hash; content: \"q13d0310h3_55b375c5d22e_cd85d2d88918\"; smb.share; "
207 "content:\"toto\";)");
211 "smb.share; content:\"toto\"; ja4.hash; content: "
212 "\"q13d0310h3_55b375c5d22e_cd85d2d88918\";)");
218 "alert ip any any -> any any (sid: 1; "
219 "ja4.hash; content: \"q13d0310h3_55b375c5d22e_cd85d2d88918\";)");
223 "alert quic any any -> any any (sid: 2; "
224 "ja4.hash; content: \"q13d0310h3_55b375c5d22e_cd85d2d88918\";)");
228 "alert tls any any -> any any (sid: 3; "
229 "ja4.hash; content: \"q13d0310h3_55b375c5d22e_cd85d2d88918\";)");
233 "alert ip any any -> any any (sid: 4; "
234 "ja4.hash; content: \"q13d0310h3_55b375c5d22e_cd85d2d88918\"; "
235 "quic.version; content:\"|00|\";)");
242 static void DetectJa4RegisterTests(
void)
SSLv[2.0|3.[0|1|2|3]] state structure.
#define FAIL_IF_NULL(expr)
Fail a test if expression evaluates to NULL.
#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.
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
SSLStateConnp client_connp
int DetectSignatureSetMultiAppProto(Signature *s, const AppProto *alprotos)
this function is used to set multiple possible app-layer protos
void SSLEnableJA4(void)
if not explicitly disabled in config, enable ja4 support
main detection engine ctx
void DetectEngineCtxFree(DetectEngineCtx *)
Free a DetectEngineCtx::
int SCDetectBufferSetActiveList(DetectEngineCtx *de_ctx, Signature *s, const int list)
Signature * DetectEngineAppendSig(DetectEngineCtx *, const char *)
Parse and append a Signature into the Detection Engine Context signature list.
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
InspectionBuffer * InspectionBufferGet(DetectEngineThreadCtx *det_ctx, const int list_id)
int DetectBufferTypeGetByName(const char *name)
#define SIG_FLAG_TOSERVER
#define FAIL_IF_NOT_NULL(expr)
Fail a test if expression evaluates to non-NULL.
#define PASS
Pass the test.
@ TLS_STATE_CLIENT_HELLO_DONE
int PrefilterGenericMpmRegister(DetectEngineCtx *de_ctx, SigGroupHead *sgh, MpmCtx *mpm_ctx, const DetectBufferMpmRegistry *mpm_reg, int list_id)
Signature * SigInit(DetectEngineCtx *de_ctx, const char *sigstr)
Parses a signature and adds it to the Detection Engine Context.
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 RunmodeIsUnittests(void)
void InspectionBufferCopy(InspectionBuffer *buffer, uint8_t *buf, uint32_t buf_len)
bool SigMatchSilentErrorEnabled(const DetectEngineCtx *de_ctx, const enum DetectKeywordId id)
void InspectionBufferApplyTransforms(DetectEngineThreadCtx *det_ctx, InspectionBuffer *buffer, const DetectEngineTransforms *transforms)
#define SCLogError(...)
Macro used to log ERROR messages.
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
bool SSLJA4IsEnabled(void)
return whether ja4 is effectively enabled
DetectEngineCtx * DetectEngineCtxInit(void)
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 DetectJa4HashRegister(void)
Registration function for keyword: ja4.hash.
void(* RegisterTests)(void)