]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
tests: add test for Rust template parser 483/head
authorJason Ish <jason.ish@oisf.net>
Mon, 29 Mar 2021 16:28:17 +0000 (10:28 -0600)
committerJason Ish <jason.ish@oisf.net>
Mon, 29 Mar 2021 16:28:17 +0000 (10:28 -0600)
tests/app-layer-template-rust/input.pcap [new file with mode: 0644]
tests/app-layer-template-rust/suricata.yaml [new file with mode: 0644]
tests/app-layer-template-rust/test.rules [new file with mode: 0644]
tests/app-layer-template-rust/test.yaml [new file with mode: 0644]

diff --git a/tests/app-layer-template-rust/input.pcap b/tests/app-layer-template-rust/input.pcap
new file mode 100644 (file)
index 0000000..00abe26
Binary files /dev/null and b/tests/app-layer-template-rust/input.pcap differ
diff --git a/tests/app-layer-template-rust/suricata.yaml b/tests/app-layer-template-rust/suricata.yaml
new file mode 100644 (file)
index 0000000..4a8c639
--- /dev/null
@@ -0,0 +1,17 @@
+%YAML 1.1
+---
+
+outputs:
+  - eve-log:
+      enabled: yes
+      types:
+        - template-rust
+        - alert
+        - flow
+
+app-layer:
+  protocols:
+    template-rust:
+      enabled: yes
+      detection-ports:
+        dp: 7000
diff --git a/tests/app-layer-template-rust/test.rules b/tests/app-layer-template-rust/test.rules
new file mode 100644 (file)
index 0000000..6bb6650
--- /dev/null
@@ -0,0 +1,2 @@
+alert template-rust any any -> any any (msg:"TEST"; content:"Hello"; flow:established,to_server; sid:1; rev:1;)
+alert template-rust any any -> any any (msg:"TEST"; content:"Bye"; flow:established,to_client; sid:2; rev:1;)
diff --git a/tests/app-layer-template-rust/test.yaml b/tests/app-layer-template-rust/test.yaml
new file mode 100644 (file)
index 0000000..a92b6f2
--- /dev/null
@@ -0,0 +1,54 @@
+# *** Add configuration here ***
+
+args:
+- -k none
+
+checks:
+- filter:
+    count: 1
+    match:
+      dest_ip: 10.16.1.10
+      dest_port: 7000
+      event_type: template-rust
+      pcap_cnt: 7
+      proto: TCP
+      src_ip: 10.16.1.11
+      src_port: 58352
+      template.request: Hello World!
+      template.response: Bye
+- filter:
+    count: 1
+    match:
+      event_type: alert
+      alert.signature_id: 1
+- filter:
+    count: 1
+    match:
+      event_type: alert
+      alert.signature_id: 2
+- filter:
+    count: 1
+    match:
+      app_proto: template-rust
+      dest_ip: 10.16.1.10
+      dest_port: 7000
+      event_type: flow
+      flow.age: 20
+      flow.alerted: true
+      flow.bytes_toclient: 277
+      flow.bytes_toserver: 419
+      flow.pkts_toclient: 4
+      flow.pkts_toserver: 6
+      flow.reason: shutdown
+      flow.state: closed
+      proto: TCP
+      src_ip: 10.16.1.11
+      src_port: 58352
+      tcp.ack: true
+      tcp.fin: true
+      tcp.psh: true
+      tcp.state: closed
+      tcp.syn: true
+      tcp.tcp_flags: 1b
+      tcp.tcp_flags_tc: 1b
+      tcp.tcp_flags_ts: 1b