From b3ba376fc4d1a24581c3ac929d8170074b8d7943 Mon Sep 17 00:00:00 2001 From: Eric Leblond Date: Mon, 31 Mar 2025 11:14:10 +0200 Subject: [PATCH] tests: add tx_cnt tests --- tests/flow-tx-cnt/README.md | 7 +++++++ tests/flow-tx-cnt/test.rules | 2 ++ tests/flow-tx-cnt/test.yaml | 22 ++++++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 tests/flow-tx-cnt/README.md create mode 100644 tests/flow-tx-cnt/test.rules create mode 100644 tests/flow-tx-cnt/test.yaml diff --git a/tests/flow-tx-cnt/README.md b/tests/flow-tx-cnt/README.md new file mode 100644 index 000000000..d3fae0c08 --- /dev/null +++ b/tests/flow-tx-cnt/README.md @@ -0,0 +1,7 @@ +# Description + +Check presence and value of tx_id and tx_cnt in events. + +# PCAP + +The pcap contains smb traffic with a smb share to match on diff --git a/tests/flow-tx-cnt/test.rules b/tests/flow-tx-cnt/test.rules new file mode 100644 index 000000000..de762d478 --- /dev/null +++ b/tests/flow-tx-cnt/test.rules @@ -0,0 +1,2 @@ +alert ssh $HOME_NET any -> any any (msg:"pcre without content and no match"; pcre:"/rabbit/"; sid:1; rev:1;) +alert smb $HOME_NET any -> any any (msg:"smb share content with match"; smb.share; content:"C"; sid:2; rev:1;) diff --git a/tests/flow-tx-cnt/test.yaml b/tests/flow-tx-cnt/test.yaml new file mode 100644 index 000000000..d89aacce4 --- /dev/null +++ b/tests/flow-tx-cnt/test.yaml @@ -0,0 +1,22 @@ +requires: + min-version: 8 + +pcap: ../smb-filename/input.pcap + +checks: + - filter: + count: 29 + match: + event_type: flow + - filter: + count: 1 + match: + event_type: flow + src_port: 49455 + flow.tx_cnt: 22 + - filter: + count: 1 + match: + event_type: flow + src_port: 49452 + flow.tx_cnt: 43 -- 2.47.2