From 3287df096c3f2bde322d08b38dc4e66221841324 Mon Sep 17 00:00:00 2001 From: Jeff Lucovsky Date: Mon, 13 Jan 2025 08:49:50 -0500 Subject: [PATCH] test/entropy: Basic entropy keyword test This commit adds a basic test of the entropy keyword. --- tests/entropy/entropy-01/README.md | 1 + tests/entropy/entropy-01/input.pcap | Bin 0 -> 1397 bytes tests/entropy/entropy-01/test.rules | 12 +++++++ tests/entropy/entropy-01/test.yaml | 49 ++++++++++++++++++++++++++++ 4 files changed, 62 insertions(+) create mode 100644 tests/entropy/entropy-01/README.md create mode 100644 tests/entropy/entropy-01/input.pcap create mode 100644 tests/entropy/entropy-01/test.rules create mode 100644 tests/entropy/entropy-01/test.yaml diff --git a/tests/entropy/entropy-01/README.md b/tests/entropy/entropy-01/README.md new file mode 100644 index 000000000..c1924f917 --- /dev/null +++ b/tests/entropy/entropy-01/README.md @@ -0,0 +1 @@ +This test checks the entropy keyword with a comparison against HTTP file data. diff --git a/tests/entropy/entropy-01/input.pcap b/tests/entropy/entropy-01/input.pcap new file mode 100644 index 0000000000000000000000000000000000000000..c84b2df7002156fe463a8b3f2d3cfa87a414bbab GIT binary patch literal 1397 zc-noG%TF6e9LHx30kX@U9;**w_x(yzygeF99k9TGnHG zBJC~WjzW?{)kbb}qltP!l~8l!R#jEno~o9%5;-LK14?JsSOv>sHLIEV?dUVV@9(ic zz5ezK8)yfO=kyc+hRki(PEzp@3qoW~UvTaAXXw~=xKj%Zc7bsK+{~XNV7p`VDZ8{{ zW0%5@4zB|7fP3(c9^SS=u#W+-wO@I~w6%3HOuLN|e>q32v+CSB5r7de(((B=rBNyn z53kzszbAzHe*1>ED+kVqghr@sl;{n!z)$S{RzCJJ$Ci(^CLiAu>RYj!0e}45&`nuC z64nnyJbjy4%q!+E${P8&C98)4`!4~Q9G4)Usp=|!&lDtlKafL(bOsxUJD3zZ~qggF~MGZPG>ooy#T1j>(u9CW>l5bPmE9Str*zUC`<9Ib1%604JkT zBS7A-S+GN7?X;4%wfn@9ws%q5=|fA}N1e5s&q?FaJA)kS&muX6ia|eCv4(@5IMeTq&CPrg*43|TmEeCw=@K)Z>4W8ZSB9U)_#7m9kos3-y5+Toc_LY rzO{odE@k~=vA$}_x=vWj=UK}yE-R|DpV&@Q%-#^*7A>k@zXRYudZ&`u literal 0 Hc-jL100001 diff --git a/tests/entropy/entropy-01/test.rules b/tests/entropy/entropy-01/test.rules new file mode 100644 index 000000000..308d9ca51 --- /dev/null +++ b/tests/entropy/entropy-01/test.rules @@ -0,0 +1,12 @@ +# The entropy value is 4.137370175000773 +alert http any any -> any any (msg:"entropy simple test"; file.data; entropy: value > 4; sid:1;) +alert http any any -> any any (msg:"entropy simple test"; file.data; entropy: value >= 4; sid:2;) +alert http any any -> any any (msg:"entropy simple test"; file.data; entropy: value >= 5; sid:3;) +alert http any any -> any any (msg:"entropy simple test"; file.data; entropy: value 4-5; sid:4;) +alert http any any -> any any (msg:"entropy simple test"; file.data; entropy: value !4-5; sid:5;) +alert http any any -> any any (msg:"entropy simple test"; file.data; entropy: value < 4; sid:6;) +alert http any any -> any any (msg:"entropy simple test"; file.data; entropy: value != 4; sid:7;) +alert http any any -> any any (msg:"entropy simple test"; file.data; entropy: value = 4; sid:8;) +# The entropy value is 4.150007324019584 +alert http any any -> any any (msg:"entropy simple test"; file.data; entropy: offset 10, value > 4.14; sid:10;) + diff --git a/tests/entropy/entropy-01/test.yaml b/tests/entropy/entropy-01/test.yaml new file mode 100644 index 000000000..5fcc51ca5 --- /dev/null +++ b/tests/entropy/entropy-01/test.yaml @@ -0,0 +1,49 @@ +requires: + min-version: 8 + +checks: + - filter: + count: 1 + match: + event_type: alert + alert.signature_id: 1 + - filter: + count: 1 + match: + event_type: alert + alert.signature_id: 2 + - filter: + count: 0 + match: + event_type: alert + alert.signature_id: 3 + - filter: + count: 1 + match: + event_type: alert + alert.signature_id: 4 + - filter: + count: 0 + match: + event_type: alert + alert.signature_id: 5 + - filter: + count: 0 + match: + event_type: alert + alert.signature_id: 6 + - filter: + count: 1 + match: + event_type: alert + alert.signature_id: 7 + - filter: + count: 0 + match: + event_type: alert + alert.signature_id: 8 + - filter: + count: 1 + match: + event_type: alert + alert.signature_id: 10 -- 2.47.2