]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
tests/lua: Byte-extract/byte-math tests
authorJeff Lucovsky <jlucovsky@oisf.net>
Fri, 29 Jul 2022 12:53:40 +0000 (08:53 -0400)
committerVictor Julien <victor@inliniac.net>
Tue, 13 Sep 2022 09:56:05 +0000 (11:56 +0200)
Issue: 2871

tests/lua-byte-extract/lua-byte-extract.lua
tests/lua-byte-extract/lua-byte-math.lua
tests/lua-byte-extract/suricata.yaml [deleted file]
tests/lua-byte-extract/test.yaml

index fcc0901ccf4fb250742e42365e4b77767f4f0528..d8fd067e218f4ff5253b7549e70bae34f8d36fc4 100644 (file)
@@ -8,9 +8,10 @@ function match(args)
     local var1 = SCByteVarGet(0)
     local var2 = SCByteVarGet(1)
 
-    if string.pack(">i4", var1) == "HTTP" and string.pack(">i4", var2) == "/1.1" then
-        return 1
-    else 
-        return 0
+    if var1 and var2 then
+        if var1 == 0x48545450 and var2 == 0x2f312e31 then
+            return 1
+        end
     end
+    return 0
 end
index bd66c4b03e8437d2bec491077a19832780793425..02cd4b1b00d7aa3c6c75d9ac93753d5f45114d4e 100644 (file)
@@ -7,9 +7,9 @@ end
 function match(args)
     local var2 = SCByteVarGet(0)
 
-    if string.pack(">i4", var2) == "HTTP" then
+    if var2 and var2 == 0x48545450 then
         return 1
-    else
-        return 0
     end
+
+    return 0
 end
diff --git a/tests/lua-byte-extract/suricata.yaml b/tests/lua-byte-extract/suricata.yaml
deleted file mode 100644 (file)
index e27e996..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-%YAML 1.1
----
-
-include: ../../etc/suricata-4.0.3.yaml
\ No newline at end of file
index d6197b565c8237134ebbc667f6dea1e131a8c0ea..f7fe236781d17130ff2dbff800106710e1f69870 100644 (file)
@@ -1,7 +1,12 @@
 requires:
+  min-version: 7
+
   features:
     - HAVE_LUA
 
+args:
+   - --set default-rule-path=${TEST_DIR}
+
 checks:
   - filter:
       count: 1
@@ -11,4 +16,3 @@ checks:
       count: 1
       match:
         alert.signature_id: 2
-