diff --git a/cowrie/commands/base.py b/cowrie/commands/base.py index b2f4b15..9b54b3a 100644 --- a/cowrie/commands/base.py +++ b/cowrie/commands/base.py @@ -138,15 +138,23 @@ class command_echo(HoneyPotCommand): """ write_fn = self.writeln escape_fn = lambda s: s - optlist, args = getopt.getopt(self.args, "eEn") + """ + """ - for opt in optlist: - if opt[0] == '-e': - escape_fn = functools.partial(str.decode, encoding="string_escape") - elif opt[0] == '-E': - escape_fn = lambda s: s - elif opt[0] == '-n': - write_fn = self.write + try: + write_fn = self.writeln + optlist, args = getopt.getopt(self.args, "eEn") + + for opt in optlist: + if opt[0] == '-e': + escape_fn = functools.partial(str.decode, encoding="string_escape") + elif opt[0] == '-E': + escape_fn = lambda s: s + elif opt[0] == '-n': + write_fn = self.write + except: + write_fn = self.writeln + args = self.args write_fn(escape_fn(' '.join(args)))