File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -314,8 +314,18 @@ def print_host_info(self):
314314 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 } )" )
315315
316316 if self .args .generate_hosts_file :
317+ from impacket .dcerpc .v5 import nrpc , epm
318+ self .logger .debug ("Performing authentication attempts..." )
319+ isdc = False
320+ try :
321+ epm .hept_map (self .host , nrpc .MSRPC_UUID_NRPC , protocol = "ncacn_ip_tcp" )
322+ isdc = True
323+ except DCERPCException :
324+ self .logger .debug ("Error while connecting to host: DCERPCException, which means this is probably not a DC!" )
325+
317326 with open (self .args .generate_hosts_file , "a+" ) as host_file :
318- host_file .write (f"{ self .host } { self .hostname } { self .hostname } .{ self .targetDomain } \n " )
327+ host_file .write (f"{ self .host } { self .hostname } { self .hostname } .{ self .targetDomain } { self .targetDomain if isdc else '' } \n " )
328+ self .logger .debug (f"{ self .host } { self .hostname } { self .hostname } .{ self .targetDomain } { self .targetDomain if isdc else '' } " )
319329
320330 return self .host , self .hostname , self .targetDomain
321331
You can’t perform that action at this time.
0 commit comments