From 8b7fe09f8a27403d3ee7b2a8aa43c997252d808c Mon Sep 17 00:00:00 2001 From: Michel Oosterhof Date: Sat, 15 Oct 2016 15:07:51 +0000 Subject: [PATCH] Workaround for #287 --- cowrie/commands/base.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cowrie/commands/base.py b/cowrie/commands/base.py index c4b6d85..8f7fb42 100644 --- a/cowrie/commands/base.py +++ b/cowrie/commands/base.py @@ -4,6 +4,7 @@ import time import datetime import functools +import exceptions import getopt from twisted.python import failure, log @@ -136,7 +137,12 @@ class command_echo(HoneyPotCommand): except: args = self.args - self.write(escape_fn(' '.join(args))) + # FIXME: Wrap in exception, Python escape cannot handle single digit \x codes (e.g. \x1) + try: + self.write(escape_fn(' '.join(args))) + except exceptions.ValueError as e: + log.msg("echo command received Python incorrect hex escape") + if newline is True: self.write('\n')