diff --git a/pwnagotchi/plugins/default/gpio_buttons.py b/pwnagotchi/plugins/default/gpio_buttons.py index 50338aa2..2a5cfe2b 100644 --- a/pwnagotchi/plugins/default/gpio_buttons.py +++ b/pwnagotchi/plugins/default/gpio_buttons.py @@ -14,8 +14,9 @@ class GPIOButtons(plugins.Plugin): self.running = False self.ports = {} self.commands = None + self.options = dict() - def runCommand(self, channel): + def runcommand(self, channel): command = self.ports[channel] logging.info(f"Button Pressed! Running command: {command}") process = subprocess.Popen(command, shell=True, stdin=None, stdout=open("/dev/null", "w"), stderr=None, @@ -35,8 +36,8 @@ class GPIOButtons(plugins.Plugin): gpio = int(gpio) self.ports[gpio] = command GPIO.setup(gpio, GPIO.IN, GPIO.PUD_UP) - GPIO.add_event_detect(gpio, GPIO.FALLING, callback=self.runCommand, bouncetime=600) - #set pimoroni display hat mini LED off/dim + GPIO.add_event_detect(gpio, GPIO.FALLING, callback=self.runcommand, bouncetime=600) + # set pimoroni display hat mini LED off/dim GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) GPIO.setup(22, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) GPIO.setup(27, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) diff --git a/pwnagotchi/plugins/default/grid.py b/pwnagotchi/plugins/default/grid.py index a2a35357..9c24ed53 100644 --- a/pwnagotchi/plugins/default/grid.py +++ b/pwnagotchi/plugins/default/grid.py @@ -89,7 +89,7 @@ class Grid(plugins.Plugin): logging.debug("checking pcap's") config = agent.config() - pcap_files = glob.glob(os.path.join(agent.config()['bettercap']['handshakes'], "*.pcap")) + pcap_files = glob.glob(os.path.join(config['bettercap']['handshakes'], "*.pcap")) num_networks = len(pcap_files) reported = self.report.data_field_or('reported', default=[]) num_reported = len(reported) diff --git a/pwnagotchi/plugins/default/switcher.py b/pwnagotchi/plugins/default/switcher.py index 21335ac3..4d63f41e 100644 --- a/pwnagotchi/plugins/default/switcher.py +++ b/pwnagotchi/plugins/default/switcher.py @@ -18,12 +18,14 @@ def systemd_dropin(name, content): systemctl("daemon-reload") + def systemctl(command, unit=None): if unit: os.system("/bin/systemctl %s %s" % (command, unit)) else: os.system("/bin/systemctl %s" % command) + def run_task(name, options): task_service_name = "switcher-%s-task.service" % name # save all the commands to a shell script @@ -57,7 +59,7 @@ def run_task(name, options): """ % (name, task_service_name, name)) if 'reboot' in options and options['reboot']: - # create a indication file! + # create an indication file! # if this file is set, we want the switcher-tasks to run open('/root/.switcher', 'a').close() @@ -98,6 +100,7 @@ def run_task(name, options): systemctl("daemon-reload") systemctl("start", task_service_name) + class Switcher(plugins.Plugin): __author__ = '33197631+dadav@users.noreply.github.com' __version__ = '0.0.1'