From 6e57e131b3a58aad4842d45101ab6b345387a075 Mon Sep 17 00:00:00 2001
From: jakubmilkowski <jakub.milkowsky@gmail.com>
Date: Sat, 30 Nov 2019 22:44:03 +0100
Subject: [PATCH] fix: Prevent duplicate entries for uploaded pcaps

For the same reasons like described here https://github.com/evilsocket/pwnagotchi/issues/657 duplicated entries could be created in /root/.ohc_uploads

Signed-off-by: jakubmilkowski <jakub.milkowsky@gmail.com>
---
 pwnagotchi/plugins/default/onlinehashcrack.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/pwnagotchi/plugins/default/onlinehashcrack.py b/pwnagotchi/plugins/default/onlinehashcrack.py
index 54ea953..9e65e89 100644
--- a/pwnagotchi/plugins/default/onlinehashcrack.py
+++ b/pwnagotchi/plugins/default/onlinehashcrack.py
@@ -92,9 +92,10 @@ class OnlineHashCrack(plugins.Plugin):
                     display.update(force=True)
                     try:
                         self._upload_to_ohc(handshake)
-                        reported.append(handshake)
-                        self.report.update(data={'reported': reported})
-                        logging.info(f"OHC: Successfully uploaded {handshake}")
+                        if handshake not in reported:
+                            reported.append(handshake)
+                            self.report.update(data={'reported': reported})
+                            logging.info(f"OHC: Successfully uploaded {handshake}")
                     except requests.exceptions.RequestException as req_e:
                         self.skip.append(handshake)
                         logging.error("OHC: %s", req_e)