mirror of https://github.com/cowrie/cowrie.git
support multiple dblog targets of same type (by common)
git-svn-id: https://kippo.googlecode.com/svn/trunk@186 951d7100-d841-11de-b865-b3884708a8e2
This commit is contained in:
parent
1b24c69b44
commit
b607e8640c
|
@ -17,6 +17,8 @@ from kippo.core import ttylog, fs, utils
|
||||||
from kippo.core.config import config
|
from kippo.core.config import config
|
||||||
import commands
|
import commands
|
||||||
|
|
||||||
|
import ConfigParser
|
||||||
|
|
||||||
class HoneyPotCommand(object):
|
class HoneyPotCommand(object):
|
||||||
def __init__(self, honeypot, *args):
|
def __init__(self, honeypot, *args):
|
||||||
self.honeypot = honeypot
|
self.honeypot = honeypot
|
||||||
|
@ -384,12 +386,19 @@ class HoneyPotSSHFactory(factory.SSHFactory):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
cfg = config()
|
cfg = config()
|
||||||
for engine in [x[9:] for x in cfg.sections() \
|
for x in cfg.sections():
|
||||||
if x.startswith('database_')]:
|
if not x.startswith('database_'):
|
||||||
|
continue
|
||||||
|
engine = x.split('_')[1]
|
||||||
|
dbengine = 'database_' + engine
|
||||||
|
lcfg = ConfigParser.ConfigParser()
|
||||||
|
lcfg.add_section(dbengine)
|
||||||
|
for i in cfg.options(x):
|
||||||
|
lcfg.set(dbengine, i, cfg.get(x,i))
|
||||||
print 'Loading dblog engine: %s' % (engine,)
|
print 'Loading dblog engine: %s' % (engine,)
|
||||||
dblogger = __import__(
|
dblogger = __import__(
|
||||||
'kippo.dblog.%s' % (engine,),
|
'kippo.dblog.%s' % (engine,),
|
||||||
globals(), locals(), ['dblog']).DBLogger(cfg)
|
globals(), locals(), ['dblog']).DBLogger(lcfg)
|
||||||
log.startLoggingWithObserver(dblogger.emit, setStdout=False)
|
log.startLoggingWithObserver(dblogger.emit, setStdout=False)
|
||||||
|
|
||||||
def buildProtocol(self, addr):
|
def buildProtocol(self, addr):
|
||||||
|
|
Loading…
Reference in New Issue