From nobody Fri Jun 3 14:00:30 2022 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 00CB51B5B0EA; Fri, 3 Jun 2022 14:00:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LF4KC3Ymnz3FKP; Fri, 3 Jun 2022 14:00:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654264831; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=D8RQACr4Qk5ew7I8S3R7BREOKXr5V66Rl5X3VA1w4oQ=; b=Rsoe8HNimkWrcpmDdbUgXZ5otzY+/c2yeVIU3Wxzk+m7wI8qGYkuvu5+atbIuo5//c1jxk yN0TBk6vxvGrXFEklfGBMnlgRYcbSOjJBeD3w8UZHnMMXPB1pyMt6W6G0/gYMW9ZHt3ReR fv/KehG1auZ98VwS5lGL8KiF+EyAu7JU7MJwu9e98L6mcY0Nps2IlG6lzT9zJruThgSPDf npLoc0AYw9FIPUERtinYUloXFPmIhSOb65eOh/QuyFtKS4pODkXxC7+nkL/wAlXPnyBzrN m/Z+LnDT5dtIPXTWHomD+boc/hLXxfRvBeBgkxu3b5zblNC4JQDyYKDVYAVK4A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B53FB2446; Fri, 3 Jun 2022 14:00:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 253E0UoM098597; Fri, 3 Jun 2022 14:00:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 253E0ULV098596; Fri, 3 Jun 2022 14:00:30 GMT (envelope-from git) Date: Fri, 3 Jun 2022 14:00:30 GMT Message-Id: <202206031400.253E0ULV098596@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Po-Chuan Hsieh Subject: git: df8d6825dd35 - main - net/py-impacket: Fix build with setuptools 58.0.0+ List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: sunpoet X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: df8d6825dd3593830bc0cbbaab8305ba19f0bfa7 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654264831; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=D8RQACr4Qk5ew7I8S3R7BREOKXr5V66Rl5X3VA1w4oQ=; b=BdFrOY7+q/WF0u+0uWBzGG+6iu9S2SD5dk8PWqntYgGrn5dKQVLQf2zfpedACSHliN/9oo ZyxN3PAj+KapiV1Bv0o+IrqBSrzOs3ymzHuq8XSxZT9JP9RZtIfnF8g5eZiWiK5aw1StLb KEM4BUlfmw6kwJUpnFHaIHMbl9ZQkIPgTBHxRYfGbZQUhToUw1TBxv6SslN/CqbzTHTSlB LQ8nqt77hPTOqoynOCEXZPtKRYRgxPGVIeFNT6Yvo7Uk/zuDQu1R/0eY9Oc3K+zBbJA3BR t3KTUTw6PmiCAuo7YzePNYM01fwPCpqlqXtuzKC3lydsQmZ3X+KbJzxx6FOghg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654264831; a=rsa-sha256; cv=none; b=jKTSeGhp+edDP9dbPSe1RFGy8tA9tONKRwaLHoX5Adp3e+HVuyHgo9ahFTe4DjgF+eJrXr ruwTwWcgsvVgcx8JnzJp0mP+amAIrhTC7wdAJ5GS8t1GtuWvA+SD3EvVoKXecGREY0Mjkp Cunr0RKmwKIwWJWjD5ukXBlv2x50xpzwxjWwvoJjy3lx1fktlmcLhFHvYDa/PdT7bUOE2e yngnHsGMR3H/fcfzehQl+5a6zilb98DqeW+/G8K1RD5q7uaUr027hiyKRV/84nR/LVxMbl f6o/kzBdG/5vDLB96fi+/hHtbR3BgBRN8WDHFzzbBbMalZMFmiKzSTFhdOq4RQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by sunpoet: URL: https://cgit.FreeBSD.org/ports/commit/?id=df8d6825dd3593830bc0cbbaab8305ba19f0bfa7 commit df8d6825dd3593830bc0cbbaab8305ba19f0bfa7 Author: Po-Chuan Hsieh AuthorDate: 2022-06-03 13:56:49 +0000 Commit: Po-Chuan Hsieh CommitDate: 2022-06-03 13:59:09 +0000 net/py-impacket: Fix build with setuptools 58.0.0+ With hat: python --- net/py-impacket/files/patch-2to3 | 6561 ++++++++++++++++++++++++++++++++++ net/py-impacket/files/patch-setup.py | 8 +- 2 files changed, 6565 insertions(+), 4 deletions(-) diff --git a/net/py-impacket/files/patch-2to3 b/net/py-impacket/files/patch-2to3 new file mode 100644 index 000000000000..f0d68cfd1fa5 --- /dev/null +++ b/net/py-impacket/files/patch-2to3 @@ -0,0 +1,6561 @@ +--- impacket/IP6_Address.py.orig 2022-05-21 20:29:42 UTC ++++ impacket/IP6_Address.py +@@ -26,7 +26,7 @@ class IP6_Address(): + self.__scope_id = "" + + #Invoke a constructor based on the type of the argument +- if type(address) is str or type(address) is unicode: ++ if type(address) is str or type(address) is str: + self.__from_string(address) + else: + self.__from_bytes(address) +@@ -243,7 +243,7 @@ class IP6_Address(): + #Capitalize on the constructor's ability to detect invalid text representations of an IP6 address + ip6_address = IP6_Address(text_representation) + return True +- except Exception, e: ++ except Exception as e: + return False + + def __is_a_scoped_address(self, text_representation): +@@ -252,18 +252,18 @@ class IP6_Address(): + ############################################################################################################# + # Informal tests + if __name__ == '__main__': +- print IP6_Address("A:B:C:D:E:F:1:2").as_string() ++ print(IP6_Address("A:B:C:D:E:F:1:2").as_string()) + # print IP6_Address("A:B:C:D:E:F:0:2").as_bytes() +- print IP6_Address("A:B:0:D:E:F:0:2").as_string() ++ print(IP6_Address("A:B:0:D:E:F:0:2").as_string()) + # print IP6_Address("A::BC:E:D").as_string(False) +- print IP6_Address("A::BC:E:D").as_string() +- print IP6_Address("A::BCD:EFFF:D").as_string() +- print IP6_Address("FE80:0000:0000:0000:020C:29FF:FE26:E251").as_string() ++ print(IP6_Address("A::BC:E:D").as_string()) ++ print(IP6_Address("A::BCD:EFFF:D").as_string()) ++ print(IP6_Address("FE80:0000:0000:0000:020C:29FF:FE26:E251").as_string()) + + # print IP6_Address("A::BCD:EFFF:D").as_bytes() +- print IP6_Address("::").as_string() +- print IP6_Address("1::").as_string() +- print IP6_Address("::2").as_string() ++ print(IP6_Address("::").as_string()) ++ print(IP6_Address("1::").as_string()) ++ print(IP6_Address("::2").as_string()) + # bin = [ + # 0x01, 0x02, 0x03, 0x04, + # 0x01, 0x02, 0x03, 0x04, +--- impacket/IP6_Extension_Headers.py.orig 2022-05-21 20:29:42 UTC ++++ impacket/IP6_Extension_Headers.py +@@ -6,7 +6,7 @@ + # + import array + +-from ImpactPacket import Header, ImpactPacketException, PacketBuffer ++from .ImpactPacket import Header, ImpactPacketException, PacketBuffer + + class IP6_Extension_Header(Header): + # --------------------------------- - - - - - - - +@@ -40,7 +40,7 @@ class IP6_Extension_Header(Header): + for option in self._option_list: + option_str = str(option) + option_str = option_str.split('\n') +- option_str = map(lambda s: (' ' * 4) + s, option_str) ++ option_str = [(' ' * 4) + s for s in option_str] + s += '\n'.join(option_str) + '\n' + + return s +@@ -53,7 +53,7 @@ class IP6_Extension_Header(Header): + + buffer = array.array('B', buffer[self.get_headers_field_size():]) + if remaining_bytes > len(buffer): +- raise ImpactPacketException, "Cannot load options from truncated packet" ++ raise ImpactPacketException("Cannot load options from truncated packet") + + while remaining_bytes > 0: + option_type = buffer[0] +@@ -164,7 +164,7 @@ class Extension_Option(PacketBuffer): + + def __init__(self, option_type, size): + if size > Extension_Option.MAX_OPTION_LEN: +- raise ImpactPacketException, "Option size of % is greater than the maximum of %d" % (size, Extension_Option.MAX_OPTION_LEN) ++ raise ImpactPacketException("Option size of % is greater than the maximum of %d" % (size, Extension_Option.MAX_OPTION_LEN)) + PacketBuffer.__init__(self, size) + self.set_option_type(option_type) + +@@ -217,7 +217,7 @@ class Option_PADN(Extension_Option): + + def __init__(self, padding_size): + if padding_size < 2: +- raise ImpactPacketException, "PadN Extension Option must be greater than 2 bytes" ++ raise ImpactPacketException("PadN Extension Option must be greater than 2 bytes") + + Extension_Option.__init__(self, Option_PADN.OPTION_TYPE_VALUE, padding_size) + self.set_data('\x00' * (padding_size - 2)) +@@ -266,7 +266,7 @@ class Hop_By_Hop(Basic_Extension_Header): + + @classmethod + def get_decoder(self): +- import ImpactDecoder ++ from . import ImpactDecoder + return ImpactDecoder.HopByHopDecoder + + class Destination_Options(Basic_Extension_Header): +@@ -275,7 +275,7 @@ class Destination_Options(Basic_Extension_Header): + + @classmethod + def get_decoder(self): +- import ImpactDecoder ++ from . import ImpactDecoder + return ImpactDecoder.DestinationOptionsDecoder + + class Routing_Options(IP6_Extension_Header): +@@ -307,7 +307,7 @@ class Routing_Options(IP6_Extension_Header): + + @classmethod + def get_decoder(self): +- import ImpactDecoder ++ from . import ImpactDecoder + return ImpactDecoder.RoutingOptionsDecoder + + def get_headers_field_size(self): +--- impacket/ImpactPacket.py.orig 2022-05-21 20:29:42 UTC ++++ impacket/ImpactPacket.py +@@ -19,6 +19,7 @@ import socket + import string + import sys + from binascii import hexlify ++from functools import reduce + + """Classes to build network packets programmatically. + +@@ -34,7 +35,7 @@ class ImpactPacketException(Exception): + def __init__(self, value): + self.value = value + def __str__(self): +- return `self.value` ++ return repr(self.value) + + class PacketBuffer(object): + """Implement the basic operations utilized to operate on a +@@ -362,7 +363,7 @@ class ProtocolPacket(ProtocolLayer): + class Header(PacketBuffer,ProtocolLayer): + "This is the base class from which all protocol definitions extend." + +- packet_printable = filter(lambda c: c not in string.whitespace, string.printable) + ' ' ++ packet_printable = [c for c in string.printable if c not in string.whitespace] + ' ' + + ethertype = None + protocol = None +@@ -650,7 +651,7 @@ class Ethernet(Header): + + @staticmethod + def as_eth_addr(anArray): +- tmp_list = map(lambda x: x > 15 and '%x'%x or '0%x'%x, anArray) ++ tmp_list = [x > 15 and '%x'%x or '0%x'%x for x in anArray] + return '' + reduce(lambda x, y: x+':'+y, tmp_list) + + def __str__(self): +@@ -842,7 +843,7 @@ class IP(Header): + for op in self.__option_list: + sum += op.get_len() + if sum > 40: +- raise ImpactPacketException, "Options overflowed in IP packet with length: %d" % sum ++ raise ImpactPacketException("Options overflowed in IP packet with length: %d" % sum) + + + def get_ip_v(self): +@@ -1065,7 +1066,7 @@ class IP(Header): + opt_left = (self.get_ip_hl() - 5) * 4 + opt_bytes = array.array('B', aBuffer[20:(20 + opt_left)]) + if len(opt_bytes) != opt_left: +- raise ImpactPacketException, "Cannot load options from truncated packet" ++ raise ImpactPacketException("Cannot load options from truncated packet") + + + while opt_left: +@@ -1076,7 +1077,7 @@ class IP(Header): + else: + op_len = opt_bytes[1] + if op_len > len(opt_bytes): +- raise ImpactPacketException, "IP Option length is too high" ++ raise ImpactPacketException("IP Option length is too high") + + new_option = IPOption(op_type, op_len) + new_option.set_bytes(opt_bytes[:op_len]) +@@ -1111,7 +1112,7 @@ class IPOption(PacketBuffer): + + def __init__(self, opcode = 0, size = None): + if size and (size < 3 or size > 40): +- raise ImpactPacketException, "IP Options must have a size between 3 and 40 bytes" ++ raise ImpactPacketException("IP Options must have a size between 3 and 40 bytes") + + if(opcode == IPOption.IPOPT_EOL): + PacketBuffer.__init__(self, 1) +@@ -1153,7 +1154,7 @@ class IPOption(PacketBuffer): + self.set_flags(0) + else: + if not size: +- raise ImpactPacketException, "Size required for this type" ++ raise ImpactPacketException("Size required for this type") + PacketBuffer.__init__(self,size) + self.set_code(opcode) + self.set_len(size) +@@ -1162,14 +1163,14 @@ class IPOption(PacketBuffer): + def append_ip(self, ip): + op = self.get_code() + if not (op == IPOption.IPOPT_RR or op == IPOption.IPOPT_LSRR or op == IPOption.IPOPT_SSRR or op == IPOption.IPOPT_TS): +- raise ImpactPacketException, "append_ip() not support for option type %d" % self.opt_type ++ raise ImpactPacketException("append_ip() not support for option type %d" % self.opt_type) + + p = self.get_ptr() + if not p: +- raise ImpactPacketException, "append_ip() failed, option ptr uninitialized" ++ raise ImpactPacketException("append_ip() failed, option ptr uninitialized") + + if (p + 4) > self.get_len(): +- raise ImpactPacketException, "append_ip() would overflow option" ++ raise ImpactPacketException("append_ip() would overflow option") + + self.set_ip_address(p - 1, ip) + p += 4 +@@ -1185,12 +1186,12 @@ class IPOption(PacketBuffer): + + def set_flags(self, flags): + if not (self.get_code() == IPOption.IPOPT_TS): +- raise ImpactPacketException, "Operation only supported on Timestamp option" ++ raise ImpactPacketException("Operation only supported on Timestamp option") + self.set_byte(3, flags) + + def get_flags(self, flags): + if not (self.get_code() == IPOption.IPOPT_TS): +- raise ImpactPacketException, "Operation only supported on Timestamp option" ++ raise ImpactPacketException("Operation only supported on Timestamp option") + return self.get_byte(3) + + +@@ -1218,7 +1219,7 @@ class IPOption(PacketBuffer): + + tmp_str = "\tIP Option: " + op = self.get_code() +- if map.has_key(op): ++ if op in map: + tmp_str += map[op] + else: + tmp_str += "Code: %d " % op +@@ -1327,7 +1328,7 @@ class TCP(Header): + sum += op.get_size() + + if sum > 40: +- raise ImpactPacketException, "Cannot add TCP option, would overflow option space" ++ raise ImpactPacketException("Cannot add TCP option, would overflow option space") + + def get_options(self): + return self.__option_list +@@ -1509,7 +1510,7 @@ class TCP(Header): + opt_left = (self.get_th_off() - 5) * 4 + opt_bytes = array.array('B', aBuffer[20:(20 + opt_left)]) + if len(opt_bytes) != opt_left: +- raise ImpactPacketException, "Cannot load options from truncated packet" ++ raise ImpactPacketException("Cannot load options from truncated packet") + + while opt_left: + op_kind = opt_bytes[0] +@@ -1519,9 +1520,9 @@ class TCP(Header): + else: + op_len = opt_bytes[1] + if op_len > len(opt_bytes): +- raise ImpactPacketException, "TCP Option length is too high" ++ raise ImpactPacketException("TCP Option length is too high") + if op_len < 2: +- raise ImpactPacketException, "TCP Option length is too low" ++ raise ImpactPacketException("TCP Option length is too low") + + new_option = TCPOption(op_kind) + new_option.set_bytes(opt_bytes[:op_len]) +@@ -1655,12 +1656,12 @@ class TCPOption(PacketBuffer): + + def set_len(self, len): + if self.get_size() < 2: +- raise ImpactPacketException, "Cannot set length field on an option having a size smaller than 2 bytes" ++ raise ImpactPacketException("Cannot set length field on an option having a size smaller than 2 bytes") + self.set_byte(1, len) + + def get_len(self): + if self.get_size() < 2: +- raise ImpactPacketException, "Cannot retrieve length field from an option having a size smaller than 2 bytes" ++ raise ImpactPacketException("Cannot retrieve length field from an option having a size smaller than 2 bytes") + return self.get_byte(1) + + def get_size(self): +@@ -1669,42 +1670,42 @@ class TCPOption(PacketBuffer): + + def set_mss(self, len): + if self.get_kind() != TCPOption.TCPOPT_MAXSEG: +- raise ImpactPacketException, "Can only set MSS on TCPOPT_MAXSEG option" ++ raise ImpactPacketException("Can only set MSS on TCPOPT_MAXSEG option") + self.set_word(2, len) + + def get_mss(self): + if self.get_kind() != TCPOption.TCPOPT_MAXSEG: +- raise ImpactPacketException, "Can only retrieve MSS from TCPOPT_MAXSEG option" ++ raise ImpactPacketException("Can only retrieve MSS from TCPOPT_MAXSEG option") + return self.get_word(2) + + def set_shift_cnt(self, cnt): + if self.get_kind() != TCPOption.TCPOPT_WINDOW: +- raise ImpactPacketException, "Can only set Shift Count on TCPOPT_WINDOW option" ++ raise ImpactPacketException("Can only set Shift Count on TCPOPT_WINDOW option") + self.set_byte(2, cnt) + + def get_shift_cnt(self): + if self.get_kind() != TCPOption.TCPOPT_WINDOW: +- raise ImpactPacketException, "Can only retrieve Shift Count from TCPOPT_WINDOW option" ++ raise ImpactPacketException("Can only retrieve Shift Count from TCPOPT_WINDOW option") + return self.get_byte(2) + + def get_ts(self): + if self.get_kind() != TCPOption.TCPOPT_TIMESTAMP: +- raise ImpactPacketException, "Can only retrieve timestamp from TCPOPT_TIMESTAMP option" ++ raise ImpactPacketException("Can only retrieve timestamp from TCPOPT_TIMESTAMP option") + return self.get_long(2) + + def set_ts(self, ts): + if self.get_kind() != TCPOption.TCPOPT_TIMESTAMP: +- raise ImpactPacketException, "Can only set timestamp on TCPOPT_TIMESTAMP option" ++ raise ImpactPacketException("Can only set timestamp on TCPOPT_TIMESTAMP option") + self.set_long(2, ts) + + def get_ts_echo(self): + if self.get_kind() != TCPOption.TCPOPT_TIMESTAMP: +- raise ImpactPacketException, "Can only retrieve timestamp from TCPOPT_TIMESTAMP option" ++ raise ImpactPacketException("Can only retrieve timestamp from TCPOPT_TIMESTAMP option") + return self.get_long(6) + + def set_ts_echo(self, ts): + if self.get_kind() != TCPOption.TCPOPT_TIMESTAMP: +- raise ImpactPacketException, "Can only set timestamp on TCPOPT_TIMESTAMP option" ++ raise ImpactPacketException("Can only set timestamp on TCPOPT_TIMESTAMP option") + self.set_long(6, ts) + + def __str__(self): +@@ -1716,7 +1717,7 @@ class TCPOption(PacketBuffer): + + tmp_str = "\tTCP Option: " + op = self.get_kind() +- if map.has_key(op): ++ if op in map: + tmp_str += map[op] + else: + tmp_str += " kind: %d " % op +@@ -1779,7 +1780,7 @@ class ICMP(Header): + + def get_header_size(self): + anamolies = { ICMP.ICMP_TSTAMP : 20, ICMP.ICMP_TSTAMPREPLY : 20, ICMP.ICMP_MASKREQ : 12, ICMP.ICMP_MASKREPLY : 12 } +- if anamolies.has_key(self.get_icmp_type()): ++ if self.get_icmp_type() in anamolies: + return anamolies[self.get_icmp_type()] + else: + return 8 +@@ -1899,7 +1900,7 @@ class ICMP(Header): + tmp_code[11] = ['TIMXCEED INTRANS ', 'TIMXCEED REASS'] + tmp_code[12] = ['PARAMPROB ERRATPTR ', 'PARAMPROB OPTABSENT', 'PARAMPROB LENGTH'] + tmp_code[40] = [None, 'PHOTURIS UNKNOWN INDEX', 'PHOTURIS AUTH FAILED', 'PHOTURIS DECRYPT FAILED'] +- if tmp_code.has_key(aType): ++ if aType in tmp_code: + tmp_list = tmp_code[aType] + if ((aCode + 1) > len(tmp_list)) or (not tmp_list[aCode]): + return 'UNKNOWN' +@@ -1937,7 +1938,7 @@ class ICMP(Header): + + def isQuery(self): + tmp_dict = {8:'', 9:'', 10:'', 13:'', 14:'', 15:'', 16:'', 17:'', 18:''} +- return tmp_dict.has_key(self.get_icmp_type()) ++ return self.get_icmp_type() in tmp_dict + + class IGMP(Header): + protocol = 2 +@@ -2122,5 +2123,5 @@ def example(): #To execute an example, remove this lin + b.set_ar_tpa((192, 168, 66, 171)) + a.set_ether_shost((0x0, 0xe0, 0x7d, 0x8a, 0xef, 0x3d)) + a.set_ether_dhost((0x0, 0xc0, 0xdf, 0x6, 0x5, 0xe)) +- print "beto %s" % a ++ print("beto %s" % a) + +--- impacket/dcerpc/v5/dcom/oaut.py.orig 2022-05-21 20:29:42 UTC ++++ impacket/dcerpc/v5/dcom/oaut.py +@@ -40,7 +40,7 @@ class DCERPCSessionError(DCERPCException): + DCERPCException.__init__(self, error_string, error_code, packet) + + def __str__( self ): +- if hresult_errors.ERROR_MESSAGES.has_key(self.error_code): ++ if self.error_code in hresult_errors.ERROR_MESSAGES: + error_msg_short = hresult_errors.ERROR_MESSAGES[self.error_code][0] + error_msg_verbose = hresult_errors.ERROR_MESSAGES[self.error_code][1] + return 'OAUT SessionError: code: 0x%x - %s - %s' % (self.error_code, error_msg_short, error_msg_verbose) +@@ -286,9 +286,9 @@ class FLAGGED_WORD_BLOB(NDRSTRUCT): + if msg is None: msg = self.__class__.__name__ + ind = ' '*indent + if msg != '': +- print "%s" % (msg) ++ print("%s" % (msg)) + value = '' +- print '%sasData: %s' % (ind,self['asData']), ++ print('%sasData: %s' % (ind,self['asData']), end=' ') + + # 2.2.23.2 BSTR Type Definition + class BSTR(NDRPOINTER): +@@ -979,9 +979,9 @@ def enumerateMethods(iInterface): + for x in range(iTypeAttr['ppTypeAttr']['cFuncs']): + funcDesc = iTypeInfo.GetFuncDesc(x) + names = iTypeInfo.GetNames(funcDesc['ppFuncDesc']['memid'], 255) +- print names['rgBstrNames'][0]['asData'] ++ print(names['rgBstrNames'][0]['asData']) + funcDesc.dump() +- print '='*80 ++ print('='*80) + if names['pcNames'] > 0: + name = names['rgBstrNames'][0]['asData'] + methods[name] = {} +--- impacket/dcerpc/v5/dcom/scmp.py.orig 2022-05-21 20:29:42 UTC ++++ impacket/dcerpc/v5/dcom/scmp.py +@@ -32,7 +32,7 @@ class DCERPCSessionError(DCERPCException): + DCERPCException.__init__(self, error_string, error_code, packet) + + def __str__( self ): +- if hresult_errors.ERROR_MESSAGES.has_key(self.error_code): ++ if self.error_code in hresult_errors.ERROR_MESSAGES: + error_msg_short = hresult_errors.ERROR_MESSAGES[self.error_code][0] + error_msg_verbose = hresult_errors.ERROR_MESSAGES[self.error_code][1] + return 'SCMP SessionError: code: 0x%x - %s - %s' % (self.error_code, error_msg_short, error_msg_verbose) +@@ -301,8 +301,8 @@ class IVssSnapshotMgmt(IRemUnknown2): + req['ProviderId'] = providerId + try: + resp = self.request(req, self._iid, uuid = self.get_iPid()) +- except DCERPCException, e: +- print e ++ except DCERPCException as e: ++ print(e) + from impacket.winregistry import hexdump + data = e.get_packet() + hexdump(data) +--- impacket/dcerpc/v5/dcom/vds.py.orig 2022-05-21 20:29:42 UTC ++++ impacket/dcerpc/v5/dcom/vds.py +@@ -32,7 +32,7 @@ class DCERPCSessionError(DCERPCException): + DCERPCException.__init__(self, error_string, error_code, packet) + + def __str__( self ): +- if hresult_errors.ERROR_MESSAGES.has_key(self.error_code): ++ if self.error_code in hresult_errors.ERROR_MESSAGES: + error_msg_short = hresult_errors.ERROR_MESSAGES[self.error_code][0] + error_msg_verbose = hresult_errors.ERROR_MESSAGES[self.error_code][1] + return 'VDS SessionError: code: 0x%x - %s - %s' % (self.error_code, error_msg_short, error_msg_verbose) +@@ -198,7 +198,7 @@ class IEnumVdsObject(IRemUnknown2): + request['celt'] = celt + try: + resp = self.request(request, uuid = self.get_iPid()) +- except Exception, e: ++ except Exception as e: + resp = e.get_packet() + # If it is S_FALSE(1) means less items were returned + if resp['ErrorCode'] != 1: +@@ -238,7 +238,7 @@ class IVdsService(IRemUnknown2): + request['ORPCthis']['flags'] = 0 + try: + resp = self.request(request, uuid = self.get_iPid()) +- except Exception, e: ++ except Exception as e: + resp = e.get_packet() + return resp + +--- impacket/dcerpc/v5/dcom/wmi.py.orig 2022-05-21 20:29:42 UTC ++++ impacket/dcerpc/v5/dcom/wmi.py +@@ -38,11 +38,11 @@ from impacket.structure import Structure + def format_structure(d, level=0): + x = "" + if isinstance(d, collections.Mapping): +- lenk = max(map(lambda x: len(str(x)), d.keys())) +- for k, v in d.items(): ++ lenk = max([len(str(x)) for x in list(d.keys())]) ++ for k, v in list(d.items()): + key_text = "\n" + " "*level + " "*(lenk - len(str(k))) + str(k) + x += key_text + ": " + format_structure(v, level=level+lenk) +- elif isinstance(d, collections.Iterable) and not isinstance(d, basestring): ++ elif isinstance(d, collections.Iterable) and not isinstance(d, str): + for e in d: + x += "\n" + " "*level + "- " + format_structure(e, level=level+4) + else: +@@ -61,7 +61,7 @@ class DCERPCSessionError(DCERPCException): + DCERPCException.__init__(self, error_string, error_code, packet) + + def __str__( self ): +- if hresult_errors.ERROR_MESSAGES.has_key(self.error_code): ++ if self.error_code in hresult_errors.ERROR_MESSAGES: + error_msg_short = hresult_errors.ERROR_MESSAGES[self.error_code][0] + error_msg_verbose = hresult_errors.ERROR_MESSAGES[self.error_code][1] + return 'WMI SessionError: code: 0x%x - %s - %s' % (self.error_code, error_msg_short, error_msg_verbose) +@@ -501,7 +501,7 @@ class PROPERTY_LOOKUP_TABLE(Structure): + + propTable = propTable[self.PropertyLookupSize:] + +- return OrderedDict(sorted(properties.items(), key=lambda x:x[1]['order'])) ++ return OrderedDict(sorted(list(properties.items()), key=lambda x:x[1]['order'])) + #return properties + + # 2.2.66 Heap +@@ -539,7 +539,7 @@ class CLASS_PART(Structure): + def getProperties(self): + heap = self["ClassHeap"]["HeapItem"] + properties = self["PropertyLookupTable"].getProperties(self["ClassHeap"]["HeapItem"]) +- sorted_props = sorted(properties.keys(), key=lambda k: properties[k]['order']) ++ sorted_props = sorted(list(properties.keys()), key=lambda k: properties[k]['order']) + valueTableOff = (len(properties) - 1) / 4 + 1 + valueTable = self['NdTable_ValueTable'][valueTableOff:] + for key in sorted_props: +@@ -787,7 +787,7 @@ class INSTANCE_TYPE(Structure): + heap = self["InstanceHeap"]["HeapItem"] + valueTableOff = (len(properties) - 1) / 4 + 1 + valueTable = self['NdTable_ValueTable'][valueTableOff:] +- sorted_props = sorted(properties.keys(), key=lambda k: properties[k]['order']) ++ sorted_props = sorted(list(properties.keys()), key=lambda k: properties[k]['order']) + for key in sorted_props: + pType = properties[key]['type'] & (~(CIM_ARRAY_FLAG|Inherited)) + if properties[key]['type'] & CIM_ARRAY_FLAG: +@@ -868,11 +868,11 @@ class OBJECT_BLOCK(Structure): + qualifiers = pClass.getQualifiers() + + for qualifier in qualifiers: +- print "[%s]" % qualifier ++ print("[%s]" % qualifier) + + className = pClass.getClassName() + +- print "class %s \n{" % className ++ print("class %s \n{" % className) + + properties = pClass.getProperties() + if cInstance is not None: +@@ -883,52 +883,52 @@ class OBJECT_BLOCK(Structure): + qualifiers = properties[pName]['qualifiers'] + for qName in qualifiers: + if qName != 'CIMTYPE': +- print '\t[%s(%s)]' % (qName, qualifiers[qName]) +- print "\t%s %s" % (properties[pName]['stype'], properties[pName]['name']), ++ print('\t[%s(%s)]' % (qName, qualifiers[qName])) ++ print("\t%s %s" % (properties[pName]['stype'], properties[pName]['name']), end=' ') + if properties[pName]['value'] is not None: + if properties[pName]['type'] == CIM_TYPE_ENUM.CIM_TYPE_OBJECT.value: +- print '= IWbemClassObject\n' ++ print('= IWbemClassObject\n') + elif properties[pName]['type'] == CIM_TYPE_ENUM.CIM_ARRAY_OBJECT.value: + if properties[pName]['value'] == 0: +- print '= %s\n' % properties[pName]['value'] ++ print('= %s\n' % properties[pName]['value']) + else: +- print '= %s\n' % list('IWbemClassObject' for _ in range(len(properties[pName]['value']))) ++ print('= %s\n' % list('IWbemClassObject' for _ in range(len(properties[pName]['value'])))) + else: +- print '= %s\n' % properties[pName]['value'] ++ print('= %s\n' % properties[pName]['value']) + else: +- print '\n' ++ print('\n') + +- print ++ print() + methods = pClass.getMethods() + for methodName in methods: + for qualifier in methods[methodName]['qualifiers']: +- print '\t[%s]' % qualifier ++ print('\t[%s]' % qualifier) + + if methods[methodName]['InParams'] is None and methods[methodName]['OutParams'] is None: +- print '\t%s %s();\n' % ('void', methodName) ++ print('\t%s %s();\n' % ('void', methodName)) + if methods[methodName]['InParams'] is None and len(methods[methodName]['OutParams']) == 1: +- print '\t%s %s();\n' % (methods[methodName]['OutParams']['ReturnValue']['stype'], methodName) ++ print('\t%s %s();\n' % (methods[methodName]['OutParams']['ReturnValue']['stype'], methodName)) + else: + returnValue = '' + if methods[methodName]['OutParams'] is not None: + # Search the Return Value + #returnValue = (item for item in method['OutParams'] if item["name"] == "ReturnValue").next() +- if methods[methodName]['OutParams'].has_key('ReturnValue'): ++ if 'ReturnValue' in methods[methodName]['OutParams']: + returnValue = methods[methodName]['OutParams']['ReturnValue']['stype'] + +- print '\t%s %s(\n' % (returnValue, methodName), ++ print('\t%s %s(\n' % (returnValue, methodName), end=' ') + if methods[methodName]['InParams'] is not None: + for pName in methods[methodName]['InParams']: +- print '\t\t[in] %s %s,' % (methods[methodName]['InParams'][pName]['stype'], pName) ++ print('\t\t[in] %s %s,' % (methods[methodName]['InParams'][pName]['stype'], pName)) + + if methods[methodName]['OutParams'] is not None: + for pName in methods[methodName]['OutParams']: + if pName != 'ReturnValue': +- print '\t\t[out] %s %s,' % (methods[methodName]['OutParams'][pName]['stype'], pName) ++ print('\t\t[out] %s %s,' % (methods[methodName]['OutParams'][pName]['stype'], pName)) + +- print '\t);\n' ++ print('\t);\n') + +- print "}" ++ print("}") + + def parseClass(self, pClass, cInstance = None): + classDict = OrderedDict() +@@ -2301,7 +2301,7 @@ class IWbemClassObject(IRemUnknown): + # Let's see if there's a key property so we can ExecMethod + keyProperty = None + for pName in properties: +- if properties[pName]['qualifiers'].has_key('key'): ++ if 'key' in properties[pName]['qualifiers']: + keyProperty = pName + + if keyProperty is None: +@@ -2311,7 +2311,7 @@ class IWbemClassObject(IRemUnknown): + classObject,_ = self.__iWbemServices.GetObject(self.getClassName()) + self.__methods = classObject.getMethods() + +- if self.__methods.has_key(attr): ++ if attr in self.__methods: + # Now we gotta build the class name to be called through ExecMethod + if self.getProperties()[keyProperty]['stype'] != 'string': + instanceName = '%s.%s=%s' % ( +@@ -2619,7 +2619,7 @@ class IWbemClassObject(IRemUnknown): + + ndTable = 0 + for i in range(len(args)): +- paramDefinition = methodDefinition['InParams'].values()[i] ++ paramDefinition = list(methodDefinition['InParams'].values())[i] + inArg = args[i] + + pType = paramDefinition['type'] & (~(CIM_ARRAY_FLAG|Inherited)) +@@ -2651,7 +2651,7 @@ class IWbemClassObject(IRemUnknown): + ndTable |= 3 << (2*i) + else: + strIn = ENCODED_STRING() +- if type(inArg) is unicode: ++ if type(inArg) is str: + # The Encoded-String-Flag is set to 0x01 if the sequence of characters that follows + # consists of UTF-16 characters (as specified in [UNICODE]) followed by a UTF-16 null + # terminator. +@@ -2729,7 +2729,7 @@ class IWbemClassObject(IRemUnknown): + return self.__iWbemServices.ExecMethod(classOrInstance, methodDefinition['name'], pInParams = objRefCustomIn ) + #return self.__iWbemServices.ExecMethod('Win32_Process.Handle="436"', methodDefinition['name'], + # pInParams=objRefCustomIn).getObject().ctCurrent['properties'] +- except Exception, e: ++ except Exception as e: + if LOG.level == logging.DEBUG: + import traceback + traceback.print_exc() +--- impacket/dcerpc/v5/dcomrt.py.orig 2022-05-21 20:29:42 UTC ++++ impacket/dcerpc/v5/dcomrt.py +@@ -70,7 +70,7 @@ class DCERPCSessionError(DCERPCException): + DCERPCException.__init__(self, error_string, error_code, packet) + + def __str__( self ): +- if hresult_errors.ERROR_MESSAGES.has_key(self.error_code): ++ if self.error_code in hresult_errors.ERROR_MESSAGES: + error_msg_short = hresult_errors.ERROR_MESSAGES[self.error_code][0] + error_msg_verbose = hresult_errors.ERROR_MESSAGES[self.error_code][1] + return 'DCOM SessionError: code: 0x%x - %s - %s' % (self.error_code, error_msg_short, error_msg_verbose) +@@ -963,20 +963,20 @@ class DCOMConnection: + + @classmethod + def addOid(cls, target, oid): +- if DCOMConnection.OID_ADD.has_key(target) is False: ++ if (target in DCOMConnection.OID_ADD) is False: + DCOMConnection.OID_ADD[target] = set() + DCOMConnection.OID_ADD[target].add(oid) +- if DCOMConnection.OID_SET.has_key(target) is False: ++ if (target in DCOMConnection.OID_SET) is False: + DCOMConnection.OID_SET[target] = {} + DCOMConnection.OID_SET[target]['oids'] = set() + DCOMConnection.OID_SET[target]['setid'] = 0 + + @classmethod + def delOid(cls, target, oid): +- if DCOMConnection.OID_DEL.has_key(target) is False: ++ if (target in DCOMConnection.OID_DEL) is False: + DCOMConnection.OID_DEL[target] = set() + DCOMConnection.OID_DEL[target].add(oid) +- if DCOMConnection.OID_SET.has_key(target) is False: ++ if (target in DCOMConnection.OID_SET) is False: + DCOMConnection.OID_SET[target] = {} + DCOMConnection.OID_SET[target]['oids'] = set() + DCOMConnection.OID_SET[target]['setid'] = 0 +@@ -991,18 +991,18 @@ class DCOMConnection: + for target in DCOMConnection.OID_SET: + addedOids = set() + deletedOids = set() +- if DCOMConnection.OID_ADD.has_key(target): ++ if target in DCOMConnection.OID_ADD: + addedOids = DCOMConnection.OID_ADD[target] + del(DCOMConnection.OID_ADD[target]) + +- if DCOMConnection.OID_DEL.has_key(target): ++ if target in DCOMConnection.OID_DEL: + deletedOids = DCOMConnection.OID_DEL[target] + del(DCOMConnection.OID_DEL[target]) + + objExporter = IObjectExporter(DCOMConnection.PORTMAPS[target]) + + if len(addedOids) > 0 or len(deletedOids) > 0: +- if DCOMConnection.OID_SET[target].has_key('setid'): ++ if 'setid' in DCOMConnection.OID_SET[target]: + setId = DCOMConnection.OID_SET[target]['setid'] + else: + setId = 0 +@@ -1012,7 +1012,7 @@ class DCOMConnection: + DCOMConnection.OID_SET[target]['setid'] = resp['pSetId'] + else: + objExporter.SimplePing(DCOMConnection.OID_SET[target]['setid']) +- except Exception, e: ++ except Exception as e: + # There might be exceptions when sending packets + # We should try to continue tho. + LOG.error(str(e)) +@@ -1021,7 +1021,7 @@ class DCOMConnection: + DCOMConnection.PINGTIMER = Timer(120,DCOMConnection.pingServer) + try: + DCOMConnection.PINGTIMER.start() +- except Exception, e: ++ except Exception as e: + if str(e).find('threads can only be started once') < 0: + raise e + +@@ -1031,7 +1031,7 @@ class DCOMConnection: + DCOMConnection.PINGTIMER = Timer(120, DCOMConnection.pingServer) + try: + DCOMConnection.PINGTIMER.start() +- except Exception, e: ++ except Exception as e: + if str(e).find('threads can only be started once') < 0: + raise e + +@@ -1069,7 +1069,7 @@ class DCOMConnection: + DCOMConnection.PINGTIMER.cancel() + DCOMConnection.PINGTIMER.join() + DCOMConnection.PINGTIMER = None +- if INTERFACE.CONNECTIONS.has_key(self.__target): ++ if self.__target in INTERFACE.CONNECTIONS: + del(INTERFACE.CONNECTIONS[self.__target][currentThread().getName()]) + self.__portmap.disconnect() + #print INTERFACE.CONNECTIONS +@@ -1124,7 +1124,7 @@ class INTERFACE: + self.__objRef = objRef + self.__ipidRemUnknown = ipidRemUnknown + # We gotta check if we have a container inside our connection list, if not, create +- if INTERFACE.CONNECTIONS.has_key(self.__target) is not True: ++ if (self.__target in INTERFACE.CONNECTIONS) is not True: + INTERFACE.CONNECTIONS[self.__target] = {} + INTERFACE.CONNECTIONS[self.__target][currentThread().getName()] = {} + +@@ -1213,9 +1213,9 @@ class INTERFACE: + + + def connect(self, iid = None): +- if INTERFACE.CONNECTIONS.has_key(self.__target) is True: +- if INTERFACE.CONNECTIONS[self.__target].has_key(currentThread().getName()) and \ +- INTERFACE.CONNECTIONS[self.__target][currentThread().getName()].has_key(self.__oxid) is True: ++ if (self.__target in INTERFACE.CONNECTIONS) is True: ++ if currentThread().getName() in INTERFACE.CONNECTIONS[self.__target] and \ ++ (self.__oxid in INTERFACE.CONNECTIONS[self.__target][currentThread().getName()]) is True: + dce = INTERFACE.CONNECTIONS[self.__target][currentThread().getName()][self.__oxid]['dce'] + currentBinding = INTERFACE.CONNECTIONS[self.__target][currentThread().getName()][self.__oxid]['currentBinding'] + if currentBinding == iid: +@@ -1308,7 +1308,7 @@ class INTERFACE: + dce = self.get_dce_rpc() + try: + resp = dce.request(req, uuid) +- except Exception, e: ++ except Exception as e: + if str(e).find('RPC_E_DISCONNECTED') >= 0: + msg = str(e) + '\n' + msg += "DCOM keep-alive pinging it might not be working as expected. You can't be idle for more than 14 minutes!\n" +--- impacket/dcerpc/v5/dhcpm.py.orig 2022-05-21 20:29:42 UTC ++++ impacket/dcerpc/v5/dhcpm.py +@@ -47,11 +47,11 @@ class DCERPCSessionError(DCERPCException): + + def __str__(self): + key = self.error_code +- if system_errors.ERROR_MESSAGES.has_key(key): ++ if key in system_errors.ERROR_MESSAGES: + error_msg_short = system_errors.ERROR_MESSAGES[key][0] + error_msg_verbose = system_errors.ERROR_MESSAGES[key][1] + return 'DHCPM SessionError: code: 0x%x - %s - %s' % (self.error_code, error_msg_short, error_msg_verbose) +- elif self.ERROR_MESSAGES.has_key(key): ++ elif key in self.ERROR_MESSAGES: + error_msg_short = self.ERROR_MESSAGES[key][0] + error_msg_verbose = self.ERROR_MESSAGES[key][1] + return 'DHCPM SessionError: code: 0x%x - %s - %s' % (self.error_code, error_msg_short, error_msg_verbose) +@@ -815,7 +815,7 @@ def hDhcpGetOptionValue(dce, optionID, scopetype=DHCP_ + while status == system_errors.ERROR_MORE_DATA: + try: + resp = dce.request(request) +- except DCERPCException, e: ++ except DCERPCException as e: + if str(e).find('ERROR_NO_MORE_ITEMS') < 0: + raise + resp = e.get_packet() +@@ -842,7 +842,7 @@ def hDhcpEnumOptionValues(dce, scopetype=DHCP_OPTION_S + while status == system_errors.ERROR_MORE_DATA: + try: + resp = dce.request(request) +- except DCERPCException, e: ++ except DCERPCException as e: + if str(e).find('ERROR_NO_MORE_ITEMS') < 0: + raise + resp = e.get_packet() +@@ -872,7 +872,7 @@ def hDhcpEnumOptionValuesV5(dce, flags=DHCP_FLAGS_OPTI + while status == system_errors.ERROR_MORE_DATA: + try: + resp = dce.request(request) +- except DCERPCException, e: ++ except DCERPCException as e: + if str(e).find('ERROR_NO_MORE_ITEMS') < 0: + raise + resp = e.get_packet() +@@ -900,7 +900,7 @@ def hDhcpGetOptionValueV5(dce, option_id, flags=DHCP_F + while status == system_errors.ERROR_MORE_DATA: + try: + resp = dce.request(request) +- except DCERPCException, e: ++ except DCERPCException as e: + if str(e).find('ERROR_NO_MORE_ITEMS') < 0: + raise + resp = e.get_packet() +@@ -924,7 +924,7 @@ def hDhcpGetAllOptionValues(dce, scopetype=DHCP_OPTION + while status == system_errors.ERROR_MORE_DATA: + try: + resp = dce.request(request) +- except DCERPCException, e: ++ except DCERPCException as e: + if str(e).find('ERROR_NO_MORE_ITEMS') < 0: + raise + resp = e.get_packet() +@@ -940,7 +940,7 @@ def hDhcpEnumSubnets(dce, preferredMaximum=0xffffffff) + while status == system_errors.ERROR_MORE_DATA: + try: + resp = dce.request(request) +- except DCERPCException, e: ++ except DCERPCException as e: + if str(e).find('STATUS_MORE_ENTRIES') < 0: + raise + resp = e.get_packet() +@@ -957,7 +957,7 @@ def hDhcpEnumSubnetClientsVQ(dce, preferredMaximum=0xf + while status == system_errors.ERROR_MORE_DATA: + try: + resp = dce.request(request) +- except DCERPCException, e: ++ except DCERPCException as e: + if str(e).find('STATUS_MORE_ENTRIES') < 0: + raise + resp = e.get_packet() +@@ -974,7 +974,7 @@ def hDhcpEnumSubnetClientsV4(dce, preferredMaximum=0xf + while status == system_errors.ERROR_MORE_DATA: + try: + resp = dce.request(request) +- except DCERPCException, e: ++ except DCERPCException as e: + if str(e).find('STATUS_MORE_ENTRIES') < 0: + raise + resp = e.get_packet() +@@ -991,7 +991,7 @@ def hDhcpEnumSubnetClientsV5(dce, subnetAddress=0, pre + while status == system_errors.ERROR_MORE_DATA: + try: + resp = dce.request(request) +- except DCERPCSessionError, e: ++ except DCERPCSessionError as e: + if str(e).find('STATUS_MORE_ENTRIES') < 0: + raise + resp = e.get_packet() +@@ -1010,7 +1010,7 @@ def hDhcpEnumSubnetElementsV5(dce, subnet_address, ele + while status == system_errors.ERROR_MORE_DATA: + try: + resp = dce.request(request) +- except DCERPCException, e: ++ except DCERPCException as e: + if str(e).find('ERROR_NO_MORE_ITEMS') < 0: + raise + resp = e.get_packet() +--- impacket/dcerpc/v5/drsuapi.py.orig 2022-05-21 20:29:42 UTC ++++ impacket/dcerpc/v5/drsuapi.py +@@ -47,11 +47,11 @@ class DCERPCSessionError(DCERPCException): + + def __str__( self ): + key = self.error_code +- if hresult_errors.ERROR_MESSAGES.has_key(key): ++ if key in hresult_errors.ERROR_MESSAGES: + error_msg_short = hresult_errors.ERROR_MESSAGES[key][0] + error_msg_verbose = hresult_errors.ERROR_MESSAGES[key][1] + return 'DRSR SessionError: code: 0x%x - %s - %s' % (self.error_code, error_msg_short, error_msg_verbose) +- elif system_errors.ERROR_MESSAGES.has_key(key & 0xffff): ++ elif key & 0xffff in system_errors.ERROR_MESSAGES: + error_msg_short = system_errors.ERROR_MESSAGES[key & 0xffff][0] + error_msg_verbose = system_errors.ERROR_MESSAGES[key & 0xffff][1] + return 'DRSR SessionError: code: 0x%x - %s - %s' % (self.error_code, error_msg_short, error_msg_verbose) +@@ -89,12 +89,12 @@ class EXOP_ERR(NDRENUM): + def dump(self, msg = None, indent = 0): + if msg is None: msg = self.__class__.__name__ + if msg != '': +- print msg, ++ print(msg, end=' ') + + try: +- print " %s" % self.enumItems(self.fields['Data']).name, ++ print(" %s" % self.enumItems(self.fields['Data']).name, end=' ') + except ValueError: +- print " %d" % self.fields['Data'] ++ print(" %d" % self.fields['Data']) + + # 4.1.10.2.18 EXOP_REQ Codes + EXOP_FSMO_REQ_ROLE = 0x00000001 +@@ -607,7 +607,7 @@ class WCHAR_ARRAY(NDRUniConformantArray): + # We might have Unicode chars in here, let's use unichr instead + LOG.debug('ValueError exception on %s' % self.fields[key]) + LOG.debug('Switching to unichr()') +- return ''.join([unichr(i) for i in self.fields[key]]) ++ return ''.join([chr(i) for i in self.fields[key]]) + + else: + return NDR.__getitem__(self,key) +@@ -1488,22 +1488,22 @@ if __name__ == '__main__': + oid4 = '1.2.840.113556.1.5.7000.53' + + o0 = MakeAttid(prefixTable, oid0) +- print hex(o0) ++ print(hex(o0)) + o1 = MakeAttid(prefixTable, oid1) +- print hex(o1) ++ print(hex(o1)) + o2 = MakeAttid(prefixTable, oid2) +- print hex(o2) ++ print(hex(o2)) + o3 = MakeAttid(prefixTable, oid3) +- print hex(o3) ++ print(hex(o3)) + o4 = MakeAttid(prefixTable, oid4) +- print hex(o4) ++ print(hex(o4)) + jj = OidFromAttid(prefixTable, o0) +- print jj ++ print(jj) + jj = OidFromAttid(prefixTable, o1) +- print jj ++ print(jj) + jj = OidFromAttid(prefixTable, o2) +- print jj ++ print(jj) + jj = OidFromAttid(prefixTable, o3) +- print jj ++ print(jj) + jj = OidFromAttid(prefixTable, o4) +- print jj ++ print(jj) +--- impacket/dcerpc/v5/dtypes.py.orig 2022-05-21 20:29:42 UTC ++++ impacket/dcerpc/v5/dtypes.py +@@ -95,9 +95,9 @@ class STR(NDRSTRUCT): + def dump(self, msg = None, indent = 0): + if msg is None: msg = self.__class__.__name__ + if msg != '': *** 5621 LINES SKIPPED ***