Skip to content

Commit 4cb4978

Browse files
committed
Switch if logic
1 parent 6ada3ea commit 4cb4978

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

nxc/protocols/mssql.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,17 @@ def enum_host_info(self):
136136
self.logger.info(f"Failed to receive NTLM challenge, reason: {e!s}")
137137
return False
138138
else:
139-
if not challenge.startswith(b"NTLMSSP\x00"):
140-
error_msg = login7_integrated_auth_error_message(login_response, challenge)
141-
detail = f": {error_msg}" if error_msg else ""
142-
self.logger.fail(f"Server does not support Integrated Windows Authentication{detail}")
143-
else:
139+
print(challenge)
140+
if challenge.startswith(b"NTLMSSP\x00"):
144141
ntlm_info = parse_challenge(challenge)
145142
self.targetDomain = self.domain = ntlm_info["domain"]
146143
self.hostname = ntlm_info["hostname"]
147144
self.server_os = ntlm_info["os_version"]
148145
self.logger.extra["hostname"] = self.hostname
146+
else:
147+
error_msg = login7_integrated_auth_error_message(login_response, challenge)
148+
detail = f": {error_msg}" if error_msg else ""
149+
self.logger.fail(f"Server does not support Integrated Windows Authentication{detail}")
149150

150151
self.db.add_host(self.host, self.hostname, self.domain, self.server_os, len(self.mssql_instances))
151152

0 commit comments

Comments
 (0)