new: added new faces for uploading status

This commit is contained in:
Simone Margaritelli 2021-04-18 17:03:21 +02:00
parent 5c3b21f537
commit f164b8bb26
7 changed files with 36 additions and 15 deletions

View File

@ -184,6 +184,9 @@ ui.faces.angry = "(-_-')"
ui.faces.friend = "(♥‿‿♥)" ui.faces.friend = "(♥‿‿♥)"
ui.faces.broken = "(☓‿‿☓)" ui.faces.broken = "(☓‿‿☓)"
ui.faces.debug = "(#__#)" ui.faces.debug = "(#__#)"
ui.faces.upload = "(1__0)"
ui.faces.upload1 = "(1__1)"
ui.faces.upload2 = "(0__1)"
ui.web.enabled = true ui.web.enabled = true
ui.web.address = "0.0.0.0" ui.web.address = "0.0.0.0"

View File

@ -244,3 +244,7 @@ msgstr ""
msgid "second" msgid "second"
msgstr "" msgstr ""
#, python-brace-format
msgid "Uploading data to {to} ..."
msgstr ""

View File

@ -110,9 +110,8 @@ class OnlineHashCrack(plugins.Plugin):
if handshake_new: if handshake_new:
logging.info("OHC: Internet connectivity detected. Uploading new handshakes to onlinehashcrack.com") logging.info("OHC: Internet connectivity detected. Uploading new handshakes to onlinehashcrack.com")
for idx, handshake in enumerate(handshake_new): for idx, handshake in enumerate(handshake_new):
display.set('status', display.on_uploading(f"onlinehashcrack.com ({idx + 1}/{len(handshake_new)})")
f"Uploading handshake to onlinehashcrack.com ({idx + 1}/{len(handshake_new)})")
display.update(force=True)
try: try:
self._upload_to_ohc(handshake) self._upload_to_ohc(handshake)
if handshake not in reported: if handshake not in reported:
@ -127,6 +126,9 @@ class OnlineHashCrack(plugins.Plugin):
self.skip.append(handshake) self.skip.append(handshake)
logging.debug("OHC: %s", os_e) logging.debug("OHC: %s", os_e)
continue continue
display.on_normal()
if 'dashboard' in self.options and self.options['dashboard']: if 'dashboard' in self.options and self.options['dashboard']:
cracked_file = os.path.join(handshake_dir, 'onlinehashcrack.cracked') cracked_file = os.path.join(handshake_dir, 'onlinehashcrack.cracked')
if os.path.exists(cracked_file): if os.path.exists(cracked_file):

View File

@ -180,8 +180,8 @@ class Wigle(plugins.Plugin):
csv_entries.append(new_entry) csv_entries.append(new_entry)
no_err_entries.append(gps_file) no_err_entries.append(gps_file)
if csv_entries: if csv_entries:
display.set('status', "Uploading gps-data to wigle.net ...") display.on_uploading('wigle.net')
display.update(force=True)
try: try:
_send_to_wigle(csv_entries, self.options['api_key'], donate=self.options['donate']) _send_to_wigle(csv_entries, self.options['api_key'], donate=self.options['donate'])
reported += no_err_entries reported += no_err_entries
@ -193,3 +193,5 @@ class Wigle(plugins.Plugin):
except OSError as os_e: except OSError as os_e:
self.skip += no_err_entries self.skip += no_err_entries
logging.debug("WIGLE: Got the following error: %s", os_e) logging.debug("WIGLE: Got the following error: %s", os_e)
display.on_normal()

View File

@ -111,8 +111,8 @@ class WpaSec(plugins.Plugin):
if handshake_new: if handshake_new:
logging.info("WPA_SEC: Internet connectivity detected. Uploading new handshakes to wpa-sec.stanev.org") logging.info("WPA_SEC: Internet connectivity detected. Uploading new handshakes to wpa-sec.stanev.org")
for idx, handshake in enumerate(handshake_new): for idx, handshake in enumerate(handshake_new):
display.set('status', f"Uploading handshake to wpa-sec.stanev.org ({idx + 1}/{len(handshake_new)})") display.on_uploading(f"wpa-sec.stanev.org ({idx + 1}/{len(handshake_new)})")
display.update(force=True)
try: try:
self._upload_to_wpasec(handshake) self._upload_to_wpasec(handshake)
reported.append(handshake) reported.append(handshake)
@ -126,6 +126,8 @@ class WpaSec(plugins.Plugin):
logging.debug("WPA_SEC: %s", os_e) logging.debug("WPA_SEC: %s", os_e)
continue continue
display.on_normal()
if 'download_results' in self.options and self.options['download_results']: if 'download_results' in self.options and self.options['download_results']:
cracked_file = os.path.join(handshake_dir, 'wpa-sec.cracked.potfile') cracked_file = os.path.join(handshake_dir, 'wpa-sec.cracked.potfile')
if os.path.exists(cracked_file): if os.path.exists(cracked_file):

View File

@ -1,20 +1,20 @@
import _thread import _thread
from threading import Lock
import time
import logging import logging
import random import random
import time
from threading import Lock
from PIL import ImageDraw from PIL import ImageDraw
import pwnagotchi import pwnagotchi
import pwnagotchi.utils as utils
import pwnagotchi.plugins as plugins import pwnagotchi.plugins as plugins
from pwnagotchi.voice import Voice
import pwnagotchi.ui.web as web
import pwnagotchi.ui.fonts as fonts
import pwnagotchi.ui.faces as faces import pwnagotchi.ui.faces as faces
import pwnagotchi.ui.fonts as fonts
import pwnagotchi.ui.web as web
import pwnagotchi.utils as utils
from pwnagotchi.ui.components import * from pwnagotchi.ui.components import *
from pwnagotchi.ui.state import State from pwnagotchi.ui.state import State
from pwnagotchi.voice import Voice
WHITE = 0xff WHITE = 0xff
BLACK = 0x00 BLACK = 0x00
@ -345,6 +345,11 @@ class View(object):
self.update() self.update()
time.sleep(5.0) time.sleep(5.0)
def on_uploading(self, to):
self.set('face', random.choice((faces.UPLOAD, faces.UPLOAD1, faces.UPLOAD2)))
self.set('status', self._voice.on_uploading(to))
self.update(force=True)
def on_rebooting(self): def on_rebooting(self):
self.set('face', faces.BROKEN) self.set('face', faces.BROKEN)
self.set('status', self._voice.on_rebooting()) self.set('status', self._voice.on_rebooting())

View File

@ -1,6 +1,6 @@
import random
import gettext import gettext
import os import os
import random
class Voice: class Voice:
@ -159,6 +159,9 @@ class Voice:
def on_rebooting(self): def on_rebooting(self):
return self._("Oops, something went wrong ... Rebooting ...") return self._("Oops, something went wrong ... Rebooting ...")
def on_uploading(self, to):
return self._("Uploading data to {to} ...").format(to=to)
def on_last_session_data(self, last_session): def on_last_session_data(self, last_session):
status = self._('Kicked {num} stations\n').format(num=last_session.deauthed) status = self._('Kicked {num} stations\n').format(num=last_session.deauthed)
if last_session.associated > 999: if last_session.associated > 999: