Go to the documentation of this file.
54 int Ja4IsDisabled(
const char *
type);
59 static void DetectJa4RegisterTests(
void);
62 static int g_ja4_hash_buffer_id = 0;
122 SCLogError(
"rule contains conflicting protocols.");
170 const uint8_t *b = NULL;
172 if (rs_quic_tx_get_ja4(txv, &b, &b_len) != 1)
174 if (b == NULL || b_len == 0)
185 static int DetectJa4TestParse01(
void)
191 SigInit(
de_ctx,
"alert ip any any -> any any (sid: 1; file.data; content: \"toto\"; "
192 "ja4.hash; content: \"q13d0310h3_55b375c5d22e_cd85d2d88918\";)");
196 "ja4.hash; content: \"q13d0310h3_55b375c5d22e_cd85d2d88918\"; file.data; "
197 "content: \"toto\";)");
201 "ja4.hash; content: \"q13d0310h3_55b375c5d22e_cd85d2d88918\";)");
205 "ja4.hash; content: \"q13d0310h3_55b375c5d22e_cd85d2d88918\"; smb.share; "
206 "content:\"toto\";)");
210 "smb.share; content:\"toto\"; ja4.hash; content: "
211 "\"q13d0310h3_55b375c5d22e_cd85d2d88918\";)");
217 "alert ip any any -> any any (sid: 1; "
218 "ja4.hash; content: \"q13d0310h3_55b375c5d22e_cd85d2d88918\";)");
222 "alert quic any any -> any any (sid: 2; "
223 "ja4.hash; content: \"q13d0310h3_55b375c5d22e_cd85d2d88918\";)");
227 "alert tls any any -> any any (sid: 3; "
228 "ja4.hash; content: \"q13d0310h3_55b375c5d22e_cd85d2d88918\";)");
232 "alert ip any any -> any any (sid: 4; "
233 "ja4.hash; content: \"q13d0310h3_55b375c5d22e_cd85d2d88918\"; "
234 "quic.version; content:\"|00|\";)");
241 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
int DetectBufferSetActiveList(DetectEngineCtx *de_ctx, Signature *s, const int list)
main detection engine ctx
void DetectEngineCtxFree(DetectEngineCtx *)
Free a DetectEngineCtx::
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)