X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=contrib%2Fkh2reg.py;h=4872aec80fd25be3d7338df78bb393038db30866;hb=afa871e3cfc82eb6b92b02fd1dad094c5d1949f2;hp=279834c55ae7b7339773d841dfc56e849be95322;hpb=5aa719d16e1f6c9f2a47f0cd562abc522a8fbb0c;p=PuTTY.git 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), ',')