mirror of
https://github.com/aljazceru/cowrie.git
synced 2025-12-19 06:54:19 +01:00
Add support for multiple long engines.
NOTE: .cfg changed! git-svn-id: https://kippo.googlecode.com/svn/trunk@173 951d7100-d841-11de-b865-b3884708a8e2
This commit is contained in:
@@ -14,8 +14,7 @@ password = 123456
|
||||
;out_addr = 0.0.0.0
|
||||
;sensor_name=myhostname
|
||||
|
||||
;[database]
|
||||
;engine = mysql
|
||||
;[database_mysql]
|
||||
;host = localhost
|
||||
;database = kippo
|
||||
;username = kippo
|
||||
|
||||
@@ -366,12 +366,13 @@ class HoneyPotSSHFactory(factory.SSHFactory):
|
||||
|
||||
def __init__(self):
|
||||
cfg = config()
|
||||
if cfg.has_option('database', 'engine'):
|
||||
engine = cfg.get('database', 'engine')
|
||||
self.dblogger = __import__(
|
||||
for engine in [x[9:] for x in cfg.sections() \
|
||||
if x.startswith('database_')]:
|
||||
print 'Loading dblog engine: %s' % (engine,)
|
||||
dblogger = __import__(
|
||||
'kippo.dblog.%s' % (engine,),
|
||||
globals(), locals(), ['dblog']).DBLogger(cfg)
|
||||
log.startLoggingWithObserver(self.dblogger.emit, setStdout=False)
|
||||
log.startLoggingWithObserver(dblogger.emit, setStdout=False)
|
||||
|
||||
def buildProtocol(self, addr):
|
||||
# FIXME: try to mimic something real 100%
|
||||
|
||||
@@ -33,10 +33,10 @@ class ReconnectingConnectionPool(adbapi.ConnectionPool):
|
||||
class DBLogger(dblog.DBLogger):
|
||||
def start(self, cfg):
|
||||
self.db = ReconnectingConnectionPool('MySQLdb',
|
||||
host = cfg.get('database', 'host'),
|
||||
db = cfg.get('database', 'database'),
|
||||
user = cfg.get('database', 'username'),
|
||||
passwd = cfg.get('database', 'password'),
|
||||
host = cfg.get('database_mysql', 'host'),
|
||||
db = cfg.get('database_mysql', 'database'),
|
||||
user = cfg.get('database_mysql', 'username'),
|
||||
passwd = cfg.get('database_mysql', 'password'),
|
||||
cp_min = 1,
|
||||
cp_max = 1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user