-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: add test for vlan.id - v8 #2194
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 2.5.0. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add the redmine ticket link reference here? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
alert ip any any -> any any (msg:"Vlan ID is equal to 200 with specific layer"; vlan.id:200,0; sid:1;) | ||
alert ip any any -> any any (msg:"One Vlan ID is equal to 300"; vlan.id:300; sid:2;) | ||
alert ip any any -> any any (msg:"Last Vlan ID is equal to 400"; vlan.id:400,-1; sid:3;) | ||
alert ip any any -> any any (msg:"Vlan ID is equal to 300 with specific layer"; vlan.id:0x12C,1; sid:4;) | ||
alert ip any any -> any any (msg:"Vlan ID at layer 1 is not equal to 200"; vlan.id:!200,1; sid:5;) | ||
alert ip any any -> any any (msg:"There is no VLAN ID equal to 500"; vlan.id:!500,all; sid:6;) | ||
alert ip any any -> any any (msg:"VLAN ID at layer 2 is between 100 and 600"; vlan.id:100-600,2; sid:7;) | ||
alert ip any any -> any any (msg:"VLAN ID at layer 1 is less than 400"; vlan.id:<400,1; sid:8;) | ||
alert ip any any -> any any (msg:"One Vlan ID is greater than or equal to 200"; vlan.id:>=0xC8; sid:9;) | ||
alert ip any any -> any any (msg:"All the Vlan IDs are greater than 100"; vlan.id:>100,all; sid:10;) | ||
alert ip any any -> any any (msg:"Packet has 3 VLAN layers"; vlan.id:3,count; sid:11;) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This PR is really fine. You could also add You could also add a signature with |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
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[1]: 300 | ||
alert.signature_id: 2 | ||
- filter: | ||
count: 1 | ||
match: | ||
event_type: alert | ||
vlan[2]: 400 | ||
alert.signature_id: 3 | ||
- filter: | ||
count: 1 | ||
match: | ||
event_type: alert | ||
vlan[1]: 300 | ||
alert.signature_id: 4 | ||
- filter: | ||
count: 1 | ||
match: | ||
event_type: alert | ||
alert.signature_id: 5 | ||
- filter: | ||
count: 1 | ||
match: | ||
event_type: alert | ||
alert.signature_id: 6 | ||
- filter: | ||
count: 1 | ||
match: | ||
event_type: alert | ||
alert.signature_id: 7 | ||
- filter: | ||
count: 1 | ||
match: | ||
event_type: alert | ||
alert.signature_id: 8 | ||
- filter: | ||
count: 1 | ||
match: | ||
event_type: alert | ||
alert.signature_id: 9 | ||
- filter: | ||
count: 1 | ||
match: | ||
event_type: alert | ||
alert.signature_id: 10 | ||
- filter: | ||
count: 1 | ||
match: | ||
event_type: alert | ||
alert.signature_id: 11 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#! /usr/bin/env python3 | ||
from scapy.all import * | ||
Comment on lines
+1
to
+2
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we also have the scapy version as a comment here in the script? Makes it easier to not lose the information :) |
||
|
||
CLIENT_MAC = "11:11:11:11:11:11" | ||
SERVER_MAC = "22:22:22:22:22:22" | ||
|
||
CLIENT_IP = "1.1.1.1" | ||
SERVER_IP = "2.2.2.2" | ||
|
||
request = (Ether(src=CLIENT_MAC, dst=SERVER_MAC) / | ||
Dot1Q(vlan=200) / | ||
Dot1Q(vlan=300) / | ||
Dot1Q(vlan=400) / | ||
IP(src=CLIENT_IP, dst=SERVER_IP) / | ||
ICMP(type=8)) | ||
|
||
wrpcap("input.pcap", request, append=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As with the docs, these look better if we keep lines to a certain character count limit.
Let's try around 79 or 80?