Skip to content

Instantly share code, notes, and snippets.

@MichalMazurek
Created October 11, 2019 10:15
Show Gist options
  • Save MichalMazurek/33dd1fac2087542d97d98b2e0e121ebd to your computer and use it in GitHub Desktop.
Save MichalMazurek/33dd1fac2087542d97d98b2e0e121ebd to your computer and use it in GitHub Desktop.
if not two_factor:
for key_filename in key_filenames:
for pkey_class in (RSAKey, DSSKey, ECDSAKey, Ed25519Key):
try:
key = self._key_from_filepath(
key_filename, pkey_class, passphrase
)
allowed_types = set(
self._transport.auth_publickey(username, key)
)
two_factor = allowed_types & two_factor_types
if not two_factor:
return
break
except SSHException as e:
saved_exception = e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment