This is also a problem with valid ssh2 ecdsa keys, paramiko does not support them. Since I have a lot of new installations where ecdsa is the default this makes the lens not so useful. Since there's no estimate on when paramiko will support these key types I put together a function that parses a known_hosts file:
def parse_known_hosts(infile):
hosts = []
try:
f = open(infile)
except IOError:
return hosts
for line in f:
fields = line.split(' ')
if len(fields) < 3: continue
names = fields[0].split(',')
hosts = hosts + names
f.close()
return hosts
It's works pretty much the same as the parsing in paramiko but it supports any key type. Feel free to include it in the lens.
This is also a problem with valid ssh2 ecdsa keys, paramiko does not support them. Since I have a lot of new installations where ecdsa is the default this makes the lens not so useful. Since there's no estimate on when paramiko will support these key types I put together a function that parses a known_hosts file:
def parse_known_ hosts(infile) :
continue 0].split( ',')
hosts = []
try:
f = open(infile)
except IOError:
return hosts
for line in f:
fields = line.split(' ')
if len(fields) < 3:
names = fields[
hosts = hosts + names
f.close()
return hosts
It's works pretty much the same as the parsing in paramiko but it supports any key type. Feel free to include it in the lens.