Created
September 29, 2015 11:21
-
-
Save albertzaharovits/cc0e5b72d26c984433d9 to your computer and use it in GitHub Desktop.
Bro extract SMTP data (eml), cache in Redis
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
@load base/protocols/conn | |
@load base/protocols/smtp | |
event mime_all_data(c: connection, length: count, data: string) | |
{ | |
local conn_key: string; | |
local cmd: string; | |
if ( ! c?$smtp ) | |
return; | |
conn_key = cat(c$smtp$uid, "_", c$smtp$trans_depth); | |
cmd = "/usr/bin/redis-cli -n 2 "; | |
cmd = cat(cmd, "SETEX '", conn_key, "' 259200 '", encode_base64(data), "'"); | |
when ( local res = Exec::run([$cmd=cmd])) {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment