From e66af08d2587280a840f4a4f1e75f97c9ac02fab Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Thu, 16 Nov 2023 20:31:23 +0100 Subject: [PATCH] Added voice --- pwnagotchi/plugins/default/gdrivesync.py | 9 ++++++++- pwnagotchi/voice.py | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/pwnagotchi/plugins/default/gdrivesync.py b/pwnagotchi/plugins/default/gdrivesync.py index 2180846a..3204d056 100644 --- a/pwnagotchi/plugins/default/gdrivesync.py +++ b/pwnagotchi/plugins/default/gdrivesync.py @@ -22,6 +22,7 @@ class GdriveSync(plugins.Plugin): } def __init__(self): + self.options = dict() self.lock = Lock() self.internet = False self.ready = False @@ -37,11 +38,12 @@ class GdriveSync(plugins.Plugin): '/etc/pwnagotchi' ] - def on_loaded(self): + def on_loaded(self, agent): """ Called when the plugin is loaded """ # client_secrets.json needs to be not empty + display = agent.view() if os.stat("/root/client_secrets.json").st_size == 0: logging.error("[gDriveSync] /root/client_secrets.json is empty. Please RTFM!") return @@ -89,6 +91,7 @@ class GdriveSync(plugins.Plugin): # Upload the zip archive to Google Drive self.upload_to_gdrive(zip_file_path, self.get_folder_id_by_name(self.drive, self.options['backup_folder'])) + display.on_uploading("Google Drive") self.backup = True self.status.update() @@ -100,6 +103,8 @@ class GdriveSync(plugins.Plugin): if zip_file_id: zip_file = self.drive.CreateFile({'id': zip_file_id}) zip_file.GetContentFile(os.path.join(local_backup_path, 'backup.zip')) + + display.on_downloading("Google Drive") logging.info("[gDriveSync] Downloaded backup.zip from Google Drive") # Extract the zip archive to the root directory @@ -168,6 +173,7 @@ class GdriveSync(plugins.Plugin): self.internet = True def on_handshake(self, agent): + display = agent.view() if not self.ready and not self.internet: return if self.lock.locked(): @@ -193,6 +199,7 @@ class GdriveSync(plugins.Plugin): # Upload the zip archive to Google Drive self.upload_to_gdrive(zip_file_path, self.get_folder_id_by_name(self.drive, self.options['backup_folder'])) + display.on_uploading("Google Drive") # Cleanup the local zip file os.remove(zip_file_path) diff --git a/pwnagotchi/voice.py b/pwnagotchi/voice.py index 991d26fb..1a459d4f 100644 --- a/pwnagotchi/voice.py +++ b/pwnagotchi/voice.py @@ -162,6 +162,9 @@ class Voice: def on_uploading(self, to): return self._("Uploading data to {to} ...").format(to=to) + def on_downloading(self, name): + return self._("Downloading from {name} ...").format(name=name) + def on_last_session_data(self, last_session): status = self._('Kicked {num} stations\n').format(num=last_session.deauthed) if last_session.associated > 999: