update f-strings

This commit is contained in:
Marshall Hallenbeck
2023-04-22 13:48:07 -04:00
parent 88aeb3c04c
commit 6da074e73b
2 changed files with 13 additions and 9 deletions
+6 -6
View File
@@ -326,7 +326,7 @@ class ldap(connection):
self.logger.extra["protocol"] = "SMB" if not self.no_ntlm else "LDAP"
self.logger.extra["port"] = "445" if not self.no_ntlm else "389"
self.logger.display(
f"{self.server_os}{' x{}'.format(self.os_arch) if self.os_arch else ''} (name:{self.hostname}) (domain:{self.domain}) (signing:{self.signing}) (SMBv1:{self.smbv1})"
f"{self.server_os}{f' x{self.os_arch}' if self.os_arch else ''} (name:{self.hostname}) (domain:{self.domain}) (signing:{self.signing}) (SMBv1:{self.smbv1})"
)
self.logger.extra["protocol"] = "LDAP"
# self.logger.display(self.endpoint)
@@ -449,7 +449,7 @@ class ldap(connection):
self.check_if_admin()
# Prepare success credential text
out = f"{domain}\\{self.username} {highlight('({})'.format(self.config.get('CME', 'pwn3d_label')) if self.admin_privs else '')}"
out = f"{domain}\\{self.username} {highlight(f'({self.config.get("CME", "pwn3d_label")})' if self.admin_privs else '')}"
self.logger.extra["protocol"] = "LDAPS"
self.logger.extra["port"] = "636"
@@ -504,7 +504,7 @@ class ldap(connection):
self.check_if_admin()
# Prepare success credential text
out = f"{domain}\\{self.username}:{self.password if not self.config.get('CME', 'audit_mode') else self.config.get('CME', 'audit_mode') * 8} {highlight('({})'.format(self.config.get('CME', 'pwn3d_label')) if self.admin_privs else '')}"
out = f"{domain}\\{self.username}:{self.password if not self.config.get('CME', 'audit_mode') else self.config.get('CME', 'audit_mode') * 8} {highlight(f'({self.config.get("CME", "pwn3d_label")})' if self.admin_privs else '')}"
self.logger.extra["protocol"] = "LDAP"
self.logger.extra["port"] = "636" if (self.args.gmsa or self.args.port == 636) else "389"
@@ -526,7 +526,7 @@ class ldap(connection):
self.check_if_admin()
# Prepare success credential text
out = f"{domain}\\{self.username}:{self.password if not self.config.get('CME', 'audit_mode') else self.config.get('CME', 'audit_mode') * 8} {highlight('({})'.format(self.config.get('CME', 'pwn3d_label')) if self.admin_privs else '')}"
out = f"{domain}\\{self.username}:{self.password if not self.config.get('CME', 'audit_mode') else self.config.get('CME', 'audit_mode') * 8} {highlight(f'({self.config.get("CME", "pwn3d_label")})' if self.admin_privs else '')}"
self.logger.extra["protocol"] = "LDAPS"
self.logger.extra["port"] = "636"
self.logger.success(out)
@@ -593,7 +593,7 @@ class ldap(connection):
self.check_if_admin()
# Prepare success credential text
out = f"{domain}\\{self.username}:{self.nthash if not self.config.get('CME', 'audit_mode') else self.config.get('CME', 'audit_mode') * 8} {highlight('({})'.format(self.config.get('CME', 'pwn3d_label')) if self.admin_privs else '')}"
out = f"{domain}\\{self.username}:{self.nthash if not self.config.get('CME', 'audit_mode') else self.config.get('CME', 'audit_mode') * 8} {highlight(f'({self.config.get("CME", "pwn3d_label")})' if self.admin_privs else '')}"
self.logger.extra["protocol"] = "LDAP"
self.logger.extra["port"] = "636" if (self.args.gmsa or self.args.port == 636) else "389"
self.logger.success(out)
@@ -613,7 +613,7 @@ class ldap(connection):
self.check_if_admin()
# Prepare success credential text
out = f"{domain}\\{self.username}:{self.nthash if not self.config.get('CME', 'audit_mode') else self.config.get('CME', 'audit_mode') * 8} {highlight('({})'.format(self.config.get('CME', 'pwn3d_label')) if self.admin_privs else '')}"
out = f"{domain}\\{self.username}:{self.nthash if not self.config.get('CME', 'audit_mode') else self.config.get('CME', 'audit_mode') * 8} {highlight(f'({self.config.get("CME", "pwn3d_label")})' if self.admin_privs else '')}"
self.logger.extra["protocol"] = "LDAPS"
self.logger.extra["port"] = "636"
self.logger.success(out)
+7 -3
View File
@@ -403,9 +403,11 @@ class smb(connection):
msMCSAdmPwd = values['ms-mcs-admpwd']
else:
self.logger.fail("No result found with attribute ms-MCS-AdmPwd or msLAPS-Password")
logging.debug("Host: {:<20} Password: {} {}".format(sAMAccountName, msMCSAdmPwd, self.hostname))
logging.debug(f"Host: {sAMAccountName:<20} Password: {msMCSAdmPwd} {self.hostname}")
else:
self.logger.fail('msMCSAdmPwd or msLAPS-Password is empty or account cannot read LAPS property for {}'.format(self.hostname))
self.logger.fail(
f'msMCSAdmPwd or msLAPS-Password is empty or account cannot read LAPS property for {self.hostname}'
)
return False
@@ -413,7 +415,9 @@ class smb(connection):
self.password = msMCSAdmPwd
if msMCSAdmPwd == '':
self.logger.fail('msMCSAdmPwd or msLAPS-Password is empty or account cannot read LAPS property for {}'.format(self.hostname))
self.logger.fail(
f'msMCSAdmPwd or msLAPS-Password is empty or account cannot read LAPS property for {self.hostname}'
)
return False
if ntlm_hash: