mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
Added voice
This commit is contained in:
@ -22,6 +22,7 @@ class GdriveSync(plugins.Plugin):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
self.options = dict()
|
||||||
self.lock = Lock()
|
self.lock = Lock()
|
||||||
self.internet = False
|
self.internet = False
|
||||||
self.ready = False
|
self.ready = False
|
||||||
@ -37,11 +38,12 @@ class GdriveSync(plugins.Plugin):
|
|||||||
'/etc/pwnagotchi'
|
'/etc/pwnagotchi'
|
||||||
]
|
]
|
||||||
|
|
||||||
def on_loaded(self):
|
def on_loaded(self, agent):
|
||||||
"""
|
"""
|
||||||
Called when the plugin is loaded
|
Called when the plugin is loaded
|
||||||
"""
|
"""
|
||||||
# client_secrets.json needs to be not empty
|
# client_secrets.json needs to be not empty
|
||||||
|
display = agent.view()
|
||||||
if os.stat("/root/client_secrets.json").st_size == 0:
|
if os.stat("/root/client_secrets.json").st_size == 0:
|
||||||
logging.error("[gDriveSync] /root/client_secrets.json is empty. Please RTFM!")
|
logging.error("[gDriveSync] /root/client_secrets.json is empty. Please RTFM!")
|
||||||
return
|
return
|
||||||
@ -89,6 +91,7 @@ class GdriveSync(plugins.Plugin):
|
|||||||
|
|
||||||
# Upload the zip archive to Google Drive
|
# 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']))
|
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.backup = True
|
||||||
self.status.update()
|
self.status.update()
|
||||||
|
|
||||||
@ -100,6 +103,8 @@ class GdriveSync(plugins.Plugin):
|
|||||||
if zip_file_id:
|
if zip_file_id:
|
||||||
zip_file = self.drive.CreateFile({'id': zip_file_id})
|
zip_file = self.drive.CreateFile({'id': zip_file_id})
|
||||||
zip_file.GetContentFile(os.path.join(local_backup_path, 'backup.zip'))
|
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")
|
logging.info("[gDriveSync] Downloaded backup.zip from Google Drive")
|
||||||
|
|
||||||
# Extract the zip archive to the root directory
|
# Extract the zip archive to the root directory
|
||||||
@ -168,6 +173,7 @@ class GdriveSync(plugins.Plugin):
|
|||||||
self.internet = True
|
self.internet = True
|
||||||
|
|
||||||
def on_handshake(self, agent):
|
def on_handshake(self, agent):
|
||||||
|
display = agent.view()
|
||||||
if not self.ready and not self.internet:
|
if not self.ready and not self.internet:
|
||||||
return
|
return
|
||||||
if self.lock.locked():
|
if self.lock.locked():
|
||||||
@ -193,6 +199,7 @@ class GdriveSync(plugins.Plugin):
|
|||||||
|
|
||||||
# Upload the zip archive to Google Drive
|
# 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']))
|
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
|
# Cleanup the local zip file
|
||||||
os.remove(zip_file_path)
|
os.remove(zip_file_path)
|
||||||
|
@ -162,6 +162,9 @@ class Voice:
|
|||||||
def on_uploading(self, to):
|
def on_uploading(self, to):
|
||||||
return self._("Uploading data to {to} ...").format(to=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):
|
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:
|
||||||
|
Reference in New Issue
Block a user