-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathblur_wifi.r2py
54 lines (39 loc) · 1.3 KB
/
blur_wifi.r2py
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
md5py = dy_import_module("md5py.r2py")
unicode_scrubber = dy_import_module("unicode_scrubber.r2py")
def blurred_get_wifi_connection_info():
wifi = get_wifi_connection_info()
# Blur SSID
md5 = md5py.md5py_new(wifi["ssid"])
wifi["ssid"] = unicode_scrubber.scrub(md5.hexdigest())[:8]
# Truncate AP and device MAC addresses to the manufacturer ID
wifi["bssid"] = wifi["bssid"][0:8] + 3*":00"
wifi["mac_address"] = wifi["mac_address"][0:8] + 3*":00"
return wifi
def blurred_do_wifi_scan():
wifi_list = do_wifi_scan()
blurred_wifi_list = []
for wifi in wifi_list:
# Round the frequency to 0.1 GHz
wifi["frequency"] = 100 * (wifi["frequency"]/100)
# Blur SSID
md5 = md5py.md5py_new(wifi["ssid"])
wifi["ssid"] = unicode_scrubber.scrub(md5.hexdigest())[:8]
# Truncate AP MAC to the manufacturer ID
wifi["bssid"] = wifi["bssid"][0:8] + 3*":00"
blurred_wifi_list.append(wifi)
return blurred_wifi_list
CHILD_CONTEXT_DEF["get_wifi_connection_info"] = {
"type": "func",
"args": None,
"return": dict,
"exceptions": "any",
"target": blurred_get_wifi_connection_info,
}
CHILD_CONTEXT_DEF["do_wifi_scan"] = {
"type": "func",
"args": None,
"return": list,
"exceptions": "any",
"target": blurred_do_wifi_scan,
}
secure_dispatch_module()