Skip to content

Commit

Permalink
detect: add test for vlan.layers
Browse files Browse the repository at this point in the history
Ticket: #1065
  • Loading branch information
AkakiAlice committed Jan 13, 2025
1 parent af8c996 commit 41a2c6b
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/detect-vlan-layers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Test for checking the working of vlan.layers keyword.
The packet is an ICMP packet with 3 VLAN layers.

PCAP created with scapy 2.5.0.

redmine ticket: https://redmine.openinfosecfoundation.org/issues/1065
4 changes: 4 additions & 0 deletions tests/detect-vlan-layers/test.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
alert ip any any -> any any (msg:"Packet has 3 VLAN layers"; vlan.layers:3; sid:1;)
alert ip any any -> any any (msg:"Packet has more than 2 VLAN layers"; vlan.layers:>2; sid:2;)
alert ip any any -> any any (msg:"The number of layers in the packet is not 1"; vlan.layers:!1; sid:3;)
alert ip any any -> any any (msg:"Packet has 0 VLAN layers"; vlan.layers:0; sid:4;)
33 changes: 33 additions & 0 deletions tests/detect-vlan-layers/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
requires:
min-version: 8

pcap: ../detect-vlan-id/input.pcap

args:
- -k none

checks:
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 1
alert.signature_id: 1
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 1
alert.signature_id: 2
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 1
alert.signature_id: 3
- filter:
count: 1
match:
event_type: alert
pcap_cnt: 2
alert.signature_id: 4

0 comments on commit 41a2c6b

Please sign in to comment.