From d4e6972a7f41c46ec5b2c3738f8bf6cb3bf75bd6 Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Wed, 30 Aug 2023 15:40:01 +0200 Subject: [PATCH] V2.1.1 Signed-off-by: Jeroen Oudshoorn Signed-off-by: Jeroen Oudshoorn --- .idea/misc.xml | 2 +- .idea/pwnagotchi.iml | 2 +- builder/pwnagotchi.yml | 2 +- pwnagotchi/plugins/__init__.py | 13 ++++++------- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 6178365c..a971a2c9 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/.idea/pwnagotchi.iml b/.idea/pwnagotchi.iml index 7e680cfc..8d3ec578 100644 --- a/.idea/pwnagotchi.iml +++ b/.idea/pwnagotchi.iml @@ -4,7 +4,7 @@ - + diff --git a/builder/pwnagotchi.yml b/builder/pwnagotchi.yml index eae19e4c..f71c070c 100644 --- a/builder/pwnagotchi.yml +++ b/builder/pwnagotchi.yml @@ -368,7 +368,7 @@ - name: Delete old driver file: state: absent - path: /lib/modules/{{ ansible_kernel }}/kernel/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko.xz" + path: /lib/modules/{{ ansible_kernel }}/kernel/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko" - name: copy modified driver become_user: root diff --git a/pwnagotchi/plugins/__init__.py b/pwnagotchi/plugins/__init__.py index b14e6880..f376bd19 100644 --- a/pwnagotchi/plugins/__init__.py +++ b/pwnagotchi/plugins/__init__.py @@ -1,18 +1,17 @@ import os import glob +import _thread import threading import importlib, importlib.util import logging -from concurrent.futures import ThreadPoolExecutor + + default_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "default") loaded = {} database = {} locks = {} -THREAD_POOL_SIZE = 10 -executor = ThreadPoolExecutor(max_workers=THREAD_POOL_SIZE) - class Plugin: @classmethod @@ -45,7 +44,7 @@ def toggle_plugin(name, enable=True): global loaded, database if pwnagotchi.config: - if name not in pwnagotchi.config['main']['plugins']: + if not name in pwnagotchi.config['main']['plugins']: pwnagotchi.config['main']['plugins'][name] = dict() pwnagotchi.config['main']['plugins'][name]['enabled'] = enable save_config(pwnagotchi.config, '/etc/pwnagotchi/config.toml') @@ -97,7 +96,7 @@ def one(plugin_name, event_name, *args, **kwargs): try: lock_name = "%s::%s" % (plugin_name, cb_name) locked_cb_args = (lock_name, callback, *args, *kwargs) - executor.submit(locked_cb, *locked_cb_args) + _thread.start_new_thread(locked_cb, locked_cb_args) except Exception as e: logging.error("error while running %s.%s : %s" % (plugin_name, cb_name, e)) logging.error(e, exc_info=True) @@ -145,4 +144,4 @@ def load(config): plugin.options = config['main']['plugins'][name] on('loaded') - on('config_changed', config) + on('config_changed', config) \ No newline at end of file