Skip to content

Commit f51459d

Browse files
authored
Refactor is_host_dc calls based on NTLM check
Signed-off-by: mpgn <5891788+mpgn@users.noreply.github.com>
1 parent df26b69 commit f51459d

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

nxc/protocols/smb.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,6 @@ def get_os_arch(self):
167167

168168
def enum_host_info(self):
169169
self.local_ip = self.conn.getSMBServer().get_socket().getsockname()[0]
170-
if self.args.generate_hosts_file or self.args.generate_krb5_file:
171-
self.is_host_dc()
172170

173171
try:
174172
self.conn.login("", "")
@@ -199,8 +197,7 @@ def enum_host_info(self):
199197
self.targetDomain = self.hostname
200198
else:
201199
try:
202-
if not (self.args.generate_hosts_file or self.args.generate_krb5_file):
203-
self.is_host_dc()
200+
self.is_host_dc()
204201
# If we know the host is a DC we can still get the hostname over LDAP if NTLM is not available
205202
if self.isdc and detect_if_ip(self.host):
206203
self.hostname, self.domain = LDAPResolution(self.host).get_resolution()
@@ -302,6 +299,9 @@ def print_host_info(self):
302299
self.logger.display(f"{self.server_os}{f' x{self.os_arch}' if self.os_arch else ''} (name:{self.hostname}) (domain:{self.targetDomain}) ({signing}) ({smbv1}){ntlm}{null_auth}{guest}")
303300

304301
if self.args.generate_hosts_file or self.args.generate_krb5_file:
302+
# don't call is_host_dc if no ntlm since already call in the enum
303+
if not self.no_ntlm:
304+
self.is_host_dc()
305305
if self.args.generate_hosts_file:
306306
with open(self.args.generate_hosts_file, "a+") as host_file:
307307
dc_part = f" {self.targetDomain}" if self.isdc else ""

0 commit comments

Comments
 (0)