Skip to content

Instantly share code, notes, and snippets.

@rsatrio
Last active May 8, 2023 12:12
Show Gist options
  • Save rsatrio/c53408a0af221ab2da57bddebbe01ffe to your computer and use it in GitHub Desktop.
Save rsatrio/c53408a0af221ab2da57bddebbe01ffe to your computer and use it in GitHub Desktop.
Zeek Script Example
module DDosAttacks;
@load base / protocols / dns
redef enum Notice::Type += {
DNSDDoSAmplification
};
function generate_ddos_notice(c: connection, query: string) {
local query1: string = strip(query);
if (query1 == "peacecorps.gov" || query1 == "pizzaseo.com") {
NOTICE([$note = DNSDDoSAmplification,
$msg = fmt("Possible DNS DDoS Amplification Attack"),
$conn = c,
$uid = c$uid
]);
}
}
event dns_request(c: connection, msg: dns_msg, query: string, qtype: count, qclass: count, original_query: string) {
generate_ddos_notice(c, query);
}
event dns_query_reply(c: connection, msg: dns_msg, query: string, qtype: count, qclass: count, original_query: string) {
generate_ddos_notice(c, query);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment