Skip to content

Commit 704727d

Browse files
committed
Improve instructions, fix empty HWID error
1 parent 0c86248 commit 704727d

File tree

2 files changed

+50
-43
lines changed

2 files changed

+50
-43
lines changed

keyauth.py

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
s.get('https://google.com')
3232
except requests.exceptions.RequestException as e:
3333
print(e)
34-
time.sleep(5)
34+
time.sleep(3)
3535
os._exit(1)
3636

3737

@@ -57,7 +57,7 @@ def init(self):
5757

5858
if self.sessionid != "":
5959
print("You've already initialized!")
60-
time.sleep(2)
60+
time.sleep(3)
6161
os._exit(1)
6262
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()
6363

@@ -77,7 +77,7 @@ def init(self):
7777

7878
if response == "KeyAuth_Invalid":
7979
print("The application doesn't exist")
80-
time.sleep(5)
80+
time.sleep(3)
8181
os._exit(1)
8282

8383
response = encryption.decrypt(response, self.secret, init_iv)
@@ -92,7 +92,7 @@ def init(self):
9292
os._exit(1)
9393
else:
9494
print("Invalid Version, Contact owner to add download link to latest app version")
95-
time.sleep(5)
95+
time.sleep(3)
9696
os._exit(1)
9797

9898
if not json["success"]:
@@ -132,7 +132,7 @@ def register(self, user, password, license, hwid=None):
132132
self.__load_user_data(json["info"])
133133
else:
134134
print(json["message"])
135-
time.sleep(5)
135+
time.sleep(3)
136136
os._exit(1)
137137

138138
def upgrade(self, user, license):
@@ -156,13 +156,13 @@ def upgrade(self, user, license):
156156
json = jsond.loads(response)
157157

158158
if json["success"]:
159-
print("successfully upgraded user")
160-
print("please restart program and login")
161-
time.sleep(2)
159+
print("Successfully upgraded user")
160+
print("Please restart program and login")
161+
time.sleep(3)
162162
os._exit(1)
163163
else:
164164
print(json["message"])
165-
time.sleep(5)
165+
time.sleep(3)
166166
os._exit(1)
167167

168168
def login(self, user, password, hwid=None):
@@ -191,10 +191,10 @@ def login(self, user, password, hwid=None):
191191

192192
if json["success"]:
193193
self.__load_user_data(json["info"])
194-
print("successfully logged in")
194+
print("Successfully logged in")
195195
else:
196196
print(json["message"])
197-
time.sleep(5)
197+
time.sleep(3)
198198
os._exit(1)
199199

200200
def license(self, key, hwid=None):
@@ -221,10 +221,10 @@ def license(self, key, hwid=None):
221221

222222
if json["success"]:
223223
self.__load_user_data(json["info"])
224-
print("successfully logged into license")
224+
print("Successfully logged in with license")
225225
else:
226226
print(json["message"])
227-
time.sleep(5)
227+
time.sleep(3)
228228
os._exit(1)
229229

230230
def var(self, name):
@@ -250,7 +250,7 @@ def var(self, name):
250250
return json["message"]
251251
else:
252252
print(json["message"])
253-
time.sleep(5)
253+
time.sleep(3)
254254
os._exit(1)
255255

256256
def getvar(self, var_name):
@@ -274,7 +274,7 @@ def getvar(self, var_name):
274274
else:
275275
print(f"NOTE: This is commonly misunderstood. This is for user variables, not the normal variables.\nUse keyauthapp.var(\"{var_name}\") for normal variables");
276276
print(json["message"])
277-
time.sleep(5)
277+
time.sleep(3)
278278
os._exit(1)
279279

280280
def setvar(self, var_name, var_data):
@@ -297,7 +297,7 @@ def setvar(self, var_name, var_data):
297297
return True
298298
else:
299299
print(json["message"])
300-
time.sleep(5)
300+
time.sleep(3)
301301
os._exit(1)
302302

303303
def ban(self):
@@ -318,7 +318,7 @@ def ban(self):
318318
return True
319319
else:
320320
print(json["message"])
321-
time.sleep(5)
321+
time.sleep(3)
322322
os._exit(1)
323323

324324
def file(self, fileid):
@@ -342,7 +342,7 @@ def file(self, fileid):
342342

343343
if not json["success"]:
344344
print(json["message"])
345-
time.sleep(5)
345+
time.sleep(3)
346346
os._exit(1)
347347
return binascii.unhexlify(json["contents"])
348348

@@ -371,7 +371,7 @@ def webhook(self, webid, param, body = "", conttype = ""):
371371
return json["message"]
372372
else:
373373
print(json["message"])
374-
time.sleep(5)
374+
time.sleep(3)
375375
os._exit(1)
376376

377377
def check(self):
@@ -505,7 +505,7 @@ def chatSend(self, message, channel):
505505
def checkinit(self):
506506
if not self.initialized:
507507
print("Initialize first, in order to use the functions")
508-
time.sleep(2)
508+
time.sleep(3)
509509
os._exit(1)
510510

