From 1b81e3fa41051e24af34b19ce195c14e2778f30b Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 11 Mar 2004 23:19:16 +0000 Subject: [PATCH] This versin has -h working. --- ssh-installkeys | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/ssh-installkeys b/ssh-installkeys index df83270..9efbf66 100755 --- a/ssh-installkeys +++ b/ssh-installkeys @@ -14,7 +14,7 @@ Options: Author: Eric S. Raymond """ -# $Id: ssh-installkeys,v 1.15 2003/12/30 17:15:58 esr Exp esr $ +# $Id: ssh-installkeys,v 1.16 2004/01/08 05:47:07 esr Exp esr $ import os, sys, getopt, string, getpass, tempfile @@ -63,7 +63,7 @@ A critical module was not found. Probably this OS does not support it. Currently pexpect is intended for UNIX operating systems (including OS-X).""" __version__ = '0.94' -__revision__ = '$Revision: 1.15 $' +__revision__ = '$Revision: 1.16 $' __all__ = ['ExceptionPexpect', 'EOF', 'TIMEOUT', 'spawn', '__version__', '__revision__'] @@ -577,17 +577,20 @@ class ssh_session: sys.stderr.write("-> " + command + "\n") while True: seen=child.expect([EOF,'assword:','continue connecting (yes/no)?']) + if self.verbose: + sys.stderr.write("<- " + child.before + "\n") if seen == 0: break elif seen == 1: + if self.verbose: + sys.stderr.write("Saw password prompt...\n") if not self.password: self.password = getpass.getpass('Remote password: ') child.sendline(self.password) - seen = child.expect(EOF) elif seen == 2: + if self.verbose: + sys.stderr.write("Saw 'continue connecting' prompt...\n") child.sendline("yes") - if self.verbose: - sys.stderr.write("<- " + child.before + "\n") return child.before def ssh(self, command): return self.__exec("ssh -l %s %s \"%s\""%(self.user,self.host,command)) @@ -596,6 +599,8 @@ class ssh_session: def exists(self, file): "Retrieve file permissions of specified remote file." seen = self.ssh("/bin/ls -ld %s" % file) + if self.verbose: + sys.stderr.write("Existence check on %s gave %s\n" % (file,`seen`)) if string.find(seen, "No such file") > -1: return None # File doesn't exist else: @@ -654,7 +659,7 @@ if __name__ == '__main__': if not arguments: print "No remote host specified." - print __doc__ % login + print __doc__ raise SystemExit, 0 else: host = arguments[0] @@ -694,7 +699,7 @@ if __name__ == '__main__': die("Try re-running this script without the check-only option.") public_keys = [] for (keytype, file) in (("rsa1", "identity"), ("dsa", "id_dsa")): - print "About to generate a %s key. You will be prompted for a passphrase," + print "About to generate a %s key. You will be prompted for a passphrase," % keytype print "Pressing enter at that prompt will create a key with no passphrase" os.system("ssh-keygen -t %s -f %s" % (keytype, file)) public_keys.append(file + ".pub") -- 2.43.0