Merge pull request #44 from mazk5145/main · mazkdevf/KeyAuth-Python-Example@9f8f28d · GitHub
Skip to content

Commit 9f8f28d

Browse files
authored
Merge pull request KeyAuth#44 from mazk5145/main
Added FetchOnline, ChatGet, ChatGet + Examples for them
2 parents 22c286b + 716b5cb commit 9f8f28d

4 files changed

Lines changed: 99 additions & 4 deletions

File tree

LICENSE

Lines changed: 1 addition & 1 deletion

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# KeyAuth-Python-Example
2-
KeyAuth Python Example For The https://keyauth.win Authentication system.
2+
KeyAuth Python Example For The https://keyauth.cc Authentication system.
33

44
# Instructions
55

@@ -20,4 +20,4 @@ Setup video: https://www.youtube.com/watch?v=L2eAQOmuUiA
2020
**What is KeyAuth?**
2121

2222
KeyAuth is a GameChanging authentication system. We have never-seen before features, and we listen to our customers.
23-
Feel free to join https://keyauth.win/discord/ if you have questions or suggestions.
23+
Feel free to join https://keyauth.cc/discord/ if you have questions or suggestions.

keyauth.py

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,78 @@ def log(self, message):
412412
}
413413

414414
self.__do_request(post_data)
415+
416+
def fetchOnline(self):
417+
self.checkinit()
418+
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()
419+
420+
post_data = {
421+
"type": binascii.hexlify(("fetchOnline").encode()),
422+
"sessionid": binascii.hexlify(self.sessionid.encode()),
423+
"name": binascii.hexlify(self.name.encode()),
424+
"ownerid": binascii.hexlify(self.ownerid.encode()),
425+
"init_iv": init_iv
426+
}
427+
428+
response = self.__do_request(post_data)
429+
response = encryption.decrypt(response, self.enckey, init_iv)
430+
431+
json = jsond.loads(response)
432+
433+
if json["success"]:
434+
if json["users"]["0"]:
435+
return None ## THIS IS ISSUE ON KEYAUTH SERVER SIDE 6.8.2022 so it will return none if it is not an array.
436+
else:
437+
return json["users"]
438+
else:
439+
return None
440+
441+
def chatGet(self, channel):
442+
self.checkinit()
443+
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()
444+
445+
post_data = {
446+
"type": binascii.hexlify(("chatget").encode()),
447+
"channel": encryption.encrypt(channel, self.enckey, init_iv),
448+
"sessionid": binascii.hexlify(self.sessionid.encode()),
449+
"name": binascii.hexlify(self.name.encode()),
450+
"ownerid": binascii.hexlify(self.ownerid.encode()),
451+
"init_iv": init_iv
452+
}
453+
454+
response = self.__do_request(post_data)
455+
response = encryption.decrypt(response, self.enckey, init_iv)
456+
457+
json = jsond.loads(response)
458+
459+
if json["success"]:
460+
return json["messages"]
461+
else:
462+
return None
463+
464+
def chatSend(self, message, channel):
465+
self.checkinit()
466+
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()
467+
468+
post_data = {
469+
"type": binascii.hexlify(("chatsend").encode()),
470+
"message": encryption.encrypt(message, self.enckey, init_iv),
471+
"channel": encryption.encrypt(channel, self.enckey, init_iv),
472+
"sessionid": binascii.hexlify(self.sessionid.encode()),
473+
"name": binascii.hexlify(self.name.encode()),
474+
"ownerid": binascii.hexlify(self.ownerid.encode()),
475+
"init_iv": init_iv
476+
}
477+
478+
response = self.__do_request(post_data)
479+
response = encryption.decrypt(response, self.enckey, init_iv)
480+
481+
json = jsond.loads(response)
482+
483+
if json["success"]:
484+
return True
485+
else:
486+
return False
415487

416488
def checkinit(self):
417489
if not self.initialized:
@@ -430,7 +502,7 @@ class application_data_class:
430502
numUsers = numKeys = app_ver = customer_panel = onlineUsers = ""
431503
# region user_data
432504
class user_data_class:
433-
username = ip = hwid = expires = createdate = lastlogin = subscription = ""
505+
username = ip = hwid = expires = createdate = lastlogin = subscription = subscriptions ""
434506

435507
user_data = user_data_class()
436508
app_data = application_data_class()

main.py

Lines changed: 23 additions & 0 deletions

0 commit comments

Comments
 (0)