Advertisement
Guest User

Untitled

a guest
Feb 18th, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.41 KB | None | 0 0
  1. import paramiko, time
  2.  
  3.  
  4. hostname = "10.104.1.50"
  5. username = "admin"
  6. password = "123"
  7. port = 22
  8.  
  9. command = "copy boot screen voip"
  10. countries = ["argentina", "australia", "austria", "bahrain", "belgium", "brazil", "bulgaria", "canada", "chile", "china", "czechrepublic", "denmark", "finland", "france", "germany", "greece", "hongkong", "hungary", "iceland", "india", "ireland", "israel", "italy", "japan", "kuwait", "latvia", "luxembourg", "macao", "malaysia", "mexico", "netherlands", "newzealand", "norway", "peru", "poland", "portugal", "romania", "russia", "saudiarabia", "singapore", "slovakia", "slovenia", "southafrica", "southkorea", "spain", "sweden", "switzerland", "taiwan", "thailand", "uae", "uk", "usa"]
  11.  
  12.  
  13. try:
  14.     client = paramiko.SSHClient()
  15.     #client.load_host_keys()
  16.     client.set_missing_host_key_policy(paramiko.WarningPolicy())
  17.  
  18.     for country in countries:
  19.  
  20.         client.connect(hostname, port, username, password)
  21.  
  22.         chan = client.invoke_shell()
  23.         print("Country: " + country)
  24.         chan.sendall('voip id 1 country %s\r' % country)
  25.         chan.sendall('copy progress boot\r')
  26.         #s = chan.recv(4096)
  27.         #print(s)
  28.         time.sleep(3)
  29.         client.close()
  30.  
  31.         client.connect(hostname, port, username, password)
  32.         cstdin, stdout, stderr = client.exec_command("copy boot screen voip")
  33.         print(stdout.read())
  34.  
  35. finally:
  36.     client.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement