Last active
December 17, 2015 15:09
-
-
Save typhonius/5629619 to your computer and use it in GitHub Desktop.
Quick snippet to convert public key signatures from an authorized_keys file into their ssh fingerprint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Quick snippet to convert public key signatures from an authorized_keys file into their ssh fingerprint | |
# Usage: python fingerprint_conversion.py authorized_keys | |
import base64,hashlib,sys | |
line = sys.argv[1] | |
f = open(line, 'r') | |
for key in f: | |
key = str(key.strip().split()[1]) | |
k = base64.b64decode(key + '=' * (-len(key) % 4)) | |
fp_plain = hashlib.md5(k).hexdigest() | |
print ':'.join(a+b for a,b in zip(fp_plain[::2], fp_plain[1::2])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment