]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
tests: test new json format option
authorEric Leblond <el@stamus-networks.com>
Sun, 22 Dec 2024 09:34:21 +0000 (10:34 +0100)
committerEric Leblond <el@stamus-networks.com>
Wed, 11 Jun 2025 12:01:45 +0000 (14:01 +0200)
tests/datajson/datajson-09-jsonformat/hosts-nested-key.json [new file with mode: 0644]
tests/datajson/datajson-09-jsonformat/test.rules
tests/datajson/datajson-09-jsonformat/test.yaml

diff --git a/tests/datajson/datajson-09-jsonformat/hosts-nested-key.json b/tests/datajson/datajson-09-jsonformat/hosts-nested-key.json
new file mode 100644 (file)
index 0000000..df49060
--- /dev/null
@@ -0,0 +1,21 @@
+{
+  "info": {
+    "threat": [
+      {
+        "context": "gold old test",
+        "year": 2005,
+        "host": {
+          "fqdn": "www.testmyids.com",
+          "domain": "testmyids.com"
+        }
+      },
+      {
+        "context": "old test",
+        "year": 2023,
+        "host": {
+          "domain": "testmyids.com"
+        }
+      }
+    ]
+  }
+}
index c22e2916457518928a035d3a14f66459e197e264..4caa80a70bd96275906f4afaf6eada39a5c9e41b 100644 (file)
@@ -2,5 +2,6 @@ alert http any any -> any any (flow:established,to_server; http.host; datajson:i
 
 alert http any any -> any any (flow:established,to_server; http.host; datajson:isset,dbadhost,type string,load hosts-direct.json,key dbad_host,json_key host; ip.src; datajson:isset,src_ip,type ip,load src.json,key src_ip,json_key ip; sid:2;)
 
-
 alert http any any -> any any (flow:established,to_server; http.host; datajson:isset,nbadhost,type string,load hosts-nested.json,key nbad_host,json_key host, array_key info.threat; ip.src; datajson:isset,src_ip,type ip,load src.json,key src_ip,json_key ip; sid:3;)
+
+alert http any any -> any any (flow:established,to_server; http.host; datajson:isset,nkbadhost,type string,load hosts-nested-key.json,key nkbad_host,json_key host.fqdn, array_key info.threat; ip.src; datajson:isset,src_ip,type ip,load src.json,key src_ip,json_key ip; sid:4;)
index 6e95693a58accb5d975240edfb6a4ab8ec3cd409..669934fa20e25f3ceb9766d4c9e2f6589e5d49d3 100644 (file)
@@ -9,7 +9,7 @@ args:
 
 checks:
   - filter:
-      count: 3
+      count: 4
       match:
         event_type: alert
   - filter:
@@ -33,3 +33,11 @@ checks:
         alert.signature_id: 3
         alert.extra.src_ip.test: success
         alert.extra.nbad_host.year: 2005
+  - filter:
+      count: 1
+      match:
+        event_type: alert
+        alert.signature_id: 4
+        alert.extra.src_ip.test: success
+        alert.extra.nkbad_host.year: 2005
+        alert.extra.nkbad_host.host.domain: testmyids.com