diff --git a/.gitignore b/.gitignore index 3ce13be..51cd7a8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ build/ +venv/ *.egg-info dist/ *.pyc diff --git a/lib/utils/krbcredccache.py b/lib/utils/krbcredccache.py index bbc40cb..c70e423 100644 --- a/lib/utils/krbcredccache.py +++ b/lib/utils/krbcredccache.py @@ -1,8 +1,13 @@ from impacket.krb5.constants import TicketFlags -from impacket.krb5.ccache import CCache, Header, Credential, KeyBlock, Times, CountedOctetString, Principal, Ticket +from impacket.krb5.ccache import CCache, Header, Credential, Times, CountedOctetString, Principal, Ticket from impacket.krb5 import types from pyasn1.codec.der import encoder +try: + from impacket.krb5.ccache import KeyBlockV4 +except ImportError: + from impacket.krb5.ccache import KeyBlock + class KrbCredCCache(CCache): """ This is just the impacket ccache, but with an extra function to create it from @@ -34,7 +39,10 @@ class KrbCredCCache(CCache): credential['server'] = tmpServer credential['is_skey'] = 0 - credential['key'] = KeyBlock() + try: + credential['key'] = KeyBlockV4() + except NameError: + credential['key'] = KeyBlock() credential['key']['keytype'] = int(encASRepPart['key']['keytype']) credential['key']['keyvalue'] = bytes(encASRepPart['key']['keyvalue']) credential['key']['keylen'] = len(credential['key']['keyvalue'])