From 710d5fb452e2aad7b71462e0170dfc25066c8e52 Mon Sep 17 00:00:00 2001 From: dadav <33197631+dadav@users.noreply.github.com> Date: Sat, 11 Apr 2020 10:14:23 +0200 Subject: [PATCH 1/4] addded on_config_changed --- handshakes-dl.py | 10 +++------- hashie.py | 13 ++----------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/handshakes-dl.py b/handshakes-dl.py index 71b6e0a..e1d0612 100644 --- a/handshakes-dl.py +++ b/handshakes-dl.py @@ -31,7 +31,7 @@ TEMPLATE = """ class HandshakesDL(plugins.Plugin): __author__ = 'me@sayakb.com' - __version__ = '0.1.0' + __version__ = '0.1.1' __license__ = 'GPL3' __description__ = 'Download handshake captures from web-ui.' @@ -41,12 +41,8 @@ class HandshakesDL(plugins.Plugin): def on_loaded(self): logging.info("[HandshakesDL] plugin loaded") - def on_ready(self, agent): - self.config = agent.config() - self.ready = True - - def on_internet_available(self, agent): - self.config = agent.config() + def on_config_changed(self, config): + self.config = config self.ready = True def on_webhook(self, path, request): diff --git a/hashie.py b/hashie.py index e50bc77..4ed9bfb 100644 --- a/hashie.py +++ b/hashie.py @@ -12,7 +12,7 @@ import pwnagotchi.ui.fonts as fonts class hashie(plugins.Plugin): __author__ = 'junohea.mail@gmail.com' - __version__ = '1.0.0' + __version__ = '1.0.1' __license__ = 'GPL3' __description__ = ''' Attempt to automatically convert pcaps to a crackable format. @@ -53,17 +53,8 @@ class hashie(plugins.Plugin): logging.info("[hashie] plugin loaded") self.lock = Lock() - # called when the plugin is loaded - def on_loaded(self): - pass - - # called when there's internet connectivity - def on_internet_available(self, agent): - pass - # called when everything is ready and the main loop is about to start - def on_ready(self, agent): - config = agent.config() + def on_config_changed(self, config): handshake_dir = config['bettercap']['handshakes'] if 'interval' not in self.options or not (self.status.newer_then_hours(self.options['interval'])): From 2d23d1d538d9dad301ef68638f9c3ecdd5de73e3 Mon Sep 17 00:00:00 2001 From: dadav <33197631+dadav@users.noreply.github.com> Date: Tue, 14 Apr 2020 17:26:24 +0200 Subject: [PATCH 2/4] rename --- auto_backup.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/auto_backup.py b/auto_backup.py index a033e05..f716ec6 100644 --- a/auto_backup.py +++ b/auto_backup.py @@ -42,24 +42,24 @@ class AutoBackup(plugins.Plugin): try: display = agent.view() - logging.info("AUTO-BACKUP: Backing up ...") + logging.info("AUTO_BACKUP: Backing up ...") display.set('status', 'Backing up ...') display.update() for cmd in self.options['commands']: - logging.info(f"AUTO-BACKUP: Running {cmd.format(files=files_to_backup)}") + logging.info(f"AUTO_BACKUP: Running {cmd.format(files=files_to_backup)}") process = subprocess.Popen(cmd.format(files=files_to_backup), shell=True, stdin=None, stdout=open("/dev/null", "w"), stderr=None, executable="/bin/bash") process.wait() if process.returncode > 0: raise OSError(f"Command failed (rc: {process.returncode})") - logging.info("AUTO-BACKUP: backup done") + logging.info("AUTO_BACKUP: backup done") display.set('status', 'Backup done!') display.update() self.status.update() except OSError as os_e: self.tries += 1 - logging.info(f"AUTO-BACKUP: Error: {os_e}") + logging.info(f"AUTO_BACKUP: Error: {os_e}") display.set('status', 'Backup failed!') display.update() From 9cc9bc145341b9a1c8530dce4821c932eb2343ef Mon Sep 17 00:00:00 2001 From: dadav <33197631+dadav@users.noreply.github.com> Date: Tue, 14 Apr 2020 18:15:25 +0200 Subject: [PATCH 3/4] add filter --- handshakes-dl.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/handshakes-dl.py b/handshakes-dl.py index e1d0612..9d601ad 100644 --- a/handshakes-dl.py +++ b/handshakes-dl.py @@ -18,7 +18,43 @@ TEMPLATE = """ {{ title }} {% endblock %} +{% block styles %} + {{ super() }} + +{% endblock %} +{% block script %} + var shakeList = document.getElementById('list'); + var filter = document.getElementById('filter'); + var filterVal = filter.value.toUpperCase(); + + filter.onkeyup = function() { + document.body.style.cursor = 'progress'; + var table, tr, tds, td, i, txtValue; + filterVal = filter.value.toUpperCase(); + li = shakeList.getElementsByTagName("li"); + for (i = 0; i < li.length; i++) { + txtValue = li[i].textContent || li[i].innerText; + if (txtValue.toUpperCase().indexOf(filterVal) > -1) { + li[i].style.display = "list-item"; + } else { + li[i].style.display = "none"; + } + } + document.body.style.cursor = 'default'; + } + +{% endblock %} + {% block content %} +