mirror of
https://github.com/jtesta/ssh-audit.git
synced 2025-06-23 02:54:33 +02:00
Handle the case when received data is in wrong encoding (not utf-8).
This commit is contained in:
@ -1657,7 +1657,10 @@ def audit(conf, sshv=None):
|
||||
if err is None:
|
||||
packet_type, payload = s.read_packet(sshv)
|
||||
if packet_type < 0:
|
||||
payload = payload.decode('utf-8') if payload else u'empty'
|
||||
try:
|
||||
payload = payload.decode('utf-8') if payload else u'empty'
|
||||
except UnicodeDecodeError:
|
||||
payload = u'"{0}"'.format(repr(payload).lstrip('b')[1:-1])
|
||||
if payload == u'Protocol major versions differ.':
|
||||
if sshv == 2 and conf.ssh1:
|
||||
audit(conf, 1)
|
||||
|
Reference in New Issue
Block a user