Skip to content

Instantly share code, notes, and snippets.

@sivel
Created May 19, 2015 18:58
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sivel/afd29605b77914f616a3 to your computer and use it in GitHub Desktop.
Save sivel/afd29605b77914f616a3 to your computer and use it in GitHub Desktop.
Python Paramiko Keyscan
import paramiko
# provide host and port variables
t = paramiko.transport.Transport('%s:%s' % (host, port))
t.start_client()
key = t.get_remote_server_key()
if int(port) != 22:
host = '[%s]:%s' % (host, port)
print '%s %s %s' % (host, key.get_name(), key.get_base64())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment