Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pexpect
- SERVER = { 1: 'server1',
- 2: 'server2',
- 3: 'server3',
- etc }
- for key in sorted(SERVER):
- print key, SERVER[key]
- CHOICE = int(input("Type in server number: "))
- HOST = SERVER[CHOICE]
- USER="username"
- PASS="password"
- COMMAND="ssh -vNCD 23333 USER@HOST"
- child = pexpect.spawn(COMMAND)
- child.expect('Password:')
- child.sendline(PASS)
- child.interact()
Advertisement
Add Comment
Please, Sign In to add comment