@@ -43,7 +43,12 @@ def __init__(self, max_connections_per_host: int = 8):
4343 self ._lock = Lock ()
4444
4545 def get_connection (
46- self , host : str , options : argparse .Namespace , config : Config , logger : Logger
46+ self ,
47+ host : str ,
48+ remote_name : str ,
49+ options : argparse .Namespace ,
50+ config : Config ,
51+ logger : Logger ,
4752 ) -> Optional [SMBSession ]:
4853 """Get an available connection for the host, creating one if needed."""
4954 with self ._lock :
@@ -58,23 +63,23 @@ def get_connection(
5863 connection .close_smb_session ()
5964 except Exception :
6065 pass
61-
6266 # Create new connection
6367 credentials = Credentials (
6468 domain = options .auth_domain ,
6569 username = options .auth_user ,
6670 password = options .auth_password ,
6771 hashes = options .auth_hashes ,
68- use_kerberos = False ,
69- aesKey = None ,
70- kdcHost = None ,
72+ use_kerberos = options . use_kerberos ,
73+ aesKey = options . auth_key ,
74+ kdcHost = options . kdc_host ,
7175 )
7276
7377 smb_session = SMBSession (
7478 host = host ,
7579 port = 445 ,
7680 timeout = 10 ,
7781 credentials = credentials ,
82+ remote_name = remote_name ,
7883 advertisedName = options .advertised_name ,
7984 config = config ,
8085 logger = logger ,
@@ -137,6 +142,7 @@ def process_share_task(
137142 share_name : str ,
138143 share_data : dict ,
139144 host : str ,
145+ remote_name : str ,
140146 options : argparse .Namespace ,
141147 config : Config ,
142148 graph : OpenGraph ,
@@ -157,12 +163,14 @@ def process_share_task(
157163 """
158164
159165 # Create a task-specific logger for this share
160- task_logger = TaskLogger (base_logger = logger , task_id = f"{ host } :{ share_name } " )
166+ task_logger = TaskLogger (base_logger = logger , task_id = f"{ remote_name } :{ share_name } " )
161167
162168 def _process_share ():
163169 with host_semaphore : # Limit concurrency per host
164170 # Get connection from pool
165- smb_session = connection_pool .get_connection (host , options , config , logger )
171+ smb_session = connection_pool .get_connection (
172+ host , remote_name , options , config , logger
173+ )
166174 if not smb_session :
167175 task_logger .debug (f"Failed to get connection for host { host } " )
168176 return (0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 )
@@ -310,7 +318,9 @@ def multithreaded_share_worker(
310318
311319 try :
312320 target_type = target [0 ]
313- target_ip = target [1 ]
321+ target_value = target [1 ]
322+ remote_name = target_value
323+ target_ip = target_value
314324
315325 logger = Logger (config = config , logfile = options .logfile )
316326
@@ -351,7 +361,7 @@ def multithreaded_share_worker(
351361
352362 # Get initial connection to discover shares
353363 initial_connection = connection_pool .get_connection (
354- target_ip , options , config , logger
364+ target_ip , remote_name , options , config , logger
355365 )
356366 if not initial_connection :
357367 logger .debug ("Failed to initialize SMB session" )
@@ -390,6 +400,7 @@ def multithreaded_share_worker(
390400 share_name ,
391401 share_data ,
392402 target_ip ,
403+ remote_name ,
393404 options ,
394405 config ,
395406 graph ,
0 commit comments