From d2c44797e5f4f1a938790f4bcdd746708714967e Mon Sep 17 00:00:00 2001
From: Sayak Brahmachari <sayak-brm@users.noreply.github.com>
Date: Tue, 26 Nov 2019 14:05:10 +0530
Subject: [PATCH] Prevent duplicate entries for reported networks

Due to duplicate entries in `/root/.api-report.json`, [this code](https://github.com/evilsocket/pwnagotchi/blob/master/pwnagotchi/plugins/default/grid.py#L90) incorrectly reports the number of pwned networks, resulting in incorrect stats on the [pwnagotchi.ai website](https://pwnagotchi.ai/).
---
 pwnagotchi/plugins/default/grid.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pwnagotchi/plugins/default/grid.py b/pwnagotchi/plugins/default/grid.py
index a727e24..23181ae 100644
--- a/pwnagotchi/plugins/default/grid.py
+++ b/pwnagotchi/plugins/default/grid.py
@@ -67,7 +67,8 @@ class Grid(plugins.Plugin):
         logging.info("grid plugin loaded.")
 
     def set_reported(self, reported, net_id):
-        reported.append(net_id)
+        if net_id not in reported:
+            reported.append(net_id)
         self.report.update(data={'reported': reported})
 
     def check_inbox(self, agent):