From: Jason Ish Date: Wed, 15 Nov 2023 17:21:12 +0000 (-0600) Subject: test: new test for dns.answer.name X-Git-Tag: suricata-6.0.16~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1780a85acc4ad5cb67b7463632bd1303f51287e9;p=thirdparty%2Fsuricata-verify.git test: new test for dns.answer.name --- diff --git a/tests/dns/dns-answer-name/README.md b/tests/dns/dns-answer-name/README.md new file mode 100644 index 000000000..bf5513fec --- /dev/null +++ b/tests/dns/dns-answer-name/README.md @@ -0,0 +1,5 @@ +Test the `dns.answer.name` sticky buffer. + +The PCAP here was a request created with Scapy to include answers in +the request. However the response is from a real DNS server with the +provided request. diff --git a/tests/dns/dns-answer-name/dns-udp-request-with-answer.pcap b/tests/dns/dns-answer-name/dns-udp-request-with-answer.pcap new file mode 100644 index 000000000..102e5aa6f Binary files /dev/null and b/tests/dns/dns-answer-name/dns-udp-request-with-answer.pcap differ diff --git a/tests/dns/dns-answer-name/test.rules b/tests/dns/dns-answer-name/test.rules new file mode 100644 index 000000000..0544ae163 --- /dev/null +++ b/tests/dns/dns-answer-name/test.rules @@ -0,0 +1,8 @@ +# Should alert in both directions as no flow is provided. +alert dns any any -> any any (dns.answer.name; content:"oisf"; sid:1; rev:1;) + +# Should only alert in the request direction. +alert dns any any -> any any (dns.answer.name; content:"oisf"; flow:to_server; sid:2; rev:1;) + +# Should only alert in the response direction. +alert dns any any -> any any (dns.answer.name; content:"oisf"; flow:to_client; sid:3; rev:1;) diff --git a/tests/dns/dns-answer-name/test.yaml b/tests/dns/dns-answer-name/test.yaml new file mode 100644 index 000000000..4bc24a91e --- /dev/null +++ b/tests/dns/dns-answer-name/test.yaml @@ -0,0 +1,43 @@ +requires: + min-version: 8 + +checks: + - filter: + count: 2 + match: + alert.signature_id: 1 + app_proto: dns + - filter: + count: 1 + match: + alert.signature_id: 1 + direction: to_client + app_proto: dns + - filter: + count: 1 + match: + alert.signature_id: 1 + direction: to_server + app_proto: dns + + - filter: + count: 1 + match: + alert.signature_id: 2 + - filter: + count: 1 + match: + alert.signature_id: 2 + direction: to_server + app_proto: dns + + - filter: + count: 1 + match: + alert.signature_id: 3 + - filter: + count: 1 + match: + alert.signature_id: 3 + direction: to_client + app_proto: dns