I mean this if statement. Can I check what exception the e is? Is it like with checking string or trying to check it with paramiko/socket exceptions?
try:
ssh.connect(hosts[index], ports[index], login, ssh_key, timeout=3)
print(f'connected = {connected}')
return True
except Exception as e:
if e == paramiko.AuthenticationException:
print(f'[SSH] connected = {connected}. \nerror = {str(e)}')
print('[SSH] bad auth')
ssh_config.check_ssh(1)
return False
return False