summaryrefslogtreecommitdiffstats
path: root/framework/src/suricata/lua
diff options
context:
space:
mode:
authorAshlee Young <ashlee@onosfw.com>2015-09-09 22:21:41 -0700
committerAshlee Young <ashlee@onosfw.com>2015-09-09 22:21:41 -0700
commit8879b125d26e8db1a5633de5a9c692eb2d1c4f83 (patch)
treec7259d85a991b83dfa85ab2e339360669fc1f58e /framework/src/suricata/lua
parent13d05bc8458758ee39cb829098241e89616717ee (diff)
suricata checkin based on commit id a4bce14770beee46a537eda3c3f6e8e8565d5d0a
Change-Id: I9a214fa0ee95e58fc640e50bd604dac7f42db48f
Diffstat (limited to 'framework/src/suricata/lua')
-rw-r--r--framework/src/suricata/lua/fast.lua34
1 files changed, 34 insertions, 0 deletions
diff --git a/framework/src/suricata/lua/fast.lua b/framework/src/suricata/lua/fast.lua
new file mode 100644
index 00000000..731a3269
--- /dev/null
+++ b/framework/src/suricata/lua/fast.lua
@@ -0,0 +1,34 @@
+-- simple fast-log to stdout lua module
+
+function init (args)
+ local needs = {}
+ needs["type"] = "packet"
+ needs["filter"] = "alerts"
+ return needs
+end
+
+function setup (args)
+ alerts = 0
+end
+
+function log(args)
+ ts = SCPacketTimeString()
+ sid, rev, gid = SCRuleIds()
+ ipver, srcip, dstip, proto, sp, dp = SCPacketTuple()
+ msg = SCRuleMsg()
+ class, prio = SCRuleClass()
+ if class == nil then
+ class = "unknown"
+ end
+
+ print (ts .. " [**] [" .. gid .. ":" .. sid .. ":" .. rev .. "] " ..
+ msg .. " [**] [Classification: " .. class .. "] [Priority: " ..
+ prio .. "] {" .. proto .. "} " ..
+ srcip .. ":" .. sp .. " -> " .. dstip .. ":" .. dp)
+
+ alerts = alerts + 1;
+end
+
+function deinit (args)
+ print ("Alerted " .. alerts .. " times");
+end