Add a decoded ticket to the CCache
(self, decTkt, hash=None, kdc_hash=None)
| 889 | raise ValueError("Invalid 'i' value. Must be int or str") |
| 890 | |
| 891 | def _add_cred(self, decTkt, hash=None, kdc_hash=None): |
| 892 | """ |
| 893 | Add a decoded ticket to the CCache |
| 894 | """ |
| 895 | cred = CCCredential() |
| 896 | etype = ( |
| 897 | self._prompt( |
| 898 | "What key should we use (AES128-CTS-HMAC-SHA1-96/AES256-CTS-HMAC-SHA1-96/RC4-HMAC) ? [AES256-CTS-HMAC-SHA1-96]: " |
| 899 | ) |
| 900 | or "AES256-CTS-HMAC-SHA1-96" |
| 901 | ) |
| 902 | if etype not in _KRB_E_TYPES.values(): |
| 903 | print("Unknown keytype") |
| 904 | return |
| 905 | etype = next(k for k, v in _KRB_E_TYPES.items() if v == etype) |
| 906 | cred.ticket.data = bytes( |
| 907 | KRB_Ticket( |
| 908 | realm=decTkt.crealm, |
| 909 | sname=PrincipalName( |
| 910 | nameString=[ |
| 911 | ASN1_GENERAL_STRING(b"krbtgt"), |
| 912 | decTkt.crealm, |
| 913 | ], |
| 914 | nameType=ASN1_INTEGER(2), # NT-SRV-INST |
| 915 | ), |
| 916 | encPart=EncryptedData( |
| 917 | etype=etype, |
| 918 | ), |
| 919 | ) |
| 920 | ) |
| 921 | self.ccache.credentials.append(cred) |
| 922 | self.update_ticket( |
| 923 | len(self.ccache.credentials) - 1, |
| 924 | decTkt, |
| 925 | resign=True, |
| 926 | hash=hash, |
| 927 | kdc_hash=kdc_hash, |
| 928 | ) |
| 929 | |
| 930 | def create_ticket(self, **kwargs): |
| 931 | """ |
no test coverage detected