511511
def changeUsername(self, username):
@@ -525,10 +525,10 @@ def changeUsername(self, username):
525525
json = jsond.loads(response)
526526

527527
if json["success"]:
528-
print("successfully Changed Username")
528+
print("Successfully changed username")
529529
else:
530530
print(json["message"])
531-
time.sleep(5)
531+
time.sleep(3)
532532
os._exit(1)
533533

534534
def __do_request(self, post_data):
@@ -560,7 +560,7 @@ def __load_app_data(self, data):
560560
def __load_user_data(self, data):
561561
self.user_data.username = data["username"]
562562
self.user_data.ip = data["ip"]
563-
self.user_data.hwid = data["hwid"]
563+
self.user_data.hwid = data["hwid"] or "N/A"
564564
self.user_data.expires = data["subscriptions"][0]["expiry"]
565565
self.user_data.createdate = data["createdate"]
566566
self.user_data.lastlogin = data["lastlogin"]
@@ -618,8 +618,9 @@ def encrypt(message, enc_key, iv):
618618

619619
return encryption.encrypt_string(message.encode(), _key.encode(), _iv.encode()).decode()
620620
except:
621-
print("Invalid Application Information. Long text is secret short text is ownerid. Name is supposed to be app name not username")
622-
time.sleep(5)
621+
print("Encryption error. Make sure your app details are correct, see response below")
622+
print("Response: " + message)
623+
time.sleep(3)
623624
os._exit(1)
624625

625626
@staticmethod
@@ -631,6 +632,7 @@ def decrypt(message, enc_key, iv):
631632

632633
return encryption.decrypt_string(message.encode(), _key.encode(), _iv.encode()).decode()
633634
except:
634-
print("Invalid Application Information. Long text is secret short text is ownerid. Name is supposed to be app name not username")
635-
time.sleep(5)
635+
print("Encryption error. Make sure your app details are correct, see response below")
636+
print("Response: " + message)
637+
time.sleep(3)
636638
os._exit(1)

main.py

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
'''
2+
KeyAuth.cc Python Example
3+
4+
Go to https://keyauth.cc/app/ and click the Python tab. Copy that code and replace the existing keyauthapp instance in this file.
5+
6+
If you get an error saying it can't find module KeyAuth, try following this https://github.com/KeyAuth/KeyAuth-Python-Example#how-to-compile
7+
8+
If that doesn't work for you, you can paste the contents of KeyAuth.py ABOVE this comment and then remove the "from keyauth import api" and that should work too.
9+
'''
110
from keyauth import api
211

312
import sys
@@ -13,18 +22,15 @@
1322

1423
# watch setup video if you need help https://www.youtube.com/watch?v=L2eAQOmuUiA
1524

16-
if sys.version_info.minor < 10: # Python version check (Bypass Patch)
17-
print("[Security] - Python 3.10 or higher is recommended. The bypass will not work on 3.10+")
18-
print("You are using Python {}.{}".format(sys.version_info.major, sys.version_info.minor))
19-
20-
if platform.system() == 'Windows':
21-
os.system('cls & title Python Example') # clear console, change title
22-
elif platform.system() == 'Linux':
23-
os.system('clear') # clear console
24-
sys.stdout.write("\x1b]0;Python Example\x07") # change title
25-
elif platform.system() == 'Darwin':
26-
os.system("clear && printf '\e[3J'") # clear console
27-
os.system('''echo - n - e "\033]0;Python Example\007"''') # change title
25+
def clear():
26+
if platform.system() == 'Windows':
27+
os.system('cls & title Python Example') # clear console, change title
28+
elif platform.system() == 'Linux':
29+
os.system('clear') # clear console
30+
sys.stdout.write("\x1b]0;Python Example\x07") # change title
31+
elif platform.system() == 'Darwin':
32+
os.system("clear && printf '\e[3J'") # clear console
33+
os.system('''echo - n - e "\033]0;Python Example\007"''') # change title
2834

2935
print("Initializing")
3036

@@ -56,7 +62,6 @@ def getchecksum():
5662
print(f"Current Session Validation Status: {keyauthapp.check()}")
5763
print(f"Blacklisted? : {keyauthapp.checkblacklist()}") # check if blacklisted, you can edit this and make it exit the program if blacklisted
5864

59-
6065
def answer():
6166
try:
6267
print("""
@@ -83,9 +88,9 @@ def answer():
8388
key = input('Enter your license: ')
8489
keyauthapp.license(key)
8590
else:
86-
print("\nNot Valid Option")
87-
time.sleep(1)
88-
os.system('cls')
91+
print("\nInvalid option")
92+
sleep(1)
93+
clear()
8994
answer()
9095
except KeyboardInterrupt:
9196
os._exit(1)

0 commit comments

Comments
 (0)