diff --git a/pwnagotchi/plugins/default/wpa-sec.py b/pwnagotchi/plugins/default/wpa-sec.py index 1bba0e01..137aa600 100644 --- a/pwnagotchi/plugins/default/wpa-sec.py +++ b/pwnagotchi/plugins/default/wpa-sec.py @@ -36,16 +36,15 @@ class WpaSec(plugins.Plugin): """ with open(path, 'rb') as file_to_upload: cookie = {'key': self.options['api_key']} - payload = {'file': file_to_upload} try: result = requests.post(self.options['api_url'], cookies=cookie, - files=payload, + files=file_to_upload, timeout=timeout) if result.status_code == 200: - if 'already submitted' in result.text: - logging.debug("%s was already submitted.", path) + if ' already submitted' in result.text: + logging.info("%s was already submitted.", path) return False return True elif result.status_code != 200: @@ -108,7 +107,11 @@ class WpaSec(plugins.Plugin): display = agent.view() reported = self.report.data_field_or('reported', default=list()) handshake_dir = config['bettercap']['handshakes'] - handshake_filenames = os.listdir(handshake_dir) + try: + handshake_filenames = os.listdir(handshake_dir) + except FileNotFoundError: + logging.info("WPA_SEC: Handshake directory doesn't exist.") + return handshake_paths = [os.path.join(handshake_dir, filename) for filename in handshake_filenames if filename.endswith('.pcap')] handshake_paths = remove_whitelisted(handshake_paths, config['main']['whitelist']) handshake_new = set(handshake_paths) - set(reported) - set(self.skip)