-
Notifications
You must be signed in to change notification settings - Fork 71
/
wlan_reader.py
59 lines (55 loc) · 2.36 KB
/
wlan_reader.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import sys
try:
from _winreg import *
except:
from winreg import *
try:
from common_methods import *
except ImportError:
sys.exit("Could not find common_methods.py... download the full toolkit from https://github.com/MonroCoury/Forensic_Tools")
def val2addr(val):
if val:
addr = ""
for char in val:
try:
addr += ("%02x " % ord(char))
except:
addr += ("%02x " % ord(chr(char)))
addr = addr.strip(" ").replace(" ", ":")[:17]
return True, addr
else:
addr = "No data found for this network"
return False, addr
def get_WIFIs():
wlans = r'SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList' \
+ r'\Signatures\Unmanaged'
key = OpenKey(HKEY_LOCAL_MACHINE, wlans)
data = ""
num = 0
for i in range(1000000):
try:
attempt = EnumKey(key, i)
wlan_key = OpenKey(key, str(attempt))
(n, addr, t) = EnumValue(wlan_key, 5)
(n, name, t) = EnumValue(wlan_key, 4)
res, mac_address = val2addr(addr)
wlan_name = str(name)
data += "<tr><td>%s</td><td>%s</td></tr>" % (wlan_name, mac_address)
CloseKey(wlan_key)
num += 1
except Exception as e:
break
complete_html = init_data("wlan_reader Wifi Networks", num) + init_table_header("./templates/init_wlan_html.html") \
+ data + close_table_html()
saveResult("Wifi_History.html", complete_html)
if __name__ == "__main__":
print('\n\n ##############A Python script to read WIFI activity #####################')
print(' # Mac Address can be used to determin the location #')
print(' # of the wireless network with the help of online #')
print(' # databases like wigle or skyhook, a feature I\'m #')
print(' # planning on adding to this script to save you the effort #')
print(' # Make sure you run command prompt as administrator #')
print(' # Coded by monrocoury #')
print(' #########################################################################\n\n')
print("Working...\n")
get_WIFIs()