From f01dfb54c94b0edb412b9c37108253e89b4de26f Mon Sep 17 00:00:00 2001 From: Muzahid Date: Tue, 22 Jun 2021 18:23:55 +0530 Subject: [PATCH] fix protocol issue --- src/protocol.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/protocol.py b/src/protocol.py index 6b0e1265..cd6ef994 100644 --- a/src/protocol.py +++ b/src/protocol.py @@ -225,7 +225,7 @@ def checkIPv6Address(host, hostStandardFormat, private=False): Returns hostStandardFormat if it is an IPv6 address, otherwise returns False """ - if host == ('\x00' * 15) + '\x01': + if host == (b'\x00' * 15) + b'\x01': if not private: logger.debug('Ignoring loopback address: %s', hostStandardFormat) return False @@ -233,11 +233,19 @@ def checkIPv6Address(host, hostStandardFormat, private=False): if not private: logger.debug('Ignoring local address: %s', hostStandardFormat) return hostStandardFormat if private else False - if (ord(host.decode()[0]) & 0xfe) == 0xfc: - if not private: - logger.debug( - 'Ignoring unique local address: %s', hostStandardFormat) - return hostStandardFormat if private else False + try: + if (ord(host[0]) & 0xfe) == 0xfc: + if not private: + logger.debug( + 'Ignoring unique local address: %s', hostStandardFormat) + return hostStandardFormat if private else False + except TypeError: + if (ord(host.decode()[0]) & 0xfe) == 0xfc: + if not private: + logger.debug( + 'Ignoring unique local address: %s', hostStandardFormat) + return hostStandardFormat if private else False + return False if private else hostStandardFormat