]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
file: Add tests for file_data prefilter keyword
authorHaleema Khan <hsadia538@gmail.com>
Tue, 14 Feb 2023 13:27:10 +0000 (18:27 +0500)
committerShivani Bhardwaj <shivanib134@gmail.com>
Wed, 22 Mar 2023 06:28:50 +0000 (11:58 +0530)
Tests the `prefilter` keyword for `file_data` and `file.data`

Ticket #5801

tests/file-data-prefilter/README.md [new file with mode: 0644]
tests/file-data-prefilter/test.rules [new file with mode: 0644]
tests/file-data-prefilter/test.yaml [new file with mode: 0644]

diff --git a/tests/file-data-prefilter/README.md b/tests/file-data-prefilter/README.md
new file mode 100644 (file)
index 0000000..74ab430
--- /dev/null
@@ -0,0 +1,11 @@
+Description
+===========
+Tests the `prefilter` keyword for `file_data` and `file.data`.
+
+PCAP
+====
+PCAP comes from an [existing file-data test](https://github.com/OISF/suricata-verify/blob/master/tests/file-data-depth-inspection/file-data-depth-inpsection.pcap)
+
+Redmine ticket
+==============
+https://redmine.openinfosecfoundation.org/issues/5801
\ No newline at end of file
diff --git a/tests/file-data-prefilter/test.rules b/tests/file-data-prefilter/test.rules
new file mode 100644 (file)
index 0000000..0667146
--- /dev/null
@@ -0,0 +1,4 @@
+# test prefilter keyword for file_data
+alert tcp any any -> any 25 (msg:"VIRUS INBOUND bad file attachment"; flow:to_server,established; content:"content-disposition|3a| attachment|3b|"; nocase; content:".zip|22|"; nocase; within:128; file_data; content:".pdf.exe"; prefilter; within:64; sid:1; rev:1;)
+# test prefilter keyword for file.data
+alert tcp any any -> any 25 (msg:"VIRUS INBOUND bad file attachment"; flow:to_server,established; content:"content-disposition|3a| attachment|3b|"; nocase; content:".zip|22|"; nocase; within:128; file.data; content:".pdf.exe"; prefilter; within:64; sid:2; rev:1;)
\ No newline at end of file
diff --git a/tests/file-data-prefilter/test.yaml b/tests/file-data-prefilter/test.yaml
new file mode 100644 (file)
index 0000000..54c081c
--- /dev/null
@@ -0,0 +1,13 @@
+pcap: ../file-data-depth-inspection/file-data-depth-inpsection.pcap
+
+checks:
+    - filter:
+        count: 2
+        match:
+            event_type: alert
+            alert.signature_id: 1
+    - filter:
+        count: 2
+        match:
+            event_type: alert
+            alert.signature_id: 2
\ No newline at end of file