Advertisement
Guest User

Untitled

a guest
Jan 11th, 2018
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. import subprocess
  2. import time
  3. import string
  4. import sys, paramiko
  5. import wifi
  6. from subprocess import check_output
  7.  
  8. #time.sleep(10)
  9. network = ("ELUXNET")
  10.  
  11. results = subprocess.check_output(["netsh", "wlan", "show", "network"])
  12.  
  13. results = results.decode("ascii")
  14. results = results.replace("\r","")
  15. ls = results.split("\n")
  16. ls = ls[4:]
  17. ssids = []
  18. out = []
  19. x = 0
  20. while x < len(ls):
  21. if x % 5 == 0:
  22. ssids.append(ls[x])
  23. x += 1
  24.  
  25. if network in ssids:
  26. out.append(time.asctime( time.localtime(time.time() )))
  27. out.append("Snoopy Access Point found")
  28. print(out)
  29. else:
  30. print(ssids)
  31.  
  32. hostname = "192.168.4.1"
  33. password = "elux"
  34. command = "ls"
  35.  
  36. username = "elux"
  37. port = 22
  38.  
  39. #try:
  40. # client = paramiko.SSHClient()
  41. # client.load_system_host_keys()
  42. # client.set_missing_host_key_policy(paramiko.WarningPolicy)
  43. #
  44. # client.connect(hostname, port=port, username=username, password=password)
  45. #
  46. # stdin, stdout, stderr = client.exec_command(command)
  47. # print stdout.read(),
  48. #
  49. #finally:
  50. # client.close()
  51.  
  52. def Search():
  53. wifilist = []
  54.  
  55. cells = wifi.Cell.all('wlan1')
  56.  
  57. for cell in cells:
  58. wifilist.append(cell)
  59.  
  60. return wifilist
  61.  
  62. print Search()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement