Created
July 12, 2016 15:58
-
-
Save inliniac/083dd01b3c4ce91180448b45d7d6e35d to your computer and use it in GitHub Desktop.
QA smtp lua script
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