@@ -154,10 +154,7 @@ def get_os_arch(self):
154154 dce .set_auth_type (RPC_C_AUTHN_GSS_NEGOTIATE )
155155 dce .connect ()
156156 try :
157- dce .bind (
158- MSRPC_UUID_PORTMAP ,
159- transfer_syntax = ("71710533-BEBA-4937-8319-B5DBEF9CCC36" , "1.0" ),
160- )
157+ dce .bind (MSRPC_UUID_PORTMAP , transfer_syntax = ("71710533-BEBA-4937-8319-B5DBEF9CCC36" , "1.0" ))
161158 except DCERPCException as e :
162159 if str (e ).find ("syntaxes_not_supported" ) >= 0 :
163160 dce .disconnect ()
@@ -174,6 +171,10 @@ def enum_host_info(self):
174171 self .local_ip = self .conn .getSMBServer ().get_socket ().getsockname ()[0 ]
175172 self .is_host_dc ()
176173
174+ # Create SMBv1 connection to get host info, connection will be reinitiated on login
175+ if not self .args .no_smbv1 :
176+ self .smbv1 = self .create_smbv1_conn ()
177+
177178 try :
178179 self .conn .login ("" , "" )
179180 self .null_auth = True
@@ -274,10 +275,6 @@ def enum_host_info(self):
274275 except Exception as e :
275276 self .logger .debug (f"Error logging off system: { e } " )
276277
277- # Check smbv1
278- if not self .args .no_smbv1 :
279- self .smbv1 = self .create_smbv1_conn (check = True )
280-
281278 try :
282279 self .db .add_host (
283280 self .host ,
@@ -603,8 +600,6 @@ def create_conn_obj(self):
603600 Tries to create a connection object to the target host.
604601 On first try, it will try to create a SMBv3 connection.
605602 On further tries, it will remember which SMB version is supported and create a connection object accordingly.
606-
607- :param no_smbv1: If True, it will not try to create a SMBv1 connection
608603 """
609604 # Initial negotiation
610605 if self .smbv3 is None :
0 commit comments