mirror of
https://github.com/aljazceru/cowrie.git
synced 2026-01-28 10:34:31 +01:00
wip
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user