mirror of
https://github.com/aljazceru/cowrie.git
synced 2026-02-23 15:24:30 +01:00
display /etc/motd only on interactive shell
This commit is contained in:
@@ -35,8 +35,6 @@ class HoneyPotBaseProtocol(insults.TerminalProtocol):
|
||||
transport.factory.logDispatch(*msg,**args)
|
||||
|
||||
def connectionMade(self):
|
||||
self.displayMOTD()
|
||||
|
||||
transport = self.terminal.transport.session.conn.transport
|
||||
|
||||
self.realClientIP = transport.transport.getPeer().host
|
||||
@@ -60,12 +58,6 @@ class HoneyPotBaseProtocol(insults.TerminalProtocol):
|
||||
self.kippoIP = s.getsockname()[0]
|
||||
s.close()
|
||||
|
||||
def displayMOTD(self):
|
||||
try:
|
||||
self.writeln(self.fs.file_contents('/etc/motd'))
|
||||
except:
|
||||
pass
|
||||
|
||||
# this is only called on explicit logout, not on disconnect
|
||||
def connectionLost(self, reason):
|
||||
log.msg( eventid='KIPP0011', format='Connection lost')
|
||||
@@ -155,6 +147,7 @@ class HoneyPotInteractiveProtocol(HoneyPotBaseProtocol, recvline.HistoricRecvLin
|
||||
HoneyPotBaseProtocol.__init__(self, avatar, env)
|
||||
|
||||
def connectionMade(self):
|
||||
self.displayMOTD()
|
||||
HoneyPotBaseProtocol.connectionMade(self)
|
||||
recvline.HistoricRecvLine.connectionMade(self)
|
||||
|
||||
@@ -177,6 +170,12 @@ class HoneyPotInteractiveProtocol(HoneyPotBaseProtocol, recvline.HistoricRecvLin
|
||||
'\x15': self.handle_CTRL_U, # CTRL-U
|
||||
})
|
||||
|
||||
def displayMOTD(self):
|
||||
try:
|
||||
self.writeln(self.fs.file_contents('/etc/motd'))
|
||||
except:
|
||||
pass
|
||||
|
||||
# this doesn't seem to be called upon disconnect, so please use
|
||||
# HoneyPotTransport.connectionLost instead
|
||||
def connectionLost(self, reason):
|
||||
|
||||
Reference in New Issue
Block a user