display /etc/motd only on interactive shell

This commit is contained in:
Michel Oosterhof
2015-02-26 16:48:12 +00:00
parent b932936597
commit 8928cb10fa

View File

@@ -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):