Advertisement
Guest User

Untitled

a guest
Mar 8th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.77 KB | None | 0 0
  1. Erst wird die funktion "sshconnect()" ausgeführt um sich einzuloggen.
  2. Danach wird versucht in der function "shwPrt()" ein Befejl abzusetzen.
  3. Folgender Fehler:
  4. --------------------
  5. Traceback (most recent call last):
  6.   File "main.py", line 179, in <module>
  7.     main_menu()
  8.   File "main.py", line 43, in main_menu
  9.     exec_menu(choice)
  10.   File "main.py", line 54, in exec_menu
  11.     menu_actions[ch]()
  12.   File "main.py", line 80, in shwPrt
  13.     SSH.sendline("configure system clock domain 1 source 1")
  14. AttributeError: 'str' object has no attribute 'sendline'
  15.  
  16.  
  17. -----------------------------------------------
  18. # Show Port Status
  19. def shwPrt():
  20.     SSH.sendline("configure system clock domain 1 source 1")
  21.     SSH.sendline("show status")
  22.     SSH.prompt()
  23.     OUTPUT = SSH.before
  24.     exec_menu(choice)
  25.  
  26. def sshconnect ()
  27.     os.system('clear')
  28.     SSH = pxssh.pxssh()
  29.     USER = "su"
  30.    
  31.     while True:
  32.         try:
  33.             PASS = PASS1
  34.             print "Logging in...\n"
  35.             SSH.login(IP, USER, PASS, auto_prompt_reset=False)
  36.             break
  37.         except:
  38.             print "Trying another Password..."
  39.             PASS = PASS2
  40.             SSH.login(IP, USER, PASS, auto_prompt_reset=False)
  41.             print "The Password was %s. this should not be! Consider changing at as soon as possible!\n" % PASS
  42.             break
  43.    
  44.             try:
  45.                 PASS = PASS3
  46.                 print "Trying another Password..."
  47.                 SSH.login(IP, USER, PASS, auto_prompt_reset=False)
  48.                 print "The Password was %s. this should not be! Consider changing at as soon as possible!\n" % PASS
  49.                 break
  50.             except:
  51.                 PASS = PASS4
  52.                 print "Trying another Password. This is the last try!"
  53.                 SSH.login(IP, USER, PASS, auto_prompt_reset=False)
  54.                 print "The Password was %s. this should not be! Consider changing at as soon as possible!\n" % PASS
  55.                 break
  56.     SSH.PROMPT = ".*?(#) $"             #Alternative: "(#) $"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement