Created
July 12, 2016 15:46
-
-
Save inliniac/3097a919ffc5a67d4d7d6f2bee48b6b2 to your computer and use it in GitHub Desktop.
Simple lua output script I use in QA
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
function init (args) | |
local needs = {} | |
needs["protocol"] = "smtp" | |
return needs | |
end | |
function setup (args) | |
smtp = 0 | |
filename = SCLogPath() .. "/smtp-lua.log" | |
SCLogInfo(filename); | |
end | |
function log(args) | |
ts = SCPacketTimeString() | |
ipver, srcip, dstip, proto, sp, dp = SCFlowTuple() | |
file = assert(io.open(filename, "w")) | |
local a = SMTPGetMailFrom() | |
if (a) then | |
print(a) | |
end | |
local b = SMTPGetMimeField("x-mailer") | |
if(b) then | |
print(b) | |
end | |
local c = {} | |
c = SMTPGetRcptList() | |
for i, v in pairs(c) do | |
print(i, v) | |
end | |
local d = { } | |
d = SMTPGetMimeList() | |
for i, v in pairs(d) do | |
local e = SMTPGetMimeField(v) | |
print(i, v, e) | |
end | |
file:write ("SMTP::" .. a .. "::" .. b .. "::SMTP") | |
file:write("\n") | |
file:flush() | |
file.close(file) | |
smtp = smtp + 1 | |
end | |
function deinit (args) | |
print ("SMTP transactions logged: " .. smtp); | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment