]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
detect/ftp: ftp.reply keyword tests
authorJeff Lucovsky <jlucovsky@oisf.net>
Fri, 28 Mar 2025 13:29:09 +0000 (09:29 -0400)
committerVictor Julien <victor@inliniac.net>
Mon, 7 Apr 2025 20:04:21 +0000 (22:04 +0200)
Issue: 7508

Add tests for the ftp.reply keyword.

tests/detect-ftp/ftp-reply-01/input.rules [new file with mode: 0644]
tests/detect-ftp/ftp-reply-01/test.yaml [new file with mode: 0644]

diff --git a/tests/detect-ftp/ftp-reply-01/input.rules b/tests/detect-ftp/ftp-reply-01/input.rules
new file mode 100644 (file)
index 0000000..65dc601
--- /dev/null
@@ -0,0 +1,5 @@
+alert ftp any any -> any any (msg: "Match on FTP reply #1"; flow:to_client; ftp.reply; content:"Please specify the password."; sid:1;)
+alert ftp any any -> any any (msg: "Match on FTP reply #2"; flow:to_client; ftp.reply; content:"Opening BINARY mode data connection for temp.txt (1164 bytes)."; sid:2;)
+alert ftp any any -> any any (msg: "Match on FTP reply #3"; flow:to_client; ftp.reply; content:"Transfer complete."; sid:3;)
+alert ftp any any -> any any (msg: "Match on FTP reply #4"; flow:to_client; ftp.reply; content:"Goodbye."; sid:4;)
+alert ftp any any -> any any (msg: "Match on FTP reply #5"; flow:to_client; ftp.reply; content:"Directory send OK."; sid:5;)
diff --git a/tests/detect-ftp/ftp-reply-01/test.yaml b/tests/detect-ftp/ftp-reply-01/test.yaml
new file mode 100644 (file)
index 0000000..a23abc3
--- /dev/null
@@ -0,0 +1,41 @@
+pcap: ../../bug-3519/input.pcap
+
+requires:
+  min-version: 8
+
+checks:
+
+  - filter:
+      count: 1
+      match:
+        event_type: alert
+        ftp.reply: ['Please specify the password.']
+        alert.signature_id: 1
+
+  - filter:
+      count: 1
+      match:
+        event_type: alert
+        ftp.reply.__contains: 'Opening BINARY mode data connection for temp.txt (1164 bytes).'
+        alert.signature_id: 2
+
+  - filter:
+      count: 1
+      match:
+        event_type: alert
+        ftp.reply.__contains: 'Transfer complete.'
+        alert.signature_id: 3
+
+  - filter:
+      count: 1
+      match:
+        event_type: alert
+        ftp.reply.__contains: 'Goodbye.'
+        alert.signature_id: 4
+
+  - filter:
+      count: 1
+      match:
+        event_type: alert
+        ftp.reply.__contains: 'Directory send OK.'
+        alert.signature_id: 5