def main(): t = tracker.tracking() w = wireless.probe_traffic() w.packet_count = 1000 while True: # Output some details about what is being found data = w.scan() stats = t.stats() process = [] # Used to storing for use in the web interface for item in data: t.data = item state = True if item['type'] == 'ap': state = t.new() # APs tend to clutter up things if t.insertable() and state: t.insert() process.append(item) print screen_out(item) if print_out: printer_out(item) # Processing for storage used by the web service # I'll clean this up later--Pickle drove me nuts here. wt = tracker.web_track() build = None if build == None: # We'll build a new set of keys build = {} for x in t.stats_types: build[x] = [ 0 ] # Goddamn Pickle's fault for this for key in stats.keys(): for item in stats[key]: ckey = item['type'] item['realtime'] = time_stamp(item['time']) build[ckey].append(item) for key in build.keys(): # Limit each to 10 or something build[key] = build[key][:10] wt.overwrite(build) sleep(3)
def main(): t = tracker.web_track() device_data = t.item_data() return render_template(template, device_data=device_data)