''' wifi.py Various wifi scripts that are useful https://pypi.org/project/wireless/ https://github.com/joshvillbrandt/wireless ''' from wireless import Wireless # connect to wireless network wireless = Wireless() ssid = 'I_am_cool' password = '******' wireless.connect(ssid='ssid', password='******') # various things you can get print(wireless.current()) print(wireless.interfaces()) print(wireless.interface()) print(wireless.power()) print(wireless.driver())
return 'Unable to identify product' while (True): timestamp = '{:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now()) try: resp = requests.get(product_url, headers=headers) #resp = requests.get(test_url) except ConnectionError as e: print("ConnectionError: " + str(e)) # seems to usually happen when wifi is dropped, try toggling power wireless = Wireless() if (wireless.power()): print("Wireless currently enabled, powering off") wireless.power(False) else: print("Wireless currently disabled, powering on") wireless.power(True) time.sleep(30) continue #return to top of while loop if (resp.status_code != 200): #text the geek print(timestamp + ' Oops, text the geek') send_simple_message('[redacted]@txt.att.net', 'Something Broke', resp.text, timestamp) else:
print('\n') print('Public Hostpot Gathering - alpha version') print('\n') #SAVING MAC ADDRESS if argsMAC == 1: print('''MAC Address Spoofing is ON: this is just required when you want to collect evidence again for an previously associated hotspot, original MAC address is saved and restore at the end ''') MAC = netifaces.ifaddresses(NetworkInterface)[netifaces.AF_LINK][0]['addr'] spoofMAC = randomMAC() print('MAC Address: {}').format(MAC) print('Fake MAC Address: {}').format(spoofMAC) print('\n') if wifi.power() == False: print 'Wireless Adapter is Off, turning ON' wifi.power(True) macAddressChanger(NetworkInterface, spoofMAC) else: macAddressChanger(NetworkInterface, spoofMAC) if argsCurrent == 0: print('\n') print("Restarting Wireless Adapter") #RESTART WIRELESS ADAPTER FOR MACCHANGER if wifi.current() == None: wifi.power(False) else: wifi.power(False) wifi.power(True)