From: Philippe Antoine Date: Wed, 24 Sep 2025 19:08:23 +0000 (+0200) Subject: dnp3: adds tests about dnp3.ind keyword X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=adf2ff4811bcf4ba8b02cb73dcd9f2384bfb276f;p=thirdparty%2Fsuricata-verify.git dnp3: adds tests about dnp3.ind keyword Ticket: 6724 --- diff --git a/tests/dnp3/dnp3-ind-keyword/README.md b/tests/dnp3/dnp3-ind-keyword/README.md new file mode 100644 index 000000000..5d3b6e861 --- /dev/null +++ b/tests/dnp3/dnp3-ind-keyword/README.md @@ -0,0 +1,7 @@ +# Description + +Test dnp3.ind rule keyword. + +# PCAP + +reused diff --git a/tests/dnp3/dnp3-ind-keyword/suricata.yaml b/tests/dnp3/dnp3-ind-keyword/suricata.yaml new file mode 100644 index 000000000..3011d88dc --- /dev/null +++ b/tests/dnp3/dnp3-ind-keyword/suricata.yaml @@ -0,0 +1,20 @@ +%YAML 1.1 +--- + +outputs: + - eve-log: + enabled: yes + filetype: regular + filename: eve.json + types: + - alert: + payload: yes + packet: yes + dnp3: yes + +app-layer: + protocols: + dnp3: + enabled: yes + detection-ports: + dp: 20000 diff --git a/tests/dnp3/dnp3-ind-keyword/test.rules b/tests/dnp3/dnp3-ind-keyword/test.rules new file mode 100644 index 000000000..02130dc86 --- /dev/null +++ b/tests/dnp3/dnp3-ind-keyword/test.rules @@ -0,0 +1,19 @@ +# Should match. +alert dnp3 any any -> any any (msg:"DNP3 ind test_restart string"; \ + dnp3.ind:device_restart; sid:1; rev:1;) + +# Should match. +alert dnp3 any any -> any any (msg:"DNP3 ind test_restart num"; \ + dnp3.ind:0x8000; sid:2; rev:1;) + +# Should match. +alert dnp3 any any -> any any (msg:"DNP3 ind not zero"; \ + dnp3.ind:!0; sid:3; rev:1;) + +alert dnp3 any any -> any any (msg:"DNP3 ind test_restart multi"; \ + dnp3.ind:device_restart,!need_time; sid:4; rev:1;) + +# Should not match. +alert dnp3 any any -> any any (msg:"DNP3 ind need_time"; \ + dnp3.ind:need_time; sid:5; rev:1;) + diff --git a/tests/dnp3/dnp3-ind-keyword/test.yaml b/tests/dnp3/dnp3-ind-keyword/test.yaml new file mode 100644 index 000000000..0c50bd9cb --- /dev/null +++ b/tests/dnp3/dnp3-ind-keyword/test.yaml @@ -0,0 +1,30 @@ +requires: + min-version: 9 + +pcap: ../dnp3-eve/input.pcap + +checks: + - filter: + count: 2 + match: + alert.signature_id: 1 + dnp3.response.iin.indicators[0]: device_restart + checks: + - filter: + count: 2 + match: + alert.signature_id: 2 + dnp3.response.iin.indicators[0]: device_restart + - filter: + count: 2 + match: + alert.signature_id: 3 + - filter: + count: 2 + match: + alert.signature_id: 4 + dnp3.response.iin.indicators[0]: device_restart + - filter: + count: 0 + match: + alert.signature_id: 5