diff --git a/nxc/connection.py b/nxc/connection.py index 3c9b0843..c414c077 100755 --- a/nxc/connection.py +++ b/nxc/connection.py @@ -19,6 +19,7 @@ from nxc.protocols.ldap.laps import laps_search from nxc.helpers.pfx import pfx_auth from impacket.dcerpc.v5 import transport +from impacket.krb5.ccache import CCache sem = BoundedSemaphore(1) global_failed_logins = 0 @@ -542,11 +543,13 @@ class connection: data.extend(parsed_data) if self.args.use_kcache: + ccache = CCache.parseFile() self.logger.debug("Trying to authenticate using Kerberos cache") with sem: username = self.args.username[0] if len(self.args.username) else "" password = self.args.password[0] if len(self.args.password) else "" - self.kerberos_login(self.domain, username, password, "", "", self.kdcHost, True) + domain = ccache[0] + self.kerberos_login(domain, username, password, "", "", self.kdcHost, True) self.logger.info("Successfully authenticated using Kerberos cache") return True