Use string.decode("utf-8", error='backslashreplace') for ssh version (#1585)

This commit is contained in:
Jc2k
2021-06-18 16:06:07 +01:00
committed by GitHub
parent 5648b23ca1
commit 8b65560dde
2 changed files with 2 additions and 2 deletions

View File

@ -112,7 +112,7 @@ class HoneyPotSSHTransport(transport.SSHServerTransport, TimeoutMixin):
self.otherVersionString = self.buf.split(b"\n")[0].strip()
log.msg(
eventid="cowrie.client.version",
version=repr(self.otherVersionString),
version=self.otherVersionString.decode("utf-8", errors="backslashreplace"),
format="Remote SSH version: %(version)s",
)
m = re.match(br"SSH-(\d+.\d+)-(.*)", self.otherVersionString)

View File

@ -209,7 +209,7 @@ class FrontendSSHTransport(transport.SSHServerTransport, TimeoutMixin):
self.otherVersionString = self.buf.split(b"\n")[0].strip()
log.msg(
eventid="cowrie.client.version",
version=repr(self.otherVersionString),
version=self.otherVersionString.decode("utf-8", errors="backslashreplace"),
format="Remote SSH version: %(version)s",
)
m = re.match(br"SSH-(\d+.\d+)-(.*)", self.otherVersionString)