This commit is contained in:
Michel Oosterhof
2018-07-11 12:30:33 +04:00
parent 6513ab966c
commit e96b0dd969
2 changed files with 11 additions and 3 deletions

View File

@ -69,14 +69,15 @@ class command_cat(HoneyPotCommand):
"""
This is the cat output, with optional line numbering
"""
lines = input.decode('utf8').split('\n')
if lines[-1] == "":
log.msg("input = "+str(type(input)))
lines = input.split(b'\n')
if lines[-1] == b"":
lines.pop()
for line in lines:
if self.number:
self.write("{:>6} ".format(self.linenumber))
self.linenumber = self.linenumber + 1
self.write("{0}\n".format(line))
self.writeBytes(line+b'\n')
def lineReceived(self, line):

View File

@ -82,7 +82,14 @@ class HoneyPotCommand(object):
"""
"""
return self.writefn(data.encode('utf8'))
def writeBytes(self, data):
"""
Like write() but input is bytes
"""
return self.writefn(data)
def errorWrite(self, data):
"""