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

diff --git a/tests/datajson/datajson-01-ip/input.pcap b/tests/datajson/datajson-01-ip/input.pcap
new file mode 100644 (file)
index 0000000..8fb6832
Binary files /dev/null and b/tests/datajson/datajson-01-ip/input.pcap differ
diff --git a/tests/datajson/datajson-01-ip/src.lst b/tests/datajson/datajson-01-ip/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-01-ip/test.rules b/tests/datajson/datajson-01-ip/test.rules
new file mode 100644 (file)
index 0000000..6a94208
--- /dev/null
@@ -0,0 +1 @@
+alert http any any -> any any (flow:established,to_server; http.host; content:"testmyids.com"; ip.src; datajson:isset,src_ip,type ip,load src.lst,key src_ip; sid:1;)
diff --git a/tests/datajson/datajson-01-ip/test.yaml b/tests/datajson/datajson-01-ip/test.yaml
new file mode 100644 (file)
index 0000000..6dc7402
--- /dev/null
@@ -0,0 +1,20 @@
+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