Last active
August 29, 2015 14:14
-
-
Save mpurzynski/25fcca68a93bac19fa53 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module DNSLongQuery; | |
export { | |
redef enum Notice::Type += { | |
DNS_LongQuery, | |
}; | |
const blacklist_dns_qtypes: set[string] = { "TSIG", "IXFR", "TXT", "NSEC", "AXFR", "TKEY", "SIG", "EDNS", "KEY", "DNSKEY", "SOA", "SPF", "RRSIG" }; | |
} | |
event dns_request(c: connection, msg: dns_msg, query: string, qtype: count, qclass: count) | |
{ | |
if ( DNS::query_types[qtype] in blacklist_dns_qtypes ) | |
return; | |
if ( |query| > 1024 ) { | |
NOTICE([$note=DNS_LongQuery, | |
$msg=fmt("%s received a long DNS query over 1024 bytes", c$id$resp_h), | |
$sub=query, | |
$uid=c$uid, | |
$id=c$id, | |
$identifier=cat(c$id$orig_h)]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment