Skip to content

Commit c523787

Browse files
authored
Update keyauth.py
1 parent c1d1589 commit c523787

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

keyauth.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,28 @@ def checkinit(self):
499499
time.sleep(2)
500500
os._exit(1)
501501

502+
def changeUsername(self, username):
503+
self.checkinit()
504+
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()
505+
post_data = {
506+
"type": binascii.hexlify("changeUsername".encode()),
507+
"newUsername": username,
508+
"sessionid": binascii.hexlify(self.sessionid.encode()),
509+
"name": binascii.hexlify(self.name.encode()),
510+
"ownerid": binascii.hexlify(self.ownerid.encode()),
511+
"init_iv": init_iv
512+
}
513+
514+
response = self.__do_request(post_data)
515+
response = encryption.decrypt(response, self.enckey, init_iv)
516+
json = jsond.loads(response)
517+
518+
if json["success"]:
519+
print("successfully Changed Username")
520+
else:
521+
print(json["message"])
522+
os._exit(1)
523+
502524
def __do_request(self, post_data):
503525
try:
504526
rq_out = s.post(

0 commit comments

Comments
 (0)