From 80e2e9216953e2ebd450ed44c9a76be4a7990892 Mon Sep 17 00:00:00 2001 From: Michel Oosterhof Date: Sun, 12 Apr 2015 05:22:31 +0000 Subject: [PATCH] rename 'handleLog' to 'write to be inline with twisted. --- kippo/core/output.py | 8 +++++--- kippo/output/jsonlog.py | 9 +-------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/kippo/core/output.py b/kippo/core/output.py index 3218be3c..e3e88a44 100644 --- a/kippo/core/output.py +++ b/kippo/core/output.py @@ -49,7 +49,7 @@ import uuid class Output(object): """ This is the abstract base class intended to be inherited by kippo output plugins - Plugins require the mandatory methods: stop, start and handleLog + Plugins require the mandatory methods: stop, start and write """ __metaclass__ = abc.ABCMeta @@ -91,7 +91,7 @@ class Output(object): pass @abc.abstractmethod - def handleLog(self, session, event): + def write(self, event): """Handle a general event within the output plugin""" pass @@ -147,7 +147,9 @@ class Output(object): self.ips[sessionno] = ev['src_ip'] del ev['system'] - self.handleLog(self.sessions[sessionno], ev) + ev['session'] = self.sessions[sessionno] + + self.write(ev) # disconnect is special, remove cached data if ev['eventid'] == 'KIPP0011': diff --git a/kippo/output/jsonlog.py b/kippo/output/jsonlog.py index 534126e8..685f6ab4 100644 --- a/kippo/output/jsonlog.py +++ b/kippo/output/jsonlog.py @@ -39,16 +39,9 @@ class Output(kippo.core.output.Output): def stop(self): pass - def write(self, session, logentry): - _meta = { - 'session' : session, - } - logentry.update( _meta ) + def write(self, logentry): json.dump( logentry, self.outfile ) self.outfile.write( '\n' ) self.outfile.flush() - def handleLog( self, session, event ): - self.write( session, event ) - # vim: set sw=4 et: