Guest User

Untitled

a guest
Mar 11th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. # Python-Skript zum reconnecten eines samsung sl 3010
  2. # Usage: reconnect.py [host] [user] [password]
  3.  
  4. import getpass
  5. import sys
  6. import telnetlib
  7.  
  8. args = sys.argv
  9.  
  10. if len(args)>1:
  11. HOST = args[1]
  12. else:
  13. HOST = "samsung.router"
  14.  
  15. if len(args)>2:
  16. user = args[2]
  17. else:
  18. user = raw_input("Enter your remote account: ")
  19.  
  20. if len(args)>3:
  21. password = args[3]
  22. else:
  23. password = getpass.getpass()
  24.  
  25. port = 30023
  26.  
  27. command = "/etc/init.d/daily_reconnect.sh 1"
  28.  
  29. tn = telnetlib.Telnet(HOST, port)
  30.  
  31. tn.read_until("amazon login: ")
  32. tn.write(user + "\n")
  33.  
  34. tn.read_until("Password: ")
  35. tn.write(password + "\n")
  36.  
  37. tn.write(command + "\n")
  38. tn.write("exit\n")
  39.  
  40. print tn.read_all()
Add Comment
Please, Sign In to add comment