Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pexpect
- from pexpect import pxssh
- from time import sleep
- m_localhost ='########'
- username='######'
- password='###########'
- try:
- try:
- child=pexpect.spawn('ssh %s@%s' %(username,m_localhost))
- #if verbose:
- # child.logfile=sys.stdout
- #child.timeout=5
- child.expect('User: ')
- child.sendline(username)
- child.expect('Password:')
- except Exception as e:
- print(e)
- child.sendline(password)
- print("PASSWORD SENTTTTTTT")
- child.expect('>')
- #sleep(0.1)
- #print("Expecting a command for Cisco")
- child.sendline('config paging disablen')
- print('Disabled')
- child.expect('>')
- alldata=child.sendline('show ap summary')
- #print(child.after)
- except Exception as e:
- print(e)
- print("IN")
- print('---------')
- print(alldata)
Add Comment
Please, Sign In to add comment