mirror of
https://github.com/cowrie/cowrie.git
synced 2025-07-01 18:07:27 -04:00
all interact stuff to LSP
This commit is contained in:
@ -36,7 +36,7 @@ class Interact(telnet.Telnet):
|
|||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
if self.interacting != None:
|
if self.interacting != None:
|
||||||
self.interacting.delInteractor(self)
|
self.interacting.terminal.delInteractor(self)
|
||||||
|
|
||||||
|
|
||||||
def enableRemote(self, option):
|
def enableRemote(self, option):
|
||||||
@ -78,7 +78,7 @@ class Interact(telnet.Telnet):
|
|||||||
else:
|
else:
|
||||||
for c in bytes:
|
for c in bytes:
|
||||||
if ord(c) == 27: # escape
|
if ord(c) == 27: # escape
|
||||||
self.interacting.delInteractor(self)
|
self.interacting.terminal.delInteractor(self)
|
||||||
self.interacting = None
|
self.interacting = None
|
||||||
self.transport.write(
|
self.transport.write(
|
||||||
'\r\n** Interactive session closed.\r\n')
|
'\r\n** Interactive session closed.\r\n')
|
||||||
@ -109,7 +109,7 @@ class Interact(telnet.Telnet):
|
|||||||
def sessionClosed(self):
|
def sessionClosed(self):
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
self.interacting.delInteractor(self)
|
self.interacting.terminal.delInteractor(self)
|
||||||
self.interacting = None
|
self.interacting = None
|
||||||
self.transport.write('\r\n** Interactive session disconnected.\r\n')
|
self.transport.write('\r\n** Interactive session disconnected.\r\n')
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ class Interact(telnet.Telnet):
|
|||||||
session = self.honeypotFactory.sessions[sessionno]
|
session = self.honeypotFactory.sessions[sessionno]
|
||||||
self.transport.write(
|
self.transport.write(
|
||||||
'** Attaching to #%d, hit ESC to return\r\n' % (sessionno,))
|
'** Attaching to #%d, hit ESC to return\r\n' % (sessionno,))
|
||||||
session.addInteractor(self)
|
session.terminal.addInteractor(self)
|
||||||
self.interacting = session
|
self.interacting = session
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -253,18 +253,6 @@ class HoneyPotInteractiveProtocol(HoneyPotBaseProtocol, recvline.HistoricRecvLin
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def addInteractor(self, interactor):
|
|
||||||
"""
|
|
||||||
"""
|
|
||||||
self.terminal.interactors.append(interactor)
|
|
||||||
|
|
||||||
|
|
||||||
def delInteractor(self, interactor):
|
|
||||||
"""
|
|
||||||
"""
|
|
||||||
self.terminal.interactors.remove(interactor)
|
|
||||||
|
|
||||||
|
|
||||||
def displayMOTD(self):
|
def displayMOTD(self):
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
@ -458,6 +446,18 @@ class LoggingServerProtocol(insults.ServerProtocol):
|
|||||||
self.terminalProtocol.eofReceived()
|
self.terminalProtocol.eofReceived()
|
||||||
|
|
||||||
|
|
||||||
|
def addInteractor(self, interactor):
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
self.interactors.append(interactor)
|
||||||
|
|
||||||
|
|
||||||
|
def delInteractor(self, interactor):
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
self.interactors.remove(interactor)
|
||||||
|
|
||||||
|
|
||||||
def loseConnection(self):
|
def loseConnection(self):
|
||||||
"""
|
"""
|
||||||
override super to remove the terminal reset on logout
|
override super to remove the terminal reset on logout
|
||||||
|
|||||||
Reference in New Issue
Block a user