Skip to content

Commit 57b29bc

Browse files
committed
Simplify code
1 parent 0f810c9 commit 57b29bc

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

nxc/protocols/rdp.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def kerberos_login(self, domain, username, password="", ntlm_hash="", aesKey="",
269269
if word in str(e):
270270
reason = self.rdp_error_status[word]
271271
self.logger.fail(
272-
(f"{domain}\\{username}{' from ccache' if useCache else f':{process_secret(kerb_pass)}'} ({f'{reason}' if reason else str(e)})"),
272+
(f"{domain}\\{username}{' from ccache' if useCache else f':{process_secret(kerb_pass)}'} ({reason if reason else str(e)})"),
273273
color=("magenta" if ((reason or "CredSSP" in str(e)) and reason != "KDC_ERR_C_PRINCIPAL_UNKNOWN") else "red"),
274274
)
275275
elif "Authentication failed!" in str(e):
@@ -284,7 +284,7 @@ def kerberos_login(self, domain, username, password="", ntlm_hash="", aesKey="",
284284
if str(e) == "cannot unpack non-iterable NoneType object":
285285
reason = "User valid but cannot connect"
286286
self.logger.fail(
287-
(f"{domain}\\{username}{' from ccache' if useCache else f':{process_secret(kerb_pass)}'} ({f'{reason}' if reason else str(e)})"),
287+
(f"{domain}\\{username}{' from ccache' if useCache else f':{process_secret(kerb_pass)}'} ({reason if reason else str(e)})"),
288288
color=("magenta" if ((reason or "CredSSP" in str(e)) and reason != "STATUS_LOGON_FAILURE") else "red"),
289289
)
290290
return False
@@ -318,7 +318,7 @@ def plaintext_login(self, domain, username, password):
318318
if str(e) == "cannot unpack non-iterable NoneType object":
319319
reason = "User valid but cannot connect"
320320
self.logger.fail(
321-
(f"{domain}\\{username}:{process_secret(password)} ({f'{reason}' if reason else str(e)})"),
321+
(f"{domain}\\{username}:{process_secret(password)} ({reason if reason else str(e)})"),
322322
color=("magenta" if ((reason or "CredSSP" in str(e)) and reason != "STATUS_LOGON_FAILURE") else "red"),
323323
)
324324
return False
@@ -353,7 +353,7 @@ def hash_login(self, domain, username, ntlm_hash):
353353
reason = "User valid but cannot connect"
354354

355355
self.logger.fail(
356-
(f"{domain}\\{username}:{process_secret(ntlm_hash)} ({f'{reason}' if reason else str(e)})"),
356+
(f"{domain}\\{username}:{process_secret(ntlm_hash)} ({reason if reason else str(e)})"),
357357
color=("magenta" if ((reason or "CredSSP" in str(e)) and reason != "STATUS_LOGON_FAILURE") else "red"),
358358
)
359359
return False

0 commit comments

Comments
 (0)