From nobody Mon Oct 2 16:21:02 2023 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 4RzmR23ndBz4wFRP; Mon, 2 Oct 2023 16:21:02 +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 4RzmR23Xpsz4N03; Mon, 2 Oct 2023 16:21:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696263662; 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=PpGKqtLckuKCIOXITDf/DrnFs7ic4O3185kM8WP49m8=; b=p/IR5E4MLPL4QO9dFsOJVyvmJ6SD+A2I28xW5Uen1oI0D39DPaA2DIbbm9llGcl4mdkeVL 6VumQ7sA6vlKvM6nKwKWqLX24lWpDEZfdc3H7GCwSxkrQMb0QDvk0esGqEb5CK4Tavru/Y lSNpqcc59QJQHtJfRvMvOIvS9mxBl/o8Qh94OQ0LYR6F7MqyMhYdK75MGOamTHkzz0H+k+ FE6um1EW4tZwP/t7wSjdbHFJ9NotfKgRDBJOnLUXLc36mnUprymU3WsjYFeiT359cI5moM Lu3f7Hg3y88JqbmIN1uOr46EEpqVe3Vz2tGSdHlSGBc7tiqsMDjiziFcNNdvHw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696263662; a=rsa-sha256; cv=none; b=rISBlaz014yWajSWlSSsbXRzklaSKMzl+YnfPUFP3hGlZYI6O/eMVLJhgl6wbqlfZDbanX J6oy3QmhwAQ1Nf1N2z8NS/HWQb/LqBDbvXzSnFNaGEVejaBVOPxu6wvU3N1FIfBIKvKsP8 qWKgJqTmI/HVascJf57knaUGOlEGKdNYUIkx2aDa05/9e6rzF9v+cRty+MOdmFj/NjsgWb Qtvo9zEpHgxStLAHgDaWVz51TO8GIkeL3JYxmEWaTByEEcBfqC2EX6U+HcuPh+diefCMC1 aXdEVw/sViMOTiZxzuIjpE7SVpMck0iSExk1EL354MajlgfEWbG2yYEO7vhfJw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696263662; 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=PpGKqtLckuKCIOXITDf/DrnFs7ic4O3185kM8WP49m8=; b=iy/LJNq/rliPqG1Na/oM72qsqrma4TZCcsNVk2RUIq018z4ecptS9EmyYqCHFdrCH/ezkr h5XB+/IE3dTSQVtRDoGb1CaUEEt/f8D/Yn2dSxxHvuqQdwsBE1G6SBSeiCuTLgh2YxDOnb huQc8AvbygMIbFdELV/7/qjcexk1o/Hu6MUvanDedBNSLLQuLagZEGRTwHHT5UxIR1v+0B IuB61qQ6jNksHaKpAiY9XDLR7zhmW4ZDMtrvEgweVU2IUAEZDy4vDeK4asT0puf8tiByg5 2oVbOrmlmMQ47p6zhjH7kdBNXc56CNvNZ9VsqvkFqpVFHCqSNDmisWA8tlG6Gg== 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 4RzmR22Zyvz4QM; Mon, 2 Oct 2023 16:21:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 392GL2P3079375; Mon, 2 Oct 2023 16:21:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 392GL2oc079372; Mon, 2 Oct 2023 16:21:02 GMT (envelope-from git) Date: Mon, 2 Oct 2023 16:21:02 GMT Message-Id: <202310021621.392GL2oc079372@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Jose Alonso Cardenas Marquez Subject: git: c076d2ad1548 - main - net/py-impacket: Update to 0.11.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: acm X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c076d2ad15483c152049d2e80091a1ccd4c5242e Auto-Submitted: auto-generated The branch main has been updated by acm: URL: https://cgit.FreeBSD.org/ports/commit/?id=c076d2ad15483c152049d2e80091a1ccd4c5242e commit c076d2ad15483c152049d2e80091a1ccd4c5242e Author: Jose Alonso Cardenas Marquez AuthorDate: 2023-10-02 16:13:26 +0000 Commit: Jose Alonso Cardenas Marquez CommitDate: 2023-10-02 16:13:26 +0000 net/py-impacket: Update to 0.11.0 - Take maintainership. Maintainer not show activity from 2019 and this port was marked like vulnerable from 2023-04-09 Approved by: maintainer timeout --- net/py-impacket/Makefile | 18 +- net/py-impacket/distinfo | 6 +- net/py-impacket/files/patch-2to3 | 6561 ---------------------------------- net/py-impacket/files/patch-setup.py | 27 +- 4 files changed, 28 insertions(+), 6584 deletions(-) diff --git a/net/py-impacket/Makefile b/net/py-impacket/Makefile index 08c2b502f287..0fb09ef9dce7 100644 --- a/net/py-impacket/Makefile +++ b/net/py-impacket/Makefile @@ -1,12 +1,10 @@ PORTNAME= impacket -PORTVERSION= 0.9.17 -PORTREVISION= 1 +PORTVERSION= 0.11.0 CATEGORIES= net python -MASTER_SITES= PYPI \ - https://github.com/CoreSecurity/impacket/releases/download/impacket_${PORTVERSION:S,.,_,g}/ +MASTER_SITES= PYPI PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} -MAINTAINER= contato@kanazuchi.com +MAINTAINER= acm@FreeBSD.org COMMENT= Collection of Python classes providing access to network packets WWW= https://www.coresecurity.com/corelabs-research/open-source-tools/impacket @@ -15,8 +13,14 @@ LICENSE_COMB= multi LICENSE_FILE= ${WRKSRC}/LICENSE RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pyasn1>=0:devel/py-pyasn1@${PY_FLAVOR} \ - ${PYTHON_PKGNAMEPREFIX}pcapy>=0:net/py-pcapy@${PY_FLAVOR} \ - ${PYTHON_PKGNAMEPREFIX}pycryptodome>0:security/py-pycryptodome@${PY_FLAVOR} + ${PYTHON_PKGNAMEPREFIX}pycryptodomex>0:security/py-pycryptodomex@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}openssl>0:security/py-openssl@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}six>0:devel/py-six@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}ldap3>0:net/py-ldap3@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}Flask>0:www/py-flask@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}future>0:devel/py-future@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}charset-normalizer>0:textproc/py-charset-normalizer@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}ldapdomaindump>0:net/py-ldapdomaindump@${PY_FLAVOR} USES= dos2unix python USE_PYTHON= autoplist distutils diff --git a/net/py-impacket/distinfo b/net/py-impacket/distinfo index 24f3b6d98b0a..a0e55d4c50bd 100644 --- a/net/py-impacket/distinfo +++ b/net/py-impacket/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1535712677 -SHA256 (impacket-0.9.17.tar.gz) = 68d47b101392e68e7abeb4a99e7b22f455f5879a5ef1d7c6bd0fc02b373a6858 -SIZE (impacket-0.9.17.tar.gz) = 1197897 +TIMESTAMP = 1695272809 +SHA256 (impacket-0.11.0.tar.gz) = ee4039b4d2aede8f5f64478bc59faac86036796be24dea8dc18f009fb0905e4a +SIZE (impacket-0.11.0.tar.gz) = 1502931 diff --git a/net/py-impacket/files/patch-2to3 b/net/py-impacket/files/patch-2to3 deleted file mode 100644 index f0d68cfd1fa5..000000000000 --- a/net/py-impacket/files/patch-2to3 +++ /dev/null @@ -1,6561 +0,0 @@ ---- 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=' ') *** 5693 LINES SKIPPED ***