]> thyrsus.com Git - ssh-installkeys.git/commitdiff
This versin has -h working.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 11 Mar 2004 23:19:16 +0000 (23:19 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 11 Mar 2004 23:19:16 +0000 (23:19 +0000)
ssh-installkeys

index df832702f70ae7f507f02183d280fb819a223418..9efbf66c19a918bcb3ad3d678fe189738b67ecab 100755 (executable)
@@ -14,7 +14,7 @@ Options:
 
 Author: Eric S. Raymond <esr@thyrsus.com>"""
 
-# $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")