Skip to content

Commit 059d241

Browse files
committed
Restrict returning true on STATUS_PASSWORD_MUST_CHANGE to only the module
1 parent bc712c8 commit 059d241

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

nxc/protocols/smb.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,6 @@ def kerberos_login(self, domain, username, password="", ntlm_hash="", aesKey="",
453453
)
454454
if error not in smb_error_status:
455455
self.inc_failed_login(username)
456-
return False
457456
return False
458457

459458
def plaintext_login(self, domain, username, password):
@@ -498,7 +497,7 @@ def plaintext_login(self, domain, username, password):
498497
f'{domain}\\{self.username}:{process_secret(self.password)} {error} {f"({desc})" if self.args.verbose else ""}',
499498
color="magenta" if error in smb_error_status else "red",
500499
)
501-
if str(error) == "STATUS_PASSWORD_MUST_CHANGE" or "STATUS_PASSWORD_EXPIRED":
500+
if error in ["STATUS_PASSWORD_MUST_CHANGE", "STATUS_PASSWORD_EXPIRED"] and self.args.module == ["change-password"]:
502501
return True
503502
if error not in smb_error_status:
504503
self.inc_failed_login(username)
@@ -562,7 +561,7 @@ def hash_login(self, domain, username, ntlm_hash):
562561
f"{domain}\\{self.username}:{process_secret(self.hash)} {error} {f'({desc})' if self.args.verbose else ''}",
563562
color="magenta" if error in smb_error_status else "red",
564563
)
565-
if str(error) == "STATUS_PASSWORD_MUST_CHANGE" or "STATUS_PASSWORD_EXPIRED":
564+
if error in ["STATUS_PASSWORD_MUST_CHANGE", "STATUS_PASSWORD_EXPIRED"] and self.args.module == ["change-password"]:
566565
return True
567566
if error not in smb_error_status:
568567
self.inc_failed_login(self.username)

0 commit comments

Comments
 (0)