]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
tests: engine-analysis for like_ip_only rule type
authorJuliana Fajardini <jufajardini@gmail.com>
Fri, 24 Jan 2025 22:01:44 +0000 (19:01 -0300)
committerVictor Julien <victor@inliniac.net>
Tue, 28 Jan 2025 08:32:49 +0000 (09:32 +0100)
Add engine-analysis tests for like_ip_only rule type, to accompany rule
types documentation.

Related to
Task #7031

tests/rules/rule-type-like-ip-only/test.rules [new file with mode: 0644]
tests/rules/rule-type-like-ip-only/test.yaml [new file with mode: 0644]

diff --git a/tests/rules/rule-type-like-ip-only/test.rules b/tests/rules/rule-type-like-ip-only/test.rules
new file mode 100644 (file)
index 0000000..d54d69e
--- /dev/null
@@ -0,0 +1,3 @@
+# Like IP Only Rules (IP Only with negated addresses)
+alert tcp 192.168.0.0/16,10.0.0.0/8,172.16.0.0/12 any -> ![192.168.0.0/16,10.0.0.0/8,172.16.0.0/12] any (msg:"tcp, has negated IP address"; sid:304;)
+alert tcp [10.0.0.0/8,!10.10.10.10] any -> [10.0.0.0/8,!10.10.10.10] any (msg:"tcp, has negated IP address"; sid:305;)
diff --git a/tests/rules/rule-type-like-ip-only/test.yaml b/tests/rules/rule-type-like-ip-only/test.yaml
new file mode 100644 (file)
index 0000000..14bc00a
--- /dev/null
@@ -0,0 +1,20 @@
+requires:
+  min-version: 7
+  pcap: false
+
+args:
+- --engine-analysis
+
+checks:
+  - filter:
+      filename: rules.json
+      count: 1
+      match:
+        id: 304
+        type: "like_ip_only"
+  - filter:
+      filename: rules.json
+      count: 1
+      match:
+        id: 305
+        type: "like_ip_only"