python - Get host key of an ssh server in base 64 -


i'm using paramiko , need host key of ssh server in base 64 following line:

key = paramiko.rsakey(data=base64.decodestring('...')) 

does know of way either through mac os x terminal, in python script, or else find this? thanks

you can retrieve server's public key server itself, without having authenticate server.

import paramiko import socket import sys  arg in sys.argv[1:]:         sock = socket.socket()         sock.connect((arg, 22))         trans = paramiko.transport.transport(sock)         trans.start_client()         k = trans.get_remote_server_key()         # on machine, returns paramiko.rsakey         print k.get_base64() 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -