Fixed mysql finger printer py3 bugs

This commit is contained in:
VakarisZ 2019-11-05 12:37:51 +02:00
parent 1f5acbc287
commit fc063a5378
2 changed files with 3 additions and 3 deletions

View File

@ -50,7 +50,7 @@ class MySQLFinger(HostFinger):
return False
version, curpos = struct_unpack_tracker_string(data, curpos) # special coded to solve string parsing
version = version[0]
version = version[0].decode()
self.init_service(host.services, SQL_SERVICE, MYSQL_PORT)
host.services[SQL_SERVICE]['version'] = version
version = version.split('-')[0].split('.')

View File

@ -40,7 +40,7 @@ def struct_unpack_tracker_string(data, index):
:param index: Position index
:return: (Data, new index)
"""
ascii_len = data[index:].find('\0')
ascii_len = data[index:].find(b'\0')
fmt = "%ds" % ascii_len
return struct_unpack_tracker(data, index, fmt)
@ -159,7 +159,7 @@ def check_tcp_ports(ip, ports, timeout=DEFAULT_TIMEOUT, get_banner=False):
if get_banner and (len(connected_ports_sockets) != 0):
readable_sockets, _, _ = select.select([s[1] for s in connected_ports_sockets], [], [], 0)
# read first BANNER_READ bytes
banners = [sock.recv(BANNER_READ).decode() if sock in readable_sockets else ""
banners = [sock.recv(BANNER_READ).decode(errors='ignore') if sock in readable_sockets else ""
for port, sock in connected_ports_sockets]
pass
# try to cleanup