X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/2e85c969d67eb14a07314802d4ac5dd63eef660b..HEAD:/contrib/kh2reg.py diff --git a/contrib/kh2reg.py b/contrib/kh2reg.py index 279834c5..4872aec8 100755 --- a/contrib/kh2reg.py +++ b/contrib/kh2reg.py @@ -128,10 +128,17 @@ for line in fileinput.input(args): sys.stderr.write("Skipping wildcard host pattern '%s'\n" % host) continue + elif re.match (r"\|", host): + sys.stderr.write("Skipping hashed hostname '%s'\n" % host) + continue else: - # Slightly bizarre key format: 'type@port:hostname' - # As far as I know, the input never specifies a port. - port = 22 + m = re.match (r"\[([^]]*)\]:(\d*)$", host) + if m: + (host, port) = m.group(1,2) + port = int(port) + else: + port = 22 + # Slightly bizarre output key format: 'type@port:hostname' # XXX: does PuTTY do anything useful with literal IP[v4]s? key = keytype + ("@%d:%s" % (port, host)) value = string.join (map (longtohex, magicnumbers), ',')