Skip to content

Instantly share code, notes, and snippets.

@inliniac
Created February 24, 2016 10:53
Show Gist options
  • Save inliniac/db65597315a46450bcf6 to your computer and use it in GitHub Desktop.
Save inliniac/db65597315a46450bcf6 to your computer and use it in GitHub Desktop.
TLS-SNI Lua detection example
function init (args)
local needs = {}
needs["tls"] = tostring(true)
return needs
end
function match(args)
sni = TlsGetSNI();
if sni == nil then
return 0
end
str = string.format("SNI %s", sni);
SCLogInfo(str);
if sni == "www.google.com" then
return 1
end
return 0
end
alert tls any any -> any any (flow:to_server; lua:tls-sni.lua; sid:1;)
reject tls any any -> any any (flow:to_server; lua:tls-sni.lua; sid:2;)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment