Advertisement
Guest User

Untitled

a guest
Jan 8th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. import os
  2.  
  3.  
  4. def sis(dato):
  5. paso = os.popen(dato)
  6. dato2 = paso.readlines()
  7. return dato2
  8.  
  9.  
  10. def sisnom(dato1):
  11. paso1 = os.popen(dato1)
  12. dato5 = paso1.readlines()
  13. pc = dato5[0].split(" ")[-1].split("\n")[0]
  14. return pc
  15.  
  16.  
  17. def sred(dato2, x):
  18. red = dato2(9).split(" : ")[-1].split("\n")[0]
  19. infW = x + " name= " + red + " key=clear "
  20. w = os.popen(infW)
  21. r = w.readlines()
  22. return r
  23.  
  24. nom = "hostname"
  25. com = "netsh wlan show profile"
  26.  
  27. dw = sis(com)
  28. nom_pc = sisnom(nom)
  29.  
  30. num = len(dw) - 10
  31. i = 1
  32.  
  33. nom_fich = nom_pc + ".txt"
  34. fichero = open(nom_fich, "w")
  35.  
  36. while i <= num:
  37. com = "netsh wlan show profile"
  38. df = dw.pop(9).split(" : ")[-1].split("\n")[0]
  39. red = com + " name= " + df + " key=clear "
  40. w = os.popen(red)
  41. r = w.readlines()
  42. try:
  43. nomUsu = r[10].split(" : ")[-1].split("\n")[0]
  44. passUsu = r[32].split(" : ")[-1].split("\n")[0]
  45. passUs = r[30].split(" : ")[-1].split("\n")[0]
  46. infWf = "User: " + nomUsu
  47. infWf1 = " Pass: " + passUsu + " " + passUs
  48. esPa = "\n"
  49. es = infWf + " " + infWf1 + esPa
  50. fichero.writelines(es)
  51. except:
  52. print i
  53. print es
  54. i = i + 1
  55. fichero.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement