]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
doc: Document SCByteVarGet lua function
authorBenjamin Wilkins <benjamin.wilkins@uwaterloo.ca>
Wed, 3 Nov 2021 17:20:06 +0000 (13:20 -0400)
committerVictor Julien <vjulien@oisf.net>
Tue, 9 Aug 2022 08:52:37 +0000 (10:52 +0200)
Add documentation for accessing results from byte_extract and byte_math
in lua match functions

Issue: 2871

doc/userguide/lua/lua-functions.rst

index e4aab57e554eda9ef416e6fd8ec478d6762a9113..c5c092999c39e53057efe7cf9fa6bebbf3132c86 100644 (file)
@@ -1083,3 +1083,26 @@ Expose the log path.
       filename = SCLogPath() .. "/" .. name
       file = assert(io.open(filename, "a"))
   end
+
+SCByteVarGet
+~~~~~~~~~~~~
+
+Get the ByteVar at index given by the parameter. These variables are defined by
+`byte_extract` or `byte_math` in Suricata rules. Only callable from match scripts.
+
+::
+
+ function init(args)
+     local needs = {}
+     needs["bytevar"] = {"var1", "var2"}
+     return needs
+ end
+
+Here we define a register that we will be using variables `var1` and `var2`.
+The access to the Byte variables is done by index.
+
+::
+
+ function match(args)
+     var1 = SCByteVarGet(0)
+     var2 = SCByteVarGet(1)