Skip to content

Commit 0983df9

Browse files
fix: fix hash length since its 32/64 (not 16) and we need to consider the colon between NTLM hashes
1 parent bd86201 commit 0983df9

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

nxc/connection.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -413,14 +413,15 @@ def parse_credentials(self):
413413
if isfile(ntlm_hash):
414414
with open(ntlm_hash) as ntlm_hash_file:
415415
for i, line in enumerate(ntlm_hash_file):
416-
if len(line) != 16 and len(line) != 32:
417-
self.logger.fail(f"Invalid NTLM hash length on line {i + 1}: {line}")
416+
line = line.strip()
417+
if len(line) != 32 and len(line) != 65:
418+
self.logger.fail(f"Invalid NTLM hash length on line {(i + 1)} (len {len(line)}): {line}")
418419
continue
419420
else:
420-
secret.append(line.strip())
421+
secret.append(line)
421422
cred_type.append("hash")
422423
else:
423-
if len(ntlm_hash) != 16 and len(ntlm_hash) != 32:
424+
if len(ntlm_hash) != 32 and len(ntlm_hash) != 65:
424425
self.logger.fail(f"Invalid NTLM hash length {len(ntlm_hash)}, authentication not sent")
425426
exit(1)
426427
else:

0 commit comments

Comments
 (0)