import binascii # hex encoding import hashlib import json as jsond # json import os import platform # check platform import subprocess # needed for mac device import sys import time # sleep before exit from datetime import datetime from time import sleep from uuid import uuid4 # gen random guid try: if os.name == 'nt': import win32security # get sid (WIN only) import requests # https requests from Crypto.Cipher import AES from Crypto.Hash import SHA256 from Crypto.Util.Padding import pad, unpad except ModuleNotFoundError: print("Exception when importing modules") print("Installing necessary modules....") if os.path.isfile("requirements.txt"): os.system("pip install -r requirements.txt") else: os.system("pip install pywin32") os.system("pip install pycryptodome") os.system("pip install requests") print("Modules installed!") time.sleep(1.5) os._exit(1) try: # Connection check s = requests.Session() # Session s.get('https://google.com') except requests.exceptions.RequestException as e: print(e) time.sleep(3) os._exit(1) class api: name = ownerid = secret = version = hash_to_check = "" def __init__(self, name, ownerid, secret, version, hash_to_check): self.name = name self.ownerid = ownerid self.secret = secret self.version = version self.hash_to_check = hash_to_check self.init() sessionid = enckey = "" initialized = False def init(self): if self.sessionid != "": print("You've already initialized!") time.sleep(2) os._exit(1) init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() self.enckey = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { "type": binascii.hexlify(("init").encode()), "ver": encryption.encrypt(self.version, self.secret, init_iv), "hash": self.hash_to_check, "enckey": encryption.encrypt(self.enckey, self.secret, init_iv), "name": binascii.hexlify(self.name.encode()), "ownerid": binascii.hexlify(self.ownerid.encode()), "init_iv": init_iv } response = self.__do_request(post_data) if response == "KeyAuth_Invalid": print("The application doesn't exist") os._exit(1) 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}") os._exit(1) else: print("Invalid Version, Contact owner to add download link to latest app version") os._exit(1) if not json["success"]: print(json["message"]) os._exit(1) self.sessionid = json["sessionid"] self.initialized = True self.__load_app_data(json["appinfo"]) def register(self, user, password, license, hwid=None): self.checkinit() if hwid is None: hwid = others.get_hwid() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { "type": binascii.hexlify(("register").encode()), "username": encryption.encrypt(user, self.enckey, init_iv), "pass": encryption.encrypt(password, self.enckey, init_iv), "key": encryption.encrypt(license, self.enckey, init_iv), "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"]: print("successfully registered") self.__load_user_data(json["info"]) else: print(json["message"]) os._exit(1) def upgrade(self, user, license): self.checkinit() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { "type": binascii.hexlify(("upgrade").encode()), "username": encryption.encrypt(user, self.enckey, init_iv), "key": encryption.encrypt(license, 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"]: print("successfully upgraded user") print("please restart program and login") time.sleep(2) os._exit(1) else: print(json["message"]) os._exit(1) def login(self, user, password, hwid=None): self.checkinit() if hwid is None: hwid = others.get_hwid() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { "type": binascii.hexlify(("login").encode()), "username": encryption.encrypt(user, self.enckey, init_iv), "pass": encryption.encrypt(password, self.enckey, init_iv), "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"]: self.__load_user_data(json["info"]) print("successfully logged in") else: print(json["message"]) os._exit(1) def license(self, key, hwid=None): self.checkinit() if hwid is None: hwid = others.get_hwid() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { "type": binascii.hexlify(("license").encode()), "key": encryption.encrypt(key, self.enckey, init_iv), "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"]: self.__load_user_data(json["info"]) print("successfully logged into license") else: print(json["message"]) os._exit(1) def var(self, name): self.checkinit() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { "type": binascii.hexlify(("var").encode()), "varid": encryption.encrypt(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["message"] else: print(json["message"]) time.sleep(5) os._exit(1) 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) os._exit(1) 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) json = jsond.loads(response) if json["success"]: return True else: print(json["message"]) time.sleep(5) os._exit(1) 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) json = jsond.loads(response) if json["success"]: return True else: print(json["message"]) time.sleep(5) os._exit(1) def file(self, fileid): self.checkinit() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { "type": binascii.hexlify(("file").encode()), "fileid": encryption.encrypt(fileid, 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 not json["success"]: print(json["message"]) time.sleep(5) os._exit(1) return binascii.unhexlify(json["contents"]) def webhook(self, webid, param, body = "", conttype = ""): 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), "body": encryption.encrypt(body, self.enckey, init_iv), "conttype": encryption.encrypt(conttype, 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["message"] else: print(json["message"]) time.sleep(5) os._exit(1) def check(self): self.checkinit() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { "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 True 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() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { "type": binascii.hexlify(("log").encode()), "pcuser": encryption.encrypt(os.getenv('username'), self.enckey, init_iv), "message": encryption.encrypt(message, 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 } self.__do_request(post_data) def fetchOnline(self): self.checkinit() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { "type": binascii.hexlify(("fetchOnline").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"]: if len(json["users"]) == 0: return None # THIS IS ISSUE ON KEYAUTH SERVER SIDE 6.8.2022, so it will return none if it is not an array. else: return json["users"] else: return None def chatGet(self, channel): self.checkinit() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { "type": binascii.hexlify(("chatget").encode()), "channel": encryption.encrypt(channel, 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["messages"] else: return None def chatSend(self, message, channel): self.checkinit() init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest() post_data = { "type": binascii.hexlify(("chatsend").encode()), "message": encryption.encrypt(message, self.enckey, init_iv), "channel": encryption.encrypt(channel, 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 checkinit(self): if not self.initialized: print("Initialize first, in order to use the functions") time.sleep(2) os._exit(1) def __do_request(self, post_data): try: rq_out = s.post( "https://keyauth.win/api/1.0/", data=post_data, timeout=30 ) return rq_out.text except requests.exceptions.Timeout: print("Request timed out") class application_data_class: numUsers = numKeys = app_ver = customer_panel = onlineUsers = "" # region user_data class user_data_class: username = ip = hwid = expires = createdate = lastlogin = subscription = subscriptions = "" user_data = user_data_class() app_data = application_data_class() def __load_app_data(self, data): self.app_data.numUsers = data["numUsers"] self.app_data.numKeys = data["numKeys"] self.app_data.app_ver = data["version"] self.app_data.customer_panel = data["customerPanelLink"] self.app_data.onlineUsers = data["numOnlineUsers"] def __load_user_data(self, data): self.user_data.username = data["username"] self.user_data.ip = data["ip"] self.user_data.hwid = data["hwid"] self.user_data.expires = data["subscriptions"][0]["expiry"] self.user_data.createdate = data["createdate"] self.user_data.lastlogin = data["lastlogin"] self.user_data.subscription = data["subscriptions"][0]["subscription"] self.user_data.subscriptions = data["subscriptions"] class others: @staticmethod def get_hwid(): if platform.system() == "Linux": with open("/etc/machine-id") as f: hwid = f.read() return hwid elif platform.system() == 'Windows': winuser = os.getlogin() sid = win32security.LookupAccountName(None, winuser)[0] hwid = win32security.ConvertSidToStringSid(sid) return hwid elif platform.system() == 'Darwin': output = subprocess.Popen("ioreg -l | grep IOPlatformSerialNumber", stdout=subprocess.PIPE, shell=True).communicate()[0] serial = output.decode().split('=', 1)[1].replace(' ', '') hwid = serial[1:-2] return hwid class encryption: @staticmethod def encrypt_string(plain_text, key, iv): plain_text = pad(plain_text, 16) aes_instance = AES.new(key, AES.MODE_CBC, iv) raw_out = aes_instance.encrypt(plain_text) return binascii.hexlify(raw_out) @staticmethod def decrypt_string(cipher_text, key, iv): cipher_text = binascii.unhexlify(cipher_text) aes_instance = AES.new(key, AES.MODE_CBC, iv) cipher_text = aes_instance.decrypt(cipher_text) return unpad(cipher_text, 16) @staticmethod def encrypt(message, enc_key, iv): try: _key = SHA256.new(enc_key.encode()).hexdigest()[:32] _iv = SHA256.new(iv.encode()).hexdigest()[:16] return encryption.encrypt_string(message.encode(), _key.encode(), _iv.encode()).decode() except: print("Invalid Application Information. Long text is secret short text is ownerid. Name is supposed to be app name not username") os._exit(1) @staticmethod def decrypt(message, enc_key, iv): try: _key = SHA256.new(enc_key.encode()).hexdigest()[:32] _iv = SHA256.new(iv.encode()).hexdigest()[:16] return encryption.decrypt_string(message.encode(), _key.encode(), _iv.encode()).decode() except: print("Invalid Application Information. Long text is secret short text is ownerid. Name is supposed to be app name not username") os._exit(1) # import json as jsond # ^^ only for auto login/json writing/reading # watch setup video if you need help https://www.youtube.com/watch?v=L2eAQOmuUiA if sys.version_info.minor < 10: # Python version check (Bypass Patch) print("[Security] - Python 3.10 or higher is recommended. The bypass will not work on 3.10+") print("You are using Python {}.{}".format(sys.version_info.major, sys.version_info.minor)) if platform.system() == 'Windows': os.system('cls & title Python Example') # clear console, change title elif platform.system() == 'Linux': os.system('clear') # clear console sys.stdout.write("\x1b]0;Python Example\x07") # change title elif platform.system() == 'Darwin': os.system("clear && printf '\e[3J'") # clear console os.system('''echo - n - e "\033]0;Python Example\007"''') # change title print("Initializing") def getchecksum(): md5_hash = hashlib.md5() file = open(''.join(sys.argv), "rb") md5_hash.update(file.read()) digest = md5_hash.hexdigest() return digest keyauthapp = api( name = "", #App name (Manage Applications --> Application name) ownerid = "", #Owner ID (Account-Settings --> OwnerID) secret = "", #App secret(Manage Applications --> App credentials code) version = "1.0", hash_to_check = getchecksum() ) print(f""" App data: Number of users: {keyauthapp.app_data.numUsers} Number of online users: {keyauthapp.app_data.onlineUsers} Number of keys: {keyauthapp.app_data.numKeys} Application Version: {keyauthapp.app_data.app_ver} Customer panel link: {keyauthapp.app_data.customer_panel} """) print(f"Current Session Validation Status: {keyauthapp.check()}") print(f"Blacklisted? : {keyauthapp.checkblacklist()}") # check if blacklisted, you can edit this and make it exit the program if blacklisted def answer(): try: print(""" 1.Login 2.Register 3.Upgrade 4.License Key Only """) ans = input("Select Option: ") if ans == "1": user = input('Provide username: ') password = input('Provide password: ') keyauthapp.login(user, password) elif ans == "2": user = input('Provide username: ') password = input('Provide password: ') license = input('Provide License: ') keyauthapp.register(user, password, license) elif ans == "3": user = input('Provide username: ') license = input('Provide License: ') keyauthapp.upgrade(user, license) elif ans == "4": key = input('Enter your license: ') keyauthapp.license(key) else: print("\nNot Valid Option") time.sleep(1) os.system('cls') answer() except KeyboardInterrupt: os._exit(1) answer() # region Extra Functions # * Download Files form the server to your computer using the download function in the api class # bytes = keyauthapp.file("FILEID") # f = open("example.exe", "wb") # f.write(bytes) # f.close() # * Set up user variable # keyauthapp.setvar("varName", "varValue") # * Get user variable and print it # data = keyauthapp.getvar("varName") # print(data) # * Get normal variable and print it # data = keyauthapp.var("varName") # print(data) # * Log message to the server and then to your webhook what is set on app settings # keyauthapp.log("Message") # * Get if the user pc have been blacklisted # print(f"Blacklisted? : {keyauthapp.checkblacklist()}") # * See if the current session is validated # print(f"Session Validated?: {keyauthapp.check()}") # * example to send normal request with no POST data # data = keyauthapp.webhook("WebhookID", "?type=resetuser&user=username") # * example to send form data # data = keyauthapp.webhook("WebhookID", "", "type=init&name=test&ownerid=j9Gj0FTemM", "application/x-www-form-urlencoded") # * example to send JSON # data = keyauthapp.webhook("WebhookID", "", "{\"content\": \"webhook message here\",\"embeds\": null}", "application/json") # * Get chat messages # messages = keyauthapp.chatGet("CHANNEL") # Messages = "" # for i in range(len(messages)): # Messages += datetime.utcfromtimestamp(int(messages[i]["timestamp"])).strftime('%Y-%m-%d %H:%M:%S') + " - " + messages[i]["author"] + ": " + messages[i]["message"] + "\n" # print("\n\n" + Messages) # * Send chat message # keyauthapp.chatSend("MESSAGE", "CHANNEL") # * Add Application Information to Title # os.system(f"cls & title KeyAuth Python Example - Total Users: {keyauthapp.app_data.numUsers} - Online Users: {keyauthapp.app_data.onlineUsers} - Total Keys: {keyauthapp.app_data.numKeys}") # * Auto-Login Example (THIS IS JUST AN EXAMPLE --> YOU WILL HAVE TO EDIT THE CODE PROBABLY) # 1. Checking and Reading JSON #### Note: Remove the ''' on line 151 and 226 '''try: if os.path.isfile('auth.json'): #Checking if the auth file exist if jsond.load(open("auth.json"))["authusername"] == "": #Checks if the authusername is empty or not print(""" 1. Login 2. Register """) ans=input("Select Option: ") #Skipping auto-login bc auth file is empty if ans=="1": user = input('Provide username: ') password = input('Provide password: ') keyauthapp.login(user,password) authfile = jsond.load(open("auth.json")) authfile["authusername"] = user authfile["authpassword"] = password jsond.dump(authfile, open('auth.json', 'w'), sort_keys=False, indent=4) elif ans=="2": user = input('Provide username: ') password = input('Provide password: ') license = input('Provide License: ') keyauthapp.register(user,password,license) authfile = jsond.load(open("auth.json")) authfile["authusername"] = user authfile["authpassword"] = password jsond.dump(authfile, open('auth.json', 'w'), sort_keys=False, indent=4) else: print("\nNot Valid Option") os._exit(1) else: try: #2. Auto login with open('auth.json', 'r') as f: authfile = jsond.load(f) authuser = authfile.get('authusername') authpass = authfile.get('authpassword') keyauthapp.login(authuser,authpass) except Exception as e: #Error stuff print(e) else: #Creating auth file bc its missing try: f = open("auth.json", "a") #Writing content f.write("""{ "authusername": "", "authpassword": "" }""") f.close() print (""" 1. Login 2. Register """)#Again skipping auto-login bc the file is empty/missing ans=input("Select Option: ") if ans=="1": user = input('Provide username: ') password = input('Provide password: ') keyauthapp.login(user,password) authfile = jsond.load(open("auth.json")) authfile["authusername"] = user authfile["authpassword"] = password jsond.dump(authfile, open('auth.json', 'w'), sort_keys=False, indent=4) elif ans=="2": user = input('Provide username: ') password = input('Provide password: ') license = input('Provide License: ') keyauthapp.register(user,password,license) authfile = jsond.load(open("auth.json")) authfile["authusername"] = user authfile["authpassword"] = password jsond.dump(authfile, open('auth.json', 'w'), sort_keys=False, indent=4) else: print("\nNot Valid Option") os._exit(1) except Exception as e: #Error stuff print(e) os._exit(1) except Exception as e: #Error stuff print(e) os._exit(1)''' # endregion print("\nUser data: ") print("Username: " + keyauthapp.user_data.username) print("IP address: " + keyauthapp.user_data.ip) print("Hardware-Id: " + keyauthapp.user_data.hwid) # print("Subcription: " + keyauthapp.user_data.subscription) ## Print Subscription "ONE" name subs = keyauthapp.user_data.subscriptions # Get all Subscription names, expiry, and timeleft for i in range(len(subs)): sub = subs[i]["subscription"] # Subscription from every Sub expiry = datetime.utcfromtimestamp(int(subs[i]["expiry"])).strftime( '%Y-%m-%d %H:%M:%S') # Expiry date from every Sub timeleft = subs[i]["timeleft"] # Timeleft from every Sub print(f"[{i + 1} / {len(subs)}] | Subscription: {sub} - Expiry: {expiry} - Timeleft: {timeleft}") onlineUsers = keyauthapp.fetchOnline() OU = "" # KEEP THIS EMPTY FOR NOW, THIS WILL BE USED TO CREATE ONLINE USER STRING. if onlineUsers is None: OU = "No online users" else: for i in range(len(onlineUsers)): OU += onlineUsers[i]["credential"] + " " print("\n" + OU + "\n") print("Created at: " + datetime.utcfromtimestamp(int(keyauthapp.user_data.createdate)).strftime('%Y-%m-%d %H:%M:%S')) print("Last login at: " + datetime.utcfromtimestamp(int(keyauthapp.user_data.lastlogin)).strftime('%Y-%m-%d %H:%M:%S')) print("Expires at: " + datetime.utcfromtimestamp(int(keyauthapp.user_data.expires)).strftime('%Y-%m-%d %H:%M:%S')) print(f"Current Session Validation Status: {keyauthapp.check()}") # Method 1 # Example # Put all your code here, remove the example_program function and the "if __name__ == '__main__':" def example_program(): print("\nHello world.") time.sleep(3) os._exit(1) if __name__ == '__main__': example_program()