Advertisement
Guest User

Untitled

a guest
Dec 4th, 2016
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. import paramiko
  2. from getpass import getpass
  3. import time
  4.  
  5. ip = raw_input("Please enter device IP address: ")
  6. username = raw_input("Please enter your username: ")
  7. password = getpass()
  8.  
  9. remote_conn_pre=paramiko.SSHClient()
  10. remote_conn_pre.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  11. remote_conn_pre.connect(ip, port=22, username=username,password=password,look_for_keys=False, allow_agent=False)
  12.  
  13. remote_conn = remote_conn_pre.invoke_shell()
  14. output = remote_conn.recv(65535)
  15. print output
  16.  
  17.  
  18. # select the issue from below:
  19.  
  20. #1)Remote Access VPN
  21. #1.2) is it a cert issue-do you know the public ip of user
  22. #2)Site to Site VPN issue- please enter the public ip for vendor with issue
  23.  
  24.  
  25.  
  26. remote_conn.send('enablen')
  27. remote_conn.send(password + 'n')
  28. remote_conn.send("terminal length 0n")
  29. time.sleep(5)
  30. output = remote_conn.recv(65535)
  31. print output
  32.  
  33.  
  34.  
  35.  
  36. remote_conn.send("show aaa-servern")
  37. time.sleep(5)
  38. output = remote_conn.recv(65535)
  39. print output
  40.  
  41. remote_conn.send("exitn")
  42. time.sleep(5)
  43. output = remote_conn.recv(65535)
  44. print output
  45.  
  46. remote_conn.transport.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement