From 0f99e37b1c6a3453dafe966f41da4b5a3d28e540 Mon Sep 17 00:00:00 2001 From: Alice Akaki Date: Thu, 7 Nov 2024 17:12:46 -0400 Subject: [PATCH] test: add test for vlan.id Ticket: #1065 --- tests/detect-vlan-id/README.md | 3 +++ tests/detect-vlan-id/input.pcap | Bin 0 -> 94 bytes tests/detect-vlan-id/test.rules | 2 ++ tests/detect-vlan-id/test.yaml | 19 +++++++++++++++++++ 4 files changed, 24 insertions(+) create mode 100644 tests/detect-vlan-id/README.md create mode 100644 tests/detect-vlan-id/input.pcap create mode 100644 tests/detect-vlan-id/test.rules create mode 100644 tests/detect-vlan-id/test.yaml diff --git a/tests/detect-vlan-id/README.md b/tests/detect-vlan-id/README.md new file mode 100644 index 000000000..0c097ef2c --- /dev/null +++ b/tests/detect-vlan-id/README.md @@ -0,0 +1,3 @@ +Test for checking the working of vlan.id keyword by creating rules and matching a crafted packet against them. The packet is an ICMP packet with 3 different VLAN ids [200,300,400]. + +PCAP created with scapy. diff --git a/tests/detect-vlan-id/input.pcap b/tests/detect-vlan-id/input.pcap new file mode 100644 index 0000000000000000000000000000000000000000..35ee79b95ee4d0e807dad33c74a1e6fde07226a7 GIT binary patch literal 94 zcmca|c+)~A1{MYw`2U}Qff2}guC1Hi`InQy49EsyB`^>KgGL616O9avIzT*ugTa-7 YK?bD7fwAN^BM>kF0SCi(pg9Z-0C{c@&;S4c literal 0 HcmV?d00001 diff --git a/tests/detect-vlan-id/test.rules b/tests/detect-vlan-id/test.rules new file mode 100644 index 000000000..3c3b830db --- /dev/null +++ b/tests/detect-vlan-id/test.rules @@ -0,0 +1,2 @@ +alert ip any any -> any any (msg:"Vlan ID is equal to 200 with specific layer"; vlan.id:200,1; sid:1;) +alert ip any any -> any any (msg:"Vlan ID is equal to 400"; vlan.id:400; sid:2;) diff --git a/tests/detect-vlan-id/test.yaml b/tests/detect-vlan-id/test.yaml new file mode 100644 index 000000000..797faa7e7 --- /dev/null +++ b/tests/detect-vlan-id/test.yaml @@ -0,0 +1,19 @@ +requires: + min-version: 8 + +args: +- -k none + +checks: +- filter: + count: 1 + match: + event_type: alert + vlan[0]: 200 + alert.signature_id: 1 +- filter: + count: 1 + match: + event_type: alert + vlan[2]: 400 + alert.signature_id: 2