Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
# replace the BSSID in the raw WiFi file with coordinates
import os
bssid_coord = dict()
for l in open('bssidmappingfile.csv').readlines()[1:]:
ll = l.split(',')
if len(ll)>2:
bssid = ll[0]
lat = ll[1]
long = ll[2][:-1]
bssid_coord[bssid] = (lat,long)
print(bssid_coord)
if not os.path.exists("wifiprocess"):
os.makedirs("wifiprocess")
if not os.path.exists("wifiprocessios"):
os.makedirs("wifiprocessios")
owdict = dict()
rootDir='android_wifiraw_remdup'
for lists in os.listdir(rootDir):
path = os.path.join(rootDir, lists)
for l in open(path).readlines()[1:]:
ll = l.split(',')
if len(ll)>3:
uid = ll[0]
bssid = ll[1]
sta = ll[2]
ts = ll[3][:-1]
if bssid in bssid_coord.keys():
lat = bssid_coord[bssid][0]
long = bssid_coord[bssid][1]
if uid not in owdict.keys():
ow = open('wifiprocess\\'+uid+'_location.csv','a+')
owdict[uid] = ow
else:
ow = owdict[uid]
ow.write(','.join([lat,long,sta,ts])+'\n')
for ow in owdict.values():
ow.close()
owdict = dict()
rootDir='ios_wifiraw_remdup'
for lists in os.listdir(rootDir):
path = os.path.join(rootDir, lists)
for l in open(path).readlines()[1:]:
ll = l.split(',')
if len(ll)>3:
uid = ll[0]
bssid = ll[1]
sta = ll[2]
ts = ll[3][:-1]
if bssid in bssid_coord.keys():
lat = bssid_coord[bssid][0]
long = bssid_coord[bssid][1]
if uid not in owdict.keys():
ow = open('wifiprocessios\\'+uid+'_location.csv','a+')
owdict[uid] = ow
else:
ow = owdict[uid]
ow.write(','.join([lat,long,sta,ts])+'\n')
for ow in owdict.values():
ow.close()