This commit is contained in:
Michel Oosterhof
2015-11-06 19:35:07 +00:00
parent 8877497a97
commit 99c93e8f08
4 changed files with 17 additions and 14 deletions

View File

@@ -120,7 +120,9 @@ commands['/bin/echo'] = command_echo
class command_exit(HoneyPotCommand):
def call(self):
self.protocol.terminal.loseConnection()
#self.protocol.terminal.transport.session.sendEOF()
#self.protocol.terminal.transport.session.sendClose()
self.protocol.terminal.transport.session.loseConnection()
return
def exit(self):
pass

View File

@@ -36,6 +36,10 @@ class FileNotFound(Exception):
pass
class HoneyPotFilesystem(object):
# def __del__(self):
# print "FS GONE!"
def __init__(self, fs, cfg):
self.fs = fs
self.cfg = cfg

View File

@@ -17,6 +17,9 @@ from . import utils
class HoneyPotBaseProtocol(insults.TerminalProtocol, TimeoutMixin):
def __del__(self):
print "PROTOCOL GONE"
def __init__(self, avatar):
self.user = avatar
self.cfg = self.user.cfg
@@ -167,6 +170,7 @@ class HoneyPotInteractiveProtocol(HoneyPotBaseProtocol, recvline.HistoricRecvLin
def connectionMade(self):
self.displayMOTD()
HoneyPotBaseProtocol.connectionMade(self)
recvline.HistoricRecvLine.connectionMade(self)

View File

@@ -460,29 +460,22 @@ class SSHSessionForCowrieUser:
def openShell(self, proto):
serverProtocol = protocol.LoggingServerProtocol(
self.protocol = protocol.LoggingServerProtocol(
protocol.HoneyPotInteractiveProtocol, self)
self.protocol = serverProtocol
serverProtocol.makeConnection(proto)
proto.makeConnection(session.wrapProtocol(serverProtocol))
#self.protocol = serverProtocol
self.protocol = proto
self.protocol.makeConnection(proto)
proto.makeConnection(session.wrapProtocol(self.protocol))
def getPty(self, terminal, windowSize, attrs):
#log.msg('Terminal size: %s %s' % windowSize[0:2])
log.msg(eventid='KIPP0010', width=windowSize[0], height=windowSize[1],
format='Terminal Size: %(width)s %(height)s')
self.windowSize = windowSize
return None
def execCommand(self, proto, cmd):
serverProtocol = protocol.LoggingServerProtocol(
self.protocol = protocol.LoggingServerProtocol(
protocol.HoneyPotExecProtocol, self, cmd)
self.protocol = serverProtocol
serverProtocol.makeConnection(proto)
proto.makeConnection(session.wrapProtocol(serverProtocol))
self.protocol = serverProtocol
self.protocol.makeConnection(proto)
proto.makeConnection(session.wrapProtocol(self.protocol))
# this is reliably called on both logout and disconnect
# we notify the protocol here we lost the connection