mirror of https://github.com/cowrie/cowrie.git
rename 'handleLog' to 'write to be inline with twisted.
This commit is contained in:
parent
82a1f12937
commit
80e2e92169
|
@ -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':
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue