When trying to convert Kerberos tickets I ran into a little issue with it being unable to import a name.. To be more exact the specific error is:
Traceback (most recent call last): File "ticket_converter.py", line 30, in from impacket.krb5.ccache import CCache, Header, Principal, Credential, KeyBlock, Times, CountedOctetString ImportError: cannot import name 'KeyBlock' from 'impacket.krb5.ccache' (/usr/local/lib/python3.8/dist-packages/impacket-0.10.1.dev1-py3.8.egg/impacket/krb5/ccache.py)
Fortunately the fix was quite easy when looking into impacket file mentioned in the error. Namely it seems, they have changed the class names and added versioning.
grep -i keyblock /usr/lib/python3/dist-packages/impacket/krb5/ccache.py class KeyBlockV3(Structure): class KeyBlockV4(Structure):
When seeing that I realized that the fix is easy.. Just change all occurrences of the word KeyBlock to KeyBlockV4. Just open up ticket_converter.py in vim and type: “%s/KeyBlock/KeyBlockV4/”. That fixed it for me. Happy Hacking! 🙂
Leave a Reply