mirror of
https://github.com/aljazceru/cowrie.git
synced 2026-02-01 04:24:32 +01:00
remove dblog/texlog.
This commit is contained in:
@@ -1,56 +0,0 @@
|
||||
#
|
||||
# this module uses the dblog feature to create a "traditional" looking logfile
|
||||
# ..so not exactly a dblog.
|
||||
#
|
||||
|
||||
from cowrie.core import dblog
|
||||
import time
|
||||
import uuid
|
||||
|
||||
class DBLogger(dblog.DBLogger):
|
||||
def start(self, cfg):
|
||||
self.outfile = file(cfg.get('database_textlog', 'logfile'), 'a')
|
||||
|
||||
def write(self, session, msg):
|
||||
self.outfile.write('%s [%s]: %s\r\n' % \
|
||||
(session, time.strftime('%Y-%m-%d %H:%M:%S'), msg))
|
||||
self.outfile.flush()
|
||||
|
||||
def createSession(self, peerIP, peerPort, hostIP, hostPort):
|
||||
sid = uuid.uuid4().hex
|
||||
sensorname = self.getSensor() or hostIP
|
||||
self.write(sid, 'New connection: %s:%s' % (peerIP, peerPort))
|
||||
return sid
|
||||
|
||||
def handleConnectionLost(self, session, args):
|
||||
self.write(session, 'Connection lost')
|
||||
|
||||
def handleLoginFailed(self, session, args):
|
||||
self.write(session, 'Login failed [%s/%s]' % \
|
||||
(args['username'], args['password']))
|
||||
|
||||
def handleLoginSucceeded(self, session, args):
|
||||
self.write(session, 'Login succeeded [%s/%s]' % \
|
||||
(args['username'], args['password']))
|
||||
|
||||
def handleCommand(self, session, args):
|
||||
self.write(session, 'Command [%s]' % (args['input'],))
|
||||
|
||||
def handleUnknownCommand(self, session, args):
|
||||
self.write(session, 'Unknown command [%s]' % (args['input'],))
|
||||
|
||||
def handleInput(self, session, args):
|
||||
self.write(session, 'Input [%s] @%s' % (args['input'], args['realm']))
|
||||
|
||||
def handleTerminalSize(self, session, args):
|
||||
self.write(session, 'Terminal size: %sx%s' % \
|
||||
(args['width'], args['height']))
|
||||
|
||||
def handleClientVersion(self, session, args):
|
||||
self.write(session, 'Client version: [%s]' % (args['version'],))
|
||||
|
||||
def handleFileDownload(self, session, args):
|
||||
self.write(session, 'File download: [%s] -> %s with SHA-256 %s' % \
|
||||
(args['url'], args['outfile'], args['shasum']))
|
||||
|
||||
# vim: set sw=4 et:
|
||||
@@ -3,7 +3,6 @@ import cowrie.core.output
|
||||
from csirtgsdk.indicator import Indicator
|
||||
from csirtgsdk.client import Client
|
||||
from datetime import datetime
|
||||
from pprint import pprint
|
||||
import logging
|
||||
import os
|
||||
|
||||
@@ -61,5 +60,6 @@ class Output(cowrie.core.output.Output):
|
||||
|
||||
logger.info('logged to csirtg %s ' % ret['indicator']['location'])
|
||||
else:
|
||||
pprint(self.context)
|
||||
pass
|
||||
|
||||
self.context[today][peerIP].append(sid)
|
||||
|
||||
Reference in New Issue
Block a user