Skip to content

Instantly share code, notes, and snippets.

@maxtaco
maxtaco / gist:5080023
Last active December 14, 2015 11:38
Access hashed ssh known_hosts with paramiko.
import os.path
import paramiko
from hashlib import sha1
from hmac import HMAC
class KnownHostsRegistry (object):
"""
Read in the user's SSH known_hosts file, and perform lookups,
on either plaintext hostnames, or those that have been obscured
with known_hosts hashing (see here: http://nms.csail.mit.edu/projects/ssh/)