Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HOST= 'server.name.com.br'
- try:
- s = pxssh.pxssh()
- hostname = HOST
- username = 'root'
- password = 'xxxxxxx'
- s.login(hostname, username, password)
- s.sendline('bconsole') # run a command
- s.prompt() # match the prompt
- print(s.before) # print everything before the prompt.
- s.prompt() # match the prompt
- s.sendline('st') # run a command
- s.prompt() # match the prompt
- print(s.before) # print everything before the prompt.
- s.prompt() # match the prompt
- s.sendline('1') # run a command
- s.prompt() # match the prompt
- print(s.before) # print everything before the prompt.
- s.prompt() # match the prompt
- s.logout()
- except pxssh.ExceptionPxssh as e:
- print("pxssh failed on login.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement