Skip to content

Commit

Permalink
Update frontend WLOC Location Results
Browse files Browse the repository at this point in the history
  • Loading branch information
GISDev01 committed May 18, 2020
1 parent 7a4cb0b commit 6e28713
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions security_ssid/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from django.http import HttpResponse
from django.shortcuts import render
from django.views.generic import *

from netaddr import EUI

from location_utils import wigle_query, wloc
Expand Down Expand Up @@ -123,20 +124,19 @@ def getCenter(apdict):


def AppleWloc(request, bssid=None):
return HttpResponse('This is currently disabled.')

if not bssid:
print("Setting to Default BSSID")
bssid = '00:1e:52:7a:ae:ad'

print('Got request for %s' % bssid)
print('Apple WLOC request for BSSID: {}'.format(bssid))

if request.GET.get('ajax'):
template = 'apple-wloc-ajax.js'
else:
template = 'apple-wloc.html'
request.session['apdict'] = {}
request.session['apset'] = [] # reset server-side cache of unique bssids if we load page normally
# Reset server-side cache of unique bssids if we load page normally
request.session['apset'] = []

bssid = bssid.lower()
apdict = wloc.QueryBSSID(bssid)
Expand All @@ -146,7 +146,7 @@ def AppleWloc(request, bssid=None):
if ap in request.session['apset']:
dupes += 1
del apdict[ap]
request.session['apset'].add(ap)
request.session['apset'].append(ap)

numresults = len(apdict)

Expand All @@ -155,10 +155,10 @@ def AppleWloc(request, bssid=None):
print('%s returned to browser post filter' % numresults)

if numresults == 0 or (-180.0, -180.0) in apdict.values():
print('0 results.')
return HttpResponse('0 results.')
print('0 WLOC results.')
return HttpResponse('No valid WLOC results for BSSID: {}'.format(bssid))
else:
print('Not 0 results')
print('Not 0 WLOC results')

if bssid in apdict.keys():
try:
Expand Down

0 comments on commit 6e28713

Please sign in to comment.