]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
tests: add second datajson test
authorEric Leblond <el@stamus-networks.com>
Wed, 2 Oct 2024 20:48:08 +0000 (22:48 +0200)
committerEric Leblond <el@stamus-networks.com>
Wed, 11 Jun 2025 12:01:45 +0000 (14:01 +0200)
tests/datajson/datajson-02-multiple/host.lst [new file with mode: 0644]
tests/datajson/datajson-02-multiple/input.pcap [new file with mode: 0644]
tests/datajson/datajson-02-multiple/src.lst [new file with mode: 0644]
tests/datajson/datajson-02-multiple/test.rules [new file with mode: 0644]
tests/datajson/datajson-02-multiple/test.yaml [new file with mode: 0644]

diff --git a/tests/datajson/datajson-02-multiple/host.lst b/tests/datajson/datajson-02-multiple/host.lst
new file mode 100644 (file)
index 0000000..f1b1a17
--- /dev/null
@@ -0,0 +1 @@
+d3d3LnRlc3RteWlkcy5jb20=,{"context":"gold old test", "year": 2005}
diff --git a/tests/datajson/datajson-02-multiple/input.pcap b/tests/datajson/datajson-02-multiple/input.pcap
new file mode 100644 (file)
index 0000000..8fb6832
Binary files /dev/null and b/tests/datajson/datajson-02-multiple/input.pcap differ
diff --git a/tests/datajson/datajson-02-multiple/src.lst b/tests/datajson/datajson-02-multiple/src.lst
new file mode 100644 (file)
index 0000000..f44ad18
--- /dev/null
@@ -0,0 +1 @@
+10.16.1.11,{"test": "success","context":3}
diff --git a/tests/datajson/datajson-02-multiple/test.rules b/tests/datajson/datajson-02-multiple/test.rules
new file mode 100644 (file)
index 0000000..acbf304
--- /dev/null
@@ -0,0 +1 @@
+alert http any any -> any any (flow:established,to_server; http.host; datajson:isset,badhost,type string,load host.lst,key bad_host; ip.src; datajson:isset,src_ip,type ip,load src.lst,key src_ip; sid:1;)
diff --git a/tests/datajson/datajson-02-multiple/test.yaml b/tests/datajson/datajson-02-multiple/test.yaml
new file mode 100644 (file)
index 0000000..bad24cf
--- /dev/null
@@ -0,0 +1,21 @@
+requires:
+  features:
+    - HAVE_LIBJANSSON
+  files:
+    - src/datasets.c
+
+args:
+ - -k none --set datasets.enabled=yes
+
+checks:
+  - filter:
+      count: 1
+      match:
+        event_type: alert
+  - filter:
+      count: 1
+      match:
+        event_type: alert
+        alert.signature_id: 1
+        alert.extra.src_ip.test: success
+        alert.extra.bad_host.year: 2005