]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
tests: add invalid byte extract depth usage 72/head
authorjason taylor <jtfas90@gmail.com>
Thu, 23 May 2019 00:04:55 +0000 (20:04 -0400)
committerVictor Julien <victor@inliniac.net>
Tue, 28 May 2019 09:56:40 +0000 (11:56 +0200)
Signed-off-by: jason taylor <jtfas90@gmail.com>
tests/test-bad-byte-extract-rule-1/suricata.yaml [new file with mode: 0644]
tests/test-bad-byte-extract-rule-1/test.rules [new file with mode: 0644]
tests/test-bad-byte-extract-rule-1/test.yaml [new file with mode: 0644]
tests/test-bad-byte-extract-rule-2/suricata.yaml [new file with mode: 0644]
tests/test-bad-byte-extract-rule-2/test.rules [new file with mode: 0644]
tests/test-bad-byte-extract-rule-2/test.yaml [new file with mode: 0644]

diff --git a/tests/test-bad-byte-extract-rule-1/suricata.yaml b/tests/test-bad-byte-extract-rule-1/suricata.yaml
new file mode 100644 (file)
index 0000000..dcaae57
--- /dev/null
@@ -0,0 +1,10 @@
+%YAML 1.1
+---
+
+logging:
+  default-log-level: info
+  outputs:
+  - file:
+      enabled: yes
+      filename: eve.json
+      type: json
diff --git a/tests/test-bad-byte-extract-rule-1/test.rules b/tests/test-bad-byte-extract-rule-1/test.rules
new file mode 100644 (file)
index 0000000..ede6581
--- /dev/null
@@ -0,0 +1 @@
+alert tcp any any -> any any (msg:"Byte_Extract Example Using depth"; content:"Alice"; depth:d; byte_extract:2,1,size; content:"Bob"; sid:1111;)
diff --git a/tests/test-bad-byte-extract-rule-1/test.yaml b/tests/test-bad-byte-extract-rule-1/test.yaml
new file mode 100644 (file)
index 0000000..004036e
--- /dev/null
@@ -0,0 +1,23 @@
+requires:
+  min-version: 5.0.0
+
+  features:
+    - HAVE_LIBJANSSON
+
+command: |
+  ${SRCDIR}/src/suricata --set classification-file="${SRCDIR}/classification.config" --set reference-config-file="${SRCDIR}/reference.config" -l ${OUTPUT_DIR} -c ${TEST_DIR}/suricata.yaml -r ${TEST_DIR}/ -S ${TEST_DIR}/test.rules
+
+checks:
+  # check that we have the following entres in eve.json
+  # match 1 specific rule load failure reason
+  - filter:
+      count: 1
+      match:
+        event_type: engine
+        engine.message: "unknown byte_extract var seen in depth - d."
+
+  - filter:
+      count: 1
+      match:
+        event_type: engine
+        engine.error: "SC_ERR_NO_RULES_LOADED"
diff --git a/tests/test-bad-byte-extract-rule-2/suricata.yaml b/tests/test-bad-byte-extract-rule-2/suricata.yaml
new file mode 100644 (file)
index 0000000..dcaae57
--- /dev/null
@@ -0,0 +1,10 @@
+%YAML 1.1
+---
+
+logging:
+  default-log-level: info
+  outputs:
+  - file:
+      enabled: yes
+      filename: eve.json
+      type: json
diff --git a/tests/test-bad-byte-extract-rule-2/test.rules b/tests/test-bad-byte-extract-rule-2/test.rules
new file mode 100644 (file)
index 0000000..eb9e9b6
--- /dev/null
@@ -0,0 +1 @@
+alert tcp any any -> any any (msg:"bad depth value rule"; content:"first"; depth:-5; byte_extract:2,0,size; sid:111232; rev:1;)
diff --git a/tests/test-bad-byte-extract-rule-2/test.yaml b/tests/test-bad-byte-extract-rule-2/test.yaml
new file mode 100644 (file)
index 0000000..306e1d7
--- /dev/null
@@ -0,0 +1,23 @@
+requires:
+  min-version: 5.0.0
+
+  features:
+    - HAVE_LIBJANSSON
+
+command: |
+  ${SRCDIR}/src/suricata --set classification-file="${SRCDIR}/classification.config" --set reference-config-file="${SRCDIR}/reference.config" -l ${OUTPUT_DIR} -c ${TEST_DIR}/suricata.yaml -r ${TEST_DIR}/ -S ${TEST_DIR}/test.rules
+
+checks:
+  # check that we have the following entres in eve.json
+  # match 1 specific rule load failure reason
+  - filter:
+      count: 1
+      match:
+        event_type: engine
+        engine.message: "invalid value for depth: -5."
+
+  - filter:
+      count: 1
+      match:
+        event_type: engine
+        engine.error: "SC_ERR_NO_RULES_LOADED"