mirror of https://github.com/cowrie/cowrie.git
Commands should be decoded as utf8 (#1477)
Co-authored-by: Michel Oosterhof <micheloosterhof@users.noreply.github.com>
This commit is contained in:
parent
a79d6bc0ca
commit
dddde1850a
|
@ -40,11 +40,13 @@ class ExecTerm(base_protocol.BaseProtocol):
|
|||
def __init__(self, uuid, channelName, ssh, channelId, command):
|
||||
super().__init__(uuid, channelName, ssh)
|
||||
|
||||
log.msg(
|
||||
eventid="cowrie.command.input",
|
||||
input=command.decode("ascii"),
|
||||
format="CMD: %(input)s",
|
||||
)
|
||||
try:
|
||||
log.msg(eventid='cowrie.command.input',
|
||||
input=command.decode('utf8'),
|
||||
format='CMD: %(input)s')
|
||||
except UnicodeDecodeError:
|
||||
log.err("Unusual execcmd: {}".format(repr(command)))
|
||||
|
||||
|
||||
self.transportId = ssh.server.transportId
|
||||
self.channelId = channelId
|
||||
|
|
|
@ -115,14 +115,16 @@ class Term(base_protocol.BaseProtocol):
|
|||
self.command += b"^C"
|
||||
|
||||
self.data = self.data[1:]
|
||||
if self.command != b"":
|
||||
log.msg(
|
||||
eventid="cowrie.command.input",
|
||||
input=self.command.decode("ascii"),
|
||||
format="CMD: %(input)s",
|
||||
)
|
||||
|
||||
try:
|
||||
if self.command != b'':
|
||||
log.msg(eventid='cowrie.command.input',
|
||||
input=self.command.decode('utf8'),
|
||||
format='CMD: %(input)s')
|
||||
except UnicodeDecodeError:
|
||||
log.err("Unusual execcmd: {}".format(repr(self.command)))
|
||||
|
||||
self.command = b""
|
||||
self.command = b''
|
||||
self.pointer = 0
|
||||
# If Home Pressed
|
||||
elif self.data[:3] == b"\x1b\x4f\x48":
|
||||
|
|
Loading…
Reference in New Issue