]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
test:byte_jump Test from_end 298/head
authorJeff Lucovsky <jeff@lucovsky.org>
Sun, 17 May 2020 13:59:28 +0000 (09:59 -0400)
committerVictor Julien <victor@inliniac.net>
Thu, 6 Aug 2020 06:37:27 +0000 (08:37 +0200)
This commit adds test cases for the `byte_jump` `from_end` keyword.

tests/detect-bytejump-01/input.pcap [new file with mode: 0644]
tests/detect-bytejump-01/test.rules [new file with mode: 0644]
tests/detect-bytejump-01/test.yaml [new file with mode: 0644]

diff --git a/tests/detect-bytejump-01/input.pcap b/tests/detect-bytejump-01/input.pcap
new file mode 100644 (file)
index 0000000..fe0da7b
Binary files /dev/null and b/tests/detect-bytejump-01/input.pcap differ
diff --git a/tests/detect-bytejump-01/test.rules b/tests/detect-bytejump-01/test.rules
new file mode 100644 (file)
index 0000000..4a0c761
--- /dev/null
@@ -0,0 +1,4 @@
+# Jump value from payload will be 13 (dec)
+# payload; `Question?13When will the pandemic end?`
+alert tcp any any -> any any (msg:"Byte-jump test 1";content:"Question?"; byte_jump:2,0,relative,string,from_end,post_offset -26; content:"pandemic";distance:0; sid:1;)
+alert tcp any any -> any any (msg:"Byte-jump test 2";content:"Question?"; byte_jump:0,0,relative,string,from_end,post_offset -3; content:"pandemic";distance:0; sid:2;)
diff --git a/tests/detect-bytejump-01/test.yaml b/tests/detect-bytejump-01/test.yaml
new file mode 100644 (file)
index 0000000..8808323
--- /dev/null
@@ -0,0 +1,18 @@
+requires:
+    min-version: 6
+
+args:
+ - -k none
+
+checks:
+  - filter:
+      count: 1
+      match:
+        event_type: alert
+        alert.signature_id: 1
+
+  - filter:
+      count: 0
+      match:
+        event_type: alert
+        alert.signature_id: 2