From 8d2cbee8df4c0b739783c8f11a9514d0ff156d76 Mon Sep 17 00:00:00 2001 From: Simone Margaritelli <evilsocket@gmail.com> Date: Sun, 13 Oct 2019 18:09:33 +0200 Subject: [PATCH] fix: fixed log flooding with whitelisten networks for grid report --- pwnagotchi/plugins/default/grid.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/pwnagotchi/plugins/default/grid.py b/pwnagotchi/plugins/default/grid.py index 4b62a55..264de46 100644 --- a/pwnagotchi/plugins/default/grid.py +++ b/pwnagotchi/plugins/default/grid.py @@ -78,6 +78,12 @@ def on_ui_update(ui): 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): global REPORT, UNREAD_MESSAGES, TOTAL_MESSAGES @@ -118,17 +124,19 @@ def on_internet_available(agent): net_id = os.path.basename(pcap_file).replace('.pcap', '') if net_id not in reported: 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 essid, bssid = parse_pcap(pcap_file) if bssid: + add_as_reported = False if is_excluded(essid) or is_excluded(bssid): logging.debug("not reporting %s due to exclusion filter" % pcap_file) - - elif grid.report_ap(essid, bssid): - reported.append(net_id) - REPORT.update(data={'reported': reported}) + set_reported(reported, net_id) + else: + if grid.report_ap(essid, bssid): + set_reported(reported, net_id) else: logging.warning("no bssid found?!") else: