-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Lua ja3 7605 v6 #13168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lua ja3 7605 v6 #13168
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,3 +18,4 @@ environment without access to additional modules. | |
| packetlib | ||
| rule | ||
| ssh | ||
| ja3 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| JA3 | ||
| --- | ||
|
|
||
| JA3 details are exposes to Lua scripts with the | ||
| ``suricata.ja3`` library, For example:: | ||
catenacyber marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| local ja3 = require("suricata.ja3") | ||
|
|
||
| If you want to use ja3, you can either set suricata.yaml option | ||
| ``app-layer.protocols.tls.ja3-fingerprints`` to true, | ||
| or specify it in the ``init`` function of your lua script | ||
| by calling ``ja3.enable_ja3()``:: | ||
|
|
||
| function init (args) | ||
| ja3.enable_ja3() | ||
| return {} | ||
| end | ||
|
|
||
| ``ja3.enable_ja3()`` will not enable ja3 if they are explicitly | ||
| disabled, so you should add ``requires: feature ja3;`` to your rule. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: add reference to doc? https://docs.suricata.io/en/latest/rules/meta.html#requires
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks |
||
|
|
||
| For use in rule matching, the rule may **hook** into a TLS or QUIC | ||
| transaction state if you want to match on only one of these protocols. | ||
| Or you should use need ``ja3`` or ``ja3s`` in your init script:: | ||
|
Comment on lines
+22
to
+24
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you clarify what hook means here? Are these rule hooks? If so, I suggest adding a reference to that. If something else, maybe we need rewording or a longer explanation? (or a pointer to where to find more info)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Not sure I can do it right, it comes from @jasonish doc about lua dns. I am removing this as |
||
|
|
||
| function init (args) | ||
| ja3.enable_ja3() | ||
| local needs = {} | ||
| needs["ja3s"] = true | ||
| return needs | ||
| end | ||
|
|
||
| Transaction | ||
| ~~~~~~~~~~~ | ||
|
|
||
| JA3 is transaction based, and the current transaction must be obtained before use:: | ||
|
|
||
| local tx, err = ja3.get_tx() | ||
| if tx == err then | ||
| print(err) | ||
| end | ||
|
|
||
| All other functions are methods on the transaction (either a QUIC or a TLS one). | ||
|
|
||
| Transaction Methods | ||
| ~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| ``ja3_get_hash()`` | ||
| ^^^^^^^^^^^^^^^^^^ | ||
|
|
||
| Get the ja3 value as a hash. | ||
|
|
||
| Example:: | ||
|
|
||
| local tx = ja3.get_tx() | ||
| local h = tx:ja3_get_hash(); | ||
| print (h) | ||
|
|
||
| ``ja3_get_string()`` | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
|
||
| Get the ja3 value as a string. | ||
|
|
||
| Example:: | ||
|
|
||
| local tx = ja3.get_tx() | ||
| local s = tx:ja3_get_string(); | ||
| print (s) | ||
|
|
||
| ``ja3s_get_hash()`` | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
|
|
||
| Get the ja3s value as a hash. | ||
|
|
||
| Example:: | ||
|
|
||
| local tx = ja3.get_tx() | ||
| local h = tx:ja3s_get_hash(); | ||
| print (h) | ||
|
|
||
| ``ja3s_get_string()`` | ||
| ^^^^^^^^^^^^^^^^^^^^^ | ||
|
|
||
| Get the ja3s value as a string. | ||
|
|
||
| Example:: | ||
|
|
||
| local tx = ja3.get_tx() | ||
| local s = tx:ja3s_get_string(); | ||
| print (s) | ||
Uh oh!
There was an error while loading. Please reload this page.