adam100

Untitled

May 16th, 2012
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. import pexpect
  2.  
  3. SERVER = { 1: 'server1',
  4. 2: 'server2',
  5. 3: 'server3',
  6. etc }
  7. for key in sorted(SERVER):
  8. print key, SERVER[key]
  9.  
  10. CHOICE = int(input("Type in server number: "))
  11. HOST = SERVER[CHOICE]
  12. USER="username"
  13. PASS="password"
  14. COMMAND="ssh -vNCD 23333 USER@HOST"
  15.  
  16. child = pexpect.spawn(COMMAND)
  17. child.expect('Password:')
  18. child.sendline(PASS)
  19. child.interact()
Advertisement
Add Comment
Please, Sign In to add comment