]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
alert: verify test for distance/within keywords
authorjason taylor <jtfas90@gmail.com>
Thu, 4 Apr 2019 00:33:52 +0000 (20:33 -0400)
committerVictor Julien <victor@inliniac.net>
Tue, 23 Apr 2019 08:23:42 +0000 (10:23 +0200)
* this is based on https://redmine.openinfosecfoundation.org/issues/1

Signed-off-by: jason taylor <jtfas90@gmail.com>
tests/alert-distance-within-1/input.pcap [new file with mode: 0644]
tests/alert-distance-within-1/suricata.yaml [new file with mode: 0644]
tests/alert-distance-within-1/test.rules [new file with mode: 0644]
tests/alert-distance-within-1/test.yaml [new file with mode: 0644]

diff --git a/tests/alert-distance-within-1/input.pcap b/tests/alert-distance-within-1/input.pcap
new file mode 100644 (file)
index 0000000..0ecfdfa
Binary files /dev/null and b/tests/alert-distance-within-1/input.pcap differ
diff --git a/tests/alert-distance-within-1/suricata.yaml b/tests/alert-distance-within-1/suricata.yaml
new file mode 100644 (file)
index 0000000..05c3bb0
--- /dev/null
@@ -0,0 +1,16 @@
+%YAML 1.1
+---
+
+outputs:
+  - eve-log:
+      enabled: yes
+      filetype: regular #regular|syslog|unix_dgram|unix_stream|redis
+      filename: eve.json
+      types:
+        - alert:
+            payload: no
+            payload-buffer-size: 4kb
+            payload-printable: no
+            packet: no
+            metadata: no
+        - http:
diff --git a/tests/alert-distance-within-1/test.rules b/tests/alert-distance-within-1/test.rules
new file mode 100644 (file)
index 0000000..63a6902
--- /dev/null
@@ -0,0 +1 @@
+alert tcp any any -> any any (msg:"AllWorkAndNoPlay"; content:"AllWorkAndNoPlayMakesWill"; content:"DullBoy"; distance:1; within:7; sid:2;)
diff --git a/tests/alert-distance-within-1/test.yaml b/tests/alert-distance-within-1/test.yaml
new file mode 100644 (file)
index 0000000..7a28ede
--- /dev/null
@@ -0,0 +1,16 @@
+requires:
+  features:
+    - HAVE_LIBJANSSON
+
+checks:
+
+  # Check that we have the following events in eve.json
+  # 2 - alert events
+  # 1 - http event
+  - filter:
+      count: 2
+      match:
+        event_type: alert
+      count: 1
+      match:
+        event_type: http