--- /dev/null
+# Test Description
+
+Test JA3 lua rules with quic
+
+## Related issue
+
+https://redmine.openinfosecfoundation.org/issues/7605
+
+## PCAP
+
+Reused from another QUIC test
--- /dev/null
+local ja3 = require("suricata.ja3")
+
+function init (args)
+ ja3.enable_ja3()
+ local needs = {}
+ needs["ja3"] = true
+ return needs
+end
+
+function match(args)
+ local tx = ja3.get_tx()
+ local h = tx:ja3_get_hash()
+ if h == "ea0aece5703cb982b232a0684fc35b16" then
+ local s = tx:ja3_get_string()
+ if s == "771,4865-4866-4867,5-10-11-13-65281-23-16-18-43-51-57,29-23-24-25,0" then
+ return 1
+ end
+ end
+ return 0
+end
--- /dev/null
+alert ip any any -> any any (msg:"TEST JA3 LUA"; requires: feature ja3; lua:test-ja3.lua; sid:1; rev:1;)
--- /dev/null
+pcap: ../quic-v2-ja3/input.pcap
+
+requires:
+ min-version: 8
+ features:
+ - HAVE_JA3
+
+args:
+ - -k none --set default-rule-path=. --simulate-ips
+
+checks:
+ - filter:
+ count: 1
+ match:
+ alert.signature_id: 1
+ pcap_cnt: 1
+local ja3 = require("suricata.ja3")
+
function init(args)
+ ja3.enable_ja3()
local needs = {}
+ needs["ja3s"] = true
return needs
end
function match(args)
- hash = Ja3SGetHash()
+ local tx = ja3.get_tx()
+ local hash = tx:ja3s_get_hash()
if hash == nil then
return 0
end
+local ja3 = require("suricata.ja3")
+
function init(args)
+ ja3.enable_ja3()
local needs = {}
+ needs["ja3s"] = true
return needs
end
function match(args)
- str = Ja3SGetString()
+ local tx = ja3.get_tx()
+ local str = tx:ja3s_get_string()
if str == nil then
return 0
end
alert tls any any -> any any (msg:"ja3s.hash test"; flow:established,to_client; ja3s.hash; content:"5d79edf64e03689ff559a54e9d9487bc"; sid:1;)
alert tls any any -> any any (msg:"ja3s.string test"; flow:established,to_client; ja3s.string; content:"771,49199,65281-0-11-16-23"; sid:2;)
-alert tls:server_hello any any -> any any (msg:"ja3s.hash Lua test"; flow:established,to_client; lua:test-ja3s-hash.lua; sid:3;)
-alert tls:server_hello any any -> any any (msg:"ja3s.string Lua test"; flow:established,to_client; lua:test-ja3s-string.lua; sid:4;)
+# flow:established,to_client is not really needed as Suricata engine will deduce that from the needs["ja3s"] in lua
+alert tls:server_hello any any -> any any (msg:"ja3s.hash Lua test"; requires: feature ja3; flow:established,to_client; lua:test-ja3s-hash.lua; sid:3;)
+alert tls:server_hello any any -> any any (msg:"ja3s.string Lua test"; requires: feature ja3; flow:established,to_client; lua:test-ja3s-string.lua; sid:4;)