Example #1
0
 def update_app(self, updated_app):
     app = App.get(App.executable == updated_app.executable)
     if app:
         app.executable = updated_app.executable
         app.exec_hash = updated_app.exec_hash
         app.save()
         return app.id
     return -1
Example #2
0
 def save_password(self, connected_app, username, password):
     app = App.get(App.executable == connected_app.executable)
     if app:
         save_info = SavedInfo()
         save_info.app = app
         save_info.username = username
         save_info.password = EncodeAES(self.cypher, password)
         save_info.save()
         return save_info.id
     return -1
Example #3
0
 def register_app(self, new_app):
     app = App.select().where(App.executable == new_app.executable)
     if not app.exists():
         app = App()
         app.executable = new_app.executable
         app.exec_hash = new_app.exec_hash
         app.save()
         return app.id
     return -1
Example #4
0
def approver(app):
    exec_eq = App.select().where(App.executable == app.executable)
    both_eq = exec_eq.where(App.exec_hash == app.exec_hash)

    if both_eq.exists():
        return True
    if exec_eq.exists(): #app update
        if run_viewer(app, "app's hash changed and now wants to update?"):
            API().update_app(app)
            return True
    else: #new app wants to connect
        if run_viewer(app, "new apps wants to connect allow or reject?"):
            API().register_app(app)
            return True
    return False
Example #5
0
 def get_password(self, connected_app, saved_id):
     saved = SavedInfo.select().where(SavedInfo.id == saved_id)
     app = App.get(App.executable == connected_app.executable)
     if saved.exists() and app == saved[0].app:
         return saved[0].id, saved[0].username, DecodeAES(self.cypher, saved[0].password)
     return -1, -1, -1