From 0fda46b933c75641caaeb94c3a6d9fbbc1245eb8 Mon Sep 17 00:00:00 2001 From: fe7ch Date: Sun, 11 Dec 2016 13:53:44 +0300 Subject: [PATCH] Remove redundant space, handle double slashes in escape string (#340) --- cowrie/commands/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cowrie/commands/base.py b/cowrie/commands/base.py index dfdc111..2a711da 100644 --- a/cowrie/commands/base.py +++ b/cowrie/commands/base.py @@ -140,7 +140,7 @@ class command_echo(HoneyPotCommand): # FIXME: Wrap in exception, Python escape cannot handle single digit \x codes (e.g. \x1) try: self.write(escape_fn(re.sub('(?<=\\\\)x([0-9a-fA-F]{1})(?=\\\\|\"|\'|\s|$)', 'x0\g<1>', - ' '.join(args))).strip('\"\'')) + ''.join(args).replace('\\\\x', '\\x'))).strip('\"\'')) except ValueError as e: log.msg("echo command received Python incorrect hex escape")