__author__ = 'jenny'
import pexpect
ip="localhost"
user="jenny"
passwd="gaoxing"
if __name__=="__main__":
child = pexpect.spawn("ssh-keygen")
print child.expect("Enter file*")
child.sendline()
try:
child.expect("Overwrite*", timeout=3)
child.sendline()
except:
pass
print child.expect("Enter passphrase*")
child.sendline()
print child.expect("Enter same passphrase*")
child.sendline()