Merge pull request #16 from dadav/develop

various fixes
This commit is contained in:
Simone Margaritelli 2020-06-26 14:16:14 +02:00 committed by GitHub
commit 3252f9b401
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 22 deletions

View File

@ -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()

View File

@ -18,7 +18,43 @@ TEMPLATE = """
{{ title }}
{% endblock %}
{% block styles %}
{{ super() }}
<style>
#filter {
width: 100%;
font-size: 16px;
padding: 12px 20px 12px 40px;
border: 1px solid #ddd;
margin-bottom: 12px;
}
</style>
{% 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 %}
<input type="text" id="filter" placeholder="Search for ..." title="Type in a filter">
<ul id="list" data-role="listview" style="list-style-type:disc;">
{% for handshake in handshakes %}
<li class="file">
@ -31,7 +67,7 @@ TEMPLATE = """
class HandshakesDL(plugins.Plugin):
__author__ = 'me@sayakb.com'
__version__ = '0.1.0'
__version__ = '0.2.1'
__license__ = 'GPL3'
__description__ = 'Download handshake captures from web-ui.'
@ -41,12 +77,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):

View File

@ -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'])):