Skip to content

Commit 8b7e9b4

Browse files
committed
test/entropy: Update checks to include sid
The sid is part of the log -- e.g., sticky-buffer_sid -- so update the test checks for each sid that alerts.
1 parent 2438f11 commit 8b7e9b4

File tree

4 files changed

+91
-1
lines changed

4 files changed

+91
-1
lines changed

tests/entropy/entropy-01/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
requires:
2-
min-version: 8
2+
version: 8
33

44
checks:
55
- filter:

tests/entropy/entropy-02/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This test checks the entropy keyword with a comparison against HTTP file data and ensures
2+
that the logging name is composed of the sticky buffer and sid.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# The entropy value is 4.137370175000773
2+
alert http any any -> any any (msg:"entropy simple test"; file.data; entropy: value > 4; sid:1;)
3+
alert http any any -> any any (msg:"entropy simple test"; file.data; entropy: value >= 4; sid:2;)
4+
alert http any any -> any any (msg:"entropy simple test"; file.data; entropy: value >= 5; sid:3;)
5+
alert http any any -> any any (msg:"entropy simple test"; file.data; entropy: value 4-5; sid:4;)
6+
alert http any any -> any any (msg:"entropy simple test"; file.data; entropy: value !4-5; sid:5;)
7+
alert http any any -> any any (msg:"entropy simple test"; file.data; entropy: value < 4; sid:6;)
8+
alert http any any -> any any (msg:"entropy simple test"; file.data; entropy: value != 4; sid:7;)
9+
alert http any any -> any any (msg:"entropy simple test"; file.data; entropy: value = 4; sid:8;)
10+
# The entropy value is 4.150007324019584
11+
alert http any any -> any any (msg:"entropy simple test"; file.data; entropy: offset 10, value > 4.14; sid:10;)
12+

tests/entropy/entropy-02/test.yaml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
requires:
2+
min-version: 8.0.1
3+
4+
pcap: ../entropy-01/input.pcap
5+
6+
args:
7+
- --set logging.entropy.make-unique=on
8+
9+
checks:
10+
- filter:
11+
count: 1
12+
match:
13+
event_type: alert
14+
alert.signature_id: 1
15+
metadata.entropy.file_data_1: 4.137370175000773
16+
- filter:
17+
count: 1
18+
match:
19+
event_type: alert
20+
alert.signature_id: 2
21+
metadata.entropy.file_data_2: 4.137370175000773
22+
- filter:
23+
count: 0
24+
match:
25+
event_type: alert
26+
alert.signature_id: 3
27+
- filter:
28+
count: 1
29+
match:
30+
event_type: alert
31+
alert.signature_id: 4
32+
metadata.entropy.file_data_4: 4.137370175000773
33+
- filter:
34+
count: 0
35+
match:
36+
event_type: alert
37+
alert.signature_id: 5
38+
- filter:
39+
count: 0
40+
match:
41+
event_type: alert
42+
alert.signature_id: 6
43+
- filter:
44+
count: 1
45+
match:
46+
event_type: alert
47+
alert.signature_id: 7
48+
metadata.entropy.file_data_7: 4.137370175000773
49+
- filter:
50+
count: 0
51+
match:
52+
event_type: alert
53+
alert.signature_id: 8
54+
- filter:
55+
count: 1
56+
match:
57+
event_type: alert
58+
alert.signature_id: 10
59+
metadata.entropy.file_data_10: 4.150007324019584
60+
- filter:
61+
count: 1
62+
match:
63+
event_type: flow
64+
src_ip: 10.92.95.2
65+
dest_ip: 10.92.67.138
66+
flow.pkts_toserver: 5
67+
flow.pkts_toclient: 5
68+
metadata.entropy.file_data_1: 4.137370175000773
69+
metadata.entropy.file_data_2: 4.137370175000773
70+
metadata.entropy.file_data_3: 4.137370175000773
71+
metadata.entropy.file_data_4: 4.137370175000773
72+
metadata.entropy.file_data_5: 4.137370175000773
73+
metadata.entropy.file_data_6: 4.137370175000773
74+
metadata.entropy.file_data_7: 4.137370175000773
75+
metadata.entropy.file_data_8: 4.137370175000773
76+
metadata.entropy.file_data_10: 4.150007324019584

0 commit comments

Comments
 (0)