From 3ca7cc1da5cde6202360fa8f8f9becb40eb18307 Mon Sep 17 00:00:00 2001 From: Michel Oosterhof Date: Sun, 16 Jul 2017 19:43:10 +0400 Subject: [PATCH] python 3 compat test --- cowrie/core/honeypot.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cowrie/core/honeypot.py b/cowrie/core/honeypot.py index 6ac90ff6..456e99d8 100644 --- a/cowrie/core/honeypot.py +++ b/cowrie/core/honeypot.py @@ -141,7 +141,8 @@ class HoneyPotCommand(object): """ log.msg('QUEUED INPUT: {}'.format(line)) # FIXME: naive command parsing, see lineReceived below - line=line.decode() + if (isinstance(line, str)): + line = line.decode() self.protocol.cmdstack[0].cmdpending.append(shlex.split(line)) @@ -185,7 +186,8 @@ class HoneyPotShell(object): """ """ log.msg(eventid='cowrie.command.input', input=line, format='CMD: %(input)s') - line=line.decode() + if (isinstance(line, str)): + line = line.decode() self.lexer = shlex.shlex(instream=line, punctuation_chars=True) tokens = [] while True: