]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
dnp3: adds tests about dnp3.ind keyword 2663/head 2667/head
authorPhilippe Antoine <pantoine@oisf.net>
Wed, 24 Sep 2025 19:08:23 +0000 (21:08 +0200)
committerPhilippe Antoine <pantoine@oisf.net>
Wed, 24 Sep 2025 19:10:24 +0000 (21:10 +0200)
Ticket: 6724

tests/dnp3/dnp3-ind-keyword/README.md [new file with mode: 0644]
tests/dnp3/dnp3-ind-keyword/suricata.yaml [new file with mode: 0644]
tests/dnp3/dnp3-ind-keyword/test.rules [new file with mode: 0644]
tests/dnp3/dnp3-ind-keyword/test.yaml [new file with mode: 0644]

diff --git a/tests/dnp3/dnp3-ind-keyword/README.md b/tests/dnp3/dnp3-ind-keyword/README.md
new file mode 100644 (file)
index 0000000..5d3b6e8
--- /dev/null
@@ -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 (file)
index 0000000..3011d88
--- /dev/null
@@ -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 (file)
index 0000000..02130dc
--- /dev/null
@@ -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 (file)
index 0000000..0c50bd9
--- /dev/null
@@ -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