Fixing encoding error when using the symbol

main
Alex 2023-09-20 21:15:06 +02:00
parent 90e5e87a70
commit 7de9fccedb
1 changed files with 6 additions and 1 deletions

View File

@ -463,7 +463,12 @@ class smb(connection):
self.username = username self.username = username
self.domain = domain self.domain = domain
self.conn.login(self.username, self.password, domain) try:
self.conn.login(self.username, self.password, domain)
except UnicodeEncodeError:
self.logger.error(f"UnicodeEncodeError on: '{self.username}:{self.password}'. Trying again with a different encoding...")
self.create_conn_obj()
self.conn.login(self.username, self.password.encode().decode('latin-1'), domain)
self.check_if_admin() self.check_if_admin()
self.logger.debug(f"Adding credential: {domain}/{self.username}:{self.password}") self.logger.debug(f"Adding credential: {domain}/{self.username}:{self.password}")