From: Eric Leblond Date: Thu, 27 Mar 2025 22:23:50 +0000 (+0100) Subject: tests: add jsonline format test for datajson X-Git-Tag: suricata-7.0.11~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=373dd2aa3c145147ced85e1f1f0b5c5e341a7dc8;p=thirdparty%2Fsuricata-verify.git tests: add jsonline format test for datajson --- diff --git a/tests/datajson/datajson-03-jsonline/host.lst b/tests/datajson/datajson-03-jsonline/host.lst new file mode 100644 index 000000000..2956f3804 --- /dev/null +++ b/tests/datajson/datajson-03-jsonline/host.lst @@ -0,0 +1,2 @@ +{"host": "testmyids.com", "context":"gold old test", "year": 2005} +{"host": "www.testmyids.com", "context":"gold old test", "year": 2005} diff --git a/tests/datajson/datajson-03-jsonline/src.lst b/tests/datajson/datajson-03-jsonline/src.lst new file mode 100644 index 000000000..d1f55c6ac --- /dev/null +++ b/tests/datajson/datajson-03-jsonline/src.lst @@ -0,0 +1,2 @@ +{"ip": "10.16.1.11", "test": "success", "context":3} +{"ip": "10.16.1.12", "test": "fail", "context":4} diff --git a/tests/datajson/datajson-03-jsonline/test.rules b/tests/datajson/datajson-03-jsonline/test.rules new file mode 100644 index 000000000..378b6a3f9 --- /dev/null +++ b/tests/datajson/datajson-03-jsonline/test.rules @@ -0,0 +1 @@ +alert http any any -> any any (flow:established,to_server; http.host; dataset:isset,badhost,type string,load host.lst,format jsonline,enrichment_key bad_host,value_key host; ip.src; dataset:isset,src_ip,type ip,load src.lst,format jsonline,enrichment_key src_ip,value_key ip; sid:1;) diff --git a/tests/datajson/datajson-03-jsonline/test.yaml b/tests/datajson/datajson-03-jsonline/test.yaml new file mode 100644 index 000000000..971905519 --- /dev/null +++ b/tests/datajson/datajson-03-jsonline/test.yaml @@ -0,0 +1,20 @@ +requires: + min-version: 8 + +pcap: ../datajson-01-ip/input.pcap + +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