File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -215,6 +215,7 @@ def enum_host_info(self):
215215 if "STATUS_NOT_SUPPORTED" in str (e ):
216216 # no ntlm supported
217217 self .no_ntlm = True
218+ self .logger .debug ("NTLM not supported" )
218219
219220 # self.domain is the attribute we authenticate with
220221 # self.targetDomain is the attribute which gets displayed as host domain
@@ -224,8 +225,20 @@ def enum_host_info(self):
224225 if not self .targetDomain : # Not sure if that can even happen but now we are safe
225226 self .targetDomain = self .hostname
226227 else :
227- self .hostname = self .host .split ("." )[0 ]
228- self .targetDomain = self .hostname
228+ # If we can't authenticate with NTLM and the target is supplied as a FQDN we must parse it
229+ try :
230+ import socket
231+ socket .inet_aton (self .host )
232+ self .logger .fail ("NTLM authentication not available! Authentication will fail without a valid hostname and domain name" )
233+ self .hostname = self .host
234+ self .targetDomain = self .host
235+ except OSError :
236+ if self .host .count ("." ) >= 1 :
237+ self .hostname = self .host .split ("." )[0 ]
238+ self .targetDomain = "." .join (self .host .split ("." )[1 :])
239+ else :
240+ self .hostname = self .host
241+ self .targetDomain = self .host
229242
230243 self .domain = self .targetDomain if not self .args .domain else self .args .domain
231244
You can’t perform that action at this time.
0 commit comments