From a416cec4bb4b6576f009220ea437aefb85ef39d7 Mon Sep 17 00:00:00 2001 From: Alexander Neff Date: Thu, 26 Oct 2023 21:03:49 +0200 Subject: [PATCH] Convert one-liner into multi-liner for readability --- nxc/protocols/ldap/kerberos.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nxc/protocols/ldap/kerberos.py b/nxc/protocols/ldap/kerberos.py index 315ec882..371e5f38 100644 --- a/nxc/protocols/ldap/kerberos.py +++ b/nxc/protocols/ldap/kerberos.py @@ -243,4 +243,9 @@ class KerberosAttacks: return None # Let's output the TGT enc-part/cipher in Hashcat format, in case somebody wants to use it. - return "$krb5asrep$%d$%s@%s:%s$%s" % (as_rep["enc-part"]["etype"], client_name, domain, hexlify(as_rep["enc-part"]["cipher"].asOctets()[:12]).decode(), hexlify(as_rep["enc-part"]["cipher"].asOctets()[12:]).decode()) if as_rep["enc-part"]["etype"] == 17 or as_rep["enc-part"]["etype"] == 18 else "$krb5asrep$%d$%s@%s:%s$%s" % (as_rep["enc-part"]["etype"], client_name, domain, hexlify(as_rep["enc-part"]["cipher"].asOctets()[:16]).decode(), hexlify(as_rep["enc-part"]["cipher"].asOctets()[16:]).decode()) + hash_tgt = f"$krb5asrep${as_rep['enc-part']['etype']}${client_name}@{domain}:" + if as_rep["enc-part"]["etype"] in (17, 18): + hash_tgt += f"{hexlify(as_rep['enc-part']['cipher'].asOctets()[:12]).decode()}${hexlify(as_rep['enc-part']['cipher'].asOctets()[12:]).decode()}" + else: + hash_tgt += f"{hexlify(as_rep['enc-part']['cipher'].asOctets()[:16]).decode()}${hexlify(as_rep['enc-part']['cipher'].asOctets()[16:]).decode()}" + return hash_tgt