JA3 ---
JA3 的详细信息通过 suricata.ja3
库暴露给 Lua 脚本。例如:
local ja3 = require("suricata.ja3")
如果你想使用 ja3,可以在 suricata.yaml 中设置选项 app-layer.protocols.tls.ja3-fingerprints
为 true,
或者在你的 lua 脚本的 init
函数中通过调用 ja3.enable_ja3()
来指定:
function init (args)
ja3.enable_ja3()
return {}
end
如果 ja3 被显式禁用,ja3.enable_ja3()
将不会启用 ja3,因此你应该在规则中添加 requires: feature ja3;
(参见 requires)。
为了在规则匹配中使用,规则应该在 init 脚本中需要 ja3
或 ja3s
:
function init (args)
ja3.enable_ja3()
local needs = {}
needs["ja3s"] = true
return needs
end
20.3.35. 事务¶
JA3 是基于事务的,使用前必须先获取当前事务:
local tx, err = ja3.get_tx()
if tx == err then
print(err)
end
所有其他函数都是事务(QUIC 或 TLS)的方法。
20.3.36. 事务方法¶
20.3.36.1. ja3_get_hash()
¶
获取 ja3 值的哈希形式。
示例:
local tx = ja3.get_tx()
local h = tx:ja3_get_hash();
print (h)
20.3.36.2. ja3_get_string()
¶
获取 ja3 值的字符串形式。
示例:
local tx = ja3.get_tx()
local s = tx:ja3_get_string();
print (s)
20.3.36.3. ja3s_get_hash()
¶
获取 ja3s 值的哈希形式。
示例:
local tx = ja3.get_tx()
local h = tx:ja3s_get_hash();
print (h)
20.3.36.4. ja3s_get_string()
¶
获取 ja3s 值的字符串形式。
示例:
local tx = ja3.get_tx()
local s = tx:ja3s_get_string();
print (s)