From bb3f8cbf56e70be31e3d7df8a8525ce73a8fbe4b Mon Sep 17 00:00:00 2001 From: AlienMajik <118037572+AlienMajik@users.noreply.github.com> Date: Wed, 19 Feb 2025 19:47:37 -0800 Subject: [PATCH] Update probenpwn.py Now uses /etc/pwnagotchi/config.toml whitelist no need to use this anymore: main.plugins.probenpwn.whitelist = ["00:11:22:33:44:55", "TrustedNetwork"] --- probenpwn.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/probenpwn.py b/probenpwn.py index 8b697b6..19ac82b 100644 --- a/probenpwn.py +++ b/probenpwn.py @@ -4,11 +4,12 @@ import threading import os import subprocess import random +import toml import pwnagotchi.plugins as plugins class probenpwn(plugins.Plugin): __author__ = 'AlienMajik' - __version__ = '1.1.1' + __version__ = '1.1.2' __license__ = 'GPL3' __description__ = ( 'Pwn more aggressively. Launch immediate associate or deauth attack ' @@ -21,7 +22,6 @@ class probenpwn(plugins.Plugin): self._agent = None self.old_name = None self.recents = {} - self.whitelist = set() self.attack_threads = [] self.epoch_duration = 60 # default epoch duration in seconds self._watchdog_thread = None @@ -34,6 +34,22 @@ class probenpwn(plugins.Plugin): self.failed_handshakes = 0 # Track the performance of each AP for dynamic adjustments self.performance_stats = {} + self.whitelist = set() + + # Load whitelist from the global Pwnagotchi config + self.load_whitelist() + + def load_whitelist(self): + """Load the whitelist from Pwnagotchi's global config.""" + try: + with open('/etc/pwnagotchi/config.toml', 'r') as config_file: + data = toml.load(config_file) + # Load SSIDs from the whitelist in the global config + self.whitelist = set(data.get('main', {}).get('whitelist', [])) + logging.info(f"Whitelist loaded from Pwnagotchi config: {self.whitelist}") + except Exception as e: + logging.error(f"Failed to load whitelist from config: {e}") + self.whitelist = set() def on_unload(self, ui): if self.old_name: @@ -104,6 +120,7 @@ class probenpwn(plugins.Plugin): def ok_to_attack(self, ap): if not self._agent: return False + # Check if the AP is in the whitelist loaded from the global config if ap.get('hostname', '').lower() in self.whitelist or ap['mac'].lower() in self.whitelist: return False return True