]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
ssh: adds test with lua and hassh 2475/head 2476/head
authorPhilippe Antoine <pantoine@oisf.net>
Mon, 28 Apr 2025 12:22:17 +0000 (14:22 +0200)
committerPhilippe Antoine <pantoine@oisf.net>
Tue, 29 Apr 2025 19:00:21 +0000 (21:00 +0200)
Ticket: 7603

tests/ssh-lua-hassh/test-ssh-resp.lua [new file with mode: 0644]
tests/ssh-lua-hassh/test-ssh.lua [new file with mode: 0644]
tests/ssh-lua-hassh/test.rules [new file with mode: 0644]
tests/ssh-lua-hassh/test.yaml [new file with mode: 0644]

diff --git a/tests/ssh-lua-hassh/test-ssh-resp.lua b/tests/ssh-lua-hassh/test-ssh-resp.lua
new file mode 100644 (file)
index 0000000..8f0ea19
--- /dev/null
@@ -0,0 +1,16 @@
+local ssh = require("suricata.ssh")
+
+function init (args)
+   ssh.enable_hassh()
+   return {}
+end
+
+function match(args)
+   local tx = ssh.get_tx()
+   local h = tx:server_hassh()
+   print(h)
+   if h == "6832f1ce43d4397c2c0a3e2f8c94334e" then
+      return 1
+   end
+   return 0
+end
diff --git a/tests/ssh-lua-hassh/test-ssh.lua b/tests/ssh-lua-hassh/test-ssh.lua
new file mode 100644 (file)
index 0000000..0eb4db2
--- /dev/null
@@ -0,0 +1,16 @@
+local ssh = require("suricata.ssh")
+
+function init (args)
+   ssh.enable_hassh()
+   return {}
+end
+
+function match(args)
+   local tx = ssh.get_tx()
+   local h = tx:client_hassh()
+   print(h)
+   if h == "2dd6531c7e89d3c925db9214711be76a" then
+      return 1
+   end
+   return 0
+end
diff --git a/tests/ssh-lua-hassh/test.rules b/tests/ssh-lua-hassh/test.rules
new file mode 100644 (file)
index 0000000..af85e1b
--- /dev/null
@@ -0,0 +1,2 @@
+alert ssh:request_finished any any -> any any (msg:"TEST SSH LUA"; lua:test-ssh.lua; sid:1; rev:1;)
+alert ssh:response_finished any any -> any any (msg:"TEST SSH LUA"; lua:test-ssh-resp.lua; sid:2; rev:1;)
diff --git a/tests/ssh-lua-hassh/test.yaml b/tests/ssh-lua-hassh/test.yaml
new file mode 100644 (file)
index 0000000..b75f122
--- /dev/null
@@ -0,0 +1,18 @@
+pcap: ../ssh-hassh/input.pcap
+
+requires:
+  min-version: 8
+
+args:
+  - -k none --set default-rule-path=. --simulate-ips
+  #we could do --set app-layer.protocols.ssh.hassh=yes
+
+checks:
+  - filter:
+      count: 1
+      match:
+        alert.signature_id: 1
+  - filter:
+      count: 1
+      match:
+        alert.signature_id: 2