fix: fixed log flooding with whitelisten networks for grid report

This commit is contained in:
Simone Margaritelli 2019-10-13 18:09:33 +02:00
parent 6793312691
commit 8d2cbee8df

@ -78,6 +78,12 @@ def on_ui_update(ui):
ui.set('mailbox', new_value) ui.set('mailbox', new_value)
def set_reported(reported, net_id):
global REPORT
reported.append(net_id)
REPORT.update(data={'reported': reported})
def on_internet_available(agent): def on_internet_available(agent):
global REPORT, UNREAD_MESSAGES, TOTAL_MESSAGES global REPORT, UNREAD_MESSAGES, TOTAL_MESSAGES
@ -118,17 +124,19 @@ def on_internet_available(agent):
net_id = os.path.basename(pcap_file).replace('.pcap', '') net_id = os.path.basename(pcap_file).replace('.pcap', '')
if net_id not in reported: if net_id not in reported:
if is_excluded(net_id): if is_excluded(net_id):
logging.info("skipping %s due to exclusion filter" % pcap_file) logging.debug("skipping %s due to exclusion filter" % pcap_file)
set_reported(reported, net_id)
continue continue
essid, bssid = parse_pcap(pcap_file) essid, bssid = parse_pcap(pcap_file)
if bssid: if bssid:
add_as_reported = False
if is_excluded(essid) or is_excluded(bssid): if is_excluded(essid) or is_excluded(bssid):
logging.debug("not reporting %s due to exclusion filter" % pcap_file) logging.debug("not reporting %s due to exclusion filter" % pcap_file)
set_reported(reported, net_id)
elif grid.report_ap(essid, bssid): else:
reported.append(net_id) if grid.report_ap(essid, bssid):
REPORT.update(data={'reported': reported}) set_reported(reported, net_id)
else: else:
logging.warning("no bssid found?!") logging.warning("no bssid found?!")
else: else: