- Fixed KeyBlock import/call for both new and older versions of impacket

- added venv subdir to gitignore file
This commit is contained in:
object1337 committed 2022-06-08 22:56:57 +02:00
1 parent 6a22e01c69
commit dffe07c8bb
2 files changed
+11 -2

No files matched your search

+1
View File
@@ -1,4 +1,5 @@
build/
venv/
*.egg-info
dist/
*.pyc
+10 -2
View File
@@ -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'])