From d84431b58c6af4d45cc05a8e24413c1e5fec49bc Mon Sep 17 00:00:00 2001 From: Weebzo <74221482+weebzo@users.noreply.github.com> Date: Sat, 12 Feb 2022 18:04:25 -0800 Subject: [PATCH 1/3] added forgotten Initialization checks --- keyauth.py | 64 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 43 insertions(+), 21 deletions(-) diff --git a/keyauth.py b/keyauth.py index f32eb3e..d01bf4e 100644 --- a/keyauth.py +++ b/keyauth.py @@ -36,6 +36,7 @@ def __init__(self, name, ownerid, secret, version): self.version = version sessionid = enckey = "" + initialized = False def init(self): @@ -61,13 +62,25 @@ def init(self): response = encryption.decrypt(response, self.secret, init_iv) json = jsond.loads(response) + if json["message"] == "invalidver": + if json["download"] != "": + print("New Version Available") + download_link = json["download"] + os.system(f"start {download_link}") + sys.exit() + else: + print("Invalid Version, Contact owner to add download link to latest app version") + sys.exit() + if not json["success"]: print(json["message"]) sys.exit() self.sessionid = json["sessionid"] + self.initialized = True def register(self, user, password, license, hwid=None): + self.checkinit() if hwid is None: hwid = others.get_hwid() @@ -98,7 +111,7 @@ def register(self, user, password, license, hwid=None): sys.exit() def upgrade(self, user, license): - + self.checkinit() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { @@ -124,6 +137,7 @@ def upgrade(self, user, license): sys.exit() def login(self, user, password, hwid=None): + self.checkinit() if hwid is None: hwid = others.get_hwid() @@ -154,6 +168,7 @@ def login(self, user, password, hwid=None): sys.exit() def license(self, key, hwid=None): + self.checkinit() if hwid is None: hwid = others.get_hwid() @@ -182,7 +197,7 @@ def license(self, key, hwid=None): sys.exit() def var(self, name): - + self.checkinit() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { @@ -208,7 +223,7 @@ def var(self, name): sys.exit() def file(self, fileid): - + self.checkinit() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { @@ -231,53 +246,55 @@ def file(self, fileid): time.sleep(5) sys.exit() return binascii.unhexlify(json["contents"]) - - def check(self): + + def webhook(self, webid, param): + self.checkinit() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() + post_data = { - "type": binascii.hexlify(("check").encode()), + "type": binascii.hexlify(("webhook").encode()), + "webid": encryption.encrypt(webid, self.enckey, init_iv), + "params": encryption.encrypt(param, self.enckey, init_iv), "sessionid": binascii.hexlify(self.sessionid.encode()), "name": binascii.hexlify(self.name.encode()), "ownerid": binascii.hexlify(self.ownerid.encode()), "init_iv": init_iv } + response = self.__do_request(post_data) response = encryption.decrypt(response, self.enckey, init_iv) json = jsond.loads(response) + if json["success"]: - return True + return json["message"] else: - return False - - def webhook(self, webid, param): + print(json["message"]) + time.sleep(5) + sys.exit() + def check(self): + self.checkinit() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() - post_data = { - "type": binascii.hexlify(("webhook").encode()), - "webid": encryption.encrypt(webid, self.enckey, init_iv), - "params": encryption.encrypt(param, self.enckey, init_iv), + "type": binascii.hexlify(("check").encode()), "sessionid": binascii.hexlify(self.sessionid.encode()), "name": binascii.hexlify(self.name.encode()), "ownerid": binascii.hexlify(self.ownerid.encode()), "init_iv": init_iv } - response = self.__do_request(post_data) response = encryption.decrypt(response, self.enckey, init_iv) json = jsond.loads(response) - if json["success"]: - return json["message"] + return True else: - print(json["message"]) - time.sleep(5) - sys.exit() + return False - def log(self, message): + def log(self, message): + self.checkinit() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { @@ -292,6 +309,11 @@ def log(self, message): self.__do_request(post_data) + def checkinit(self): + if not self.initialized: + print("Initialize first, in order to use the functions") + sys.exit() + def __do_request(self, post_data): rq_out = requests.post( From 4f7b50cfae66b49ccbc1846c97f6faf2d4a7b83e Mon Sep 17 00:00:00 2001 From: Weebzo <74221482+weebzo@users.noreply.github.com> Date: Sat, 12 Feb 2022 22:33:48 -0800 Subject: [PATCH 2/3] Added missing features Added Ban function Added Get/set user var function Added Check Blacklist function Added Init Checks --- keyauth.py | 98 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 88 insertions(+), 10 deletions(-) diff --git a/keyauth.py b/keyauth.py index 476c329..4b46912 100644 --- a/keyauth.py +++ b/keyauth.py @@ -61,16 +61,6 @@ def init(self): response = encryption.decrypt(response, self.secret, init_iv) json = jsond.loads(response) - - if json["message"] == "invalidver": - if json["download"] != "": - print("New Version Available") - download_link = json["download"] - os.system(f"start {download_link}") - sys.exit() - else: - print("Invalid Version, Contact owner to add download link to latest app version") - sys.exit() if json["message"] == "invalidver": if json["download"] != "": @@ -89,6 +79,8 @@ def init(self): self.sessionid = json["sessionid"] self.initialized = True + + def register(self, user, password, license, hwid=None): self.checkinit() if hwid is None: @@ -232,6 +224,71 @@ def var(self, name): time.sleep(5) sys.exit() + def getvar(self, var_name): + self.checkinit() + init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() + + post_data = { + "type": binascii.hexlify(("getvar").encode()), + "var": encryption.encrypt(var_name, self.enckey, init_iv), + "sessionid": binascii.hexlify(self.sessionid.encode()), + "name": binascii.hexlify(self.name.encode()), + "ownerid": binascii.hexlify(self.ownerid.encode()), + "init_iv": init_iv + } + response = self.__do_request(post_data) + response = encryption.decrypt(response, self.enckey, init_iv) + json = jsond.loads(response) + + if json["success"]: + return json["response"] + else: + print(json["message"]) + time.sleep(5) + sys.exit() + + def setvar(self, var_name, var_data): + self.checkinit() + init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() + post_data = { + "type": binascii.hexlify(("setvar").encode()), + "var": encryption.encrypt(var_name, self.enckey, init_iv), + "data": encryption.encrypt(var_data, self.enckey, init_iv), + "sessionid": binascii.hexlify(self.sessionid.encode()), + "name": binascii.hexlify(self.name.encode()), + "ownerid": binascii.hexlify(self.ownerid.encode()), + "init_iv": init_iv + } + response = self.__do_request(post_data) + response = encryption.decrypt(response, self.enckey, init_iv) + + if json["success"]: + return True + else: + print(json["message"]) + time.sleep(5) + sys.exit() + + def ban(self): + self.checkinit() + init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() + post_data = { + "type": binascii.hexlify(("ban").encode()), + "sessionid": binascii.hexlify(self.sessionid.encode()), + "name": binascii.hexlify(self.name.encode()), + "ownerid": binascii.hexlify(self.ownerid.encode()), + "init_iv": init_iv + } + response = self.__do_request(post_data) + response = encryption.decrypt(response, self.enckey, init_iv) + + if json["success"]: + return True + else: + print(json["message"]) + time.sleep(5) + sys.exit() + def file(self, fileid): self.checkinit() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() @@ -302,6 +359,26 @@ def check(self): else: return False + def checkblacklist(self): + self.checkinit() + hwid = others.get_hwid() + init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() + post_data = { + "type": binascii.hexlify(("checkblacklist").encode()), + "hwid": encryption.encrypt(hwid, self.enckey, init_iv), + "sessionid": binascii.hexlify(self.sessionid.encode()), + "name": binascii.hexlify(self.name.encode()), + "ownerid": binascii.hexlify(self.ownerid.encode()), + "init_iv": init_iv + } + response = self.__do_request(post_data) + + response = encryption.decrypt(response, self.enckey, init_iv) + json = jsond.loads(response) + if json["success"]: + return True + else: + return False def log(self, message): self.checkinit() @@ -348,6 +425,7 @@ def __load_user_data(self, data): self.user_data.subcription = data["subscriptions"][0]["subscription"] + class others: @staticmethod def get_hwid(): From c70866f5556f13ec315348597c373b787e9aeac7 Mon Sep 17 00:00:00 2001 From: Weebzo <74221482+weebzo@users.noreply.github.com> Date: Sat, 12 Feb 2022 22:44:36 -0800 Subject: [PATCH 3/3] Fixes --- keyauth.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/keyauth.py b/keyauth.py index 4b46912..61ba40e 100644 --- a/keyauth.py +++ b/keyauth.py @@ -261,6 +261,7 @@ def setvar(self, var_name, var_data): } response = self.__do_request(post_data) response = encryption.decrypt(response, self.enckey, init_iv) + json = jsond.loads(response) if json["success"]: return True @@ -281,6 +282,7 @@ def ban(self): } response = self.__do_request(post_data) response = encryption.decrypt(response, self.enckey, init_iv) + json = jsond.loads(response) if json["success"]: return True