@@ -149,11 +149,19 @@ def answer():
149149 user = input('Provide username: ')
150150 password = input('Provide password: ')
151151 keyauthapp.login(user,password)
152+ authfile = jsond.load(open("auth.json"))
153+ authfile["authusername"] = user
154+ authfile["authpassword"] = password
155+ jsond.dump(authfile, open('auth.json', 'w'), sort_keys=False, indent=4)
152156 elif ans=="2":
153157 user = input('Provide username: ')
154158 password = input('Provide password: ')
155159 license = input('Provide License: ')
156160 keyauthapp.register(user,password,license)
161+ authfile = jsond.load(open("auth.json"))
162+ authfile["authusername"] = user
163+ authfile["authpassword"] = password
164+ jsond.dump(authfile, open('auth.json', 'w'), sort_keys=False, indent=4)
157165 else:
158166 print("\n Not Valid Option")
159167 os._exit(1)
@@ -183,11 +191,19 @@ def answer():
183191 user = input('Provide username: ')
184192 password = input('Provide password: ')
185193 keyauthapp.login(user,password)
194+ authfile = jsond.load(open("auth.json"))
195+ authfile["authusername"] = user
196+ authfile["authpassword"] = password
197+ jsond.dump(authfile, open('auth.json', 'w'), sort_keys=False, indent=4)
186198 elif ans=="2":
187199 user = input('Provide username: ')
188200 password = input('Provide password: ')
189201 license = input('Provide License: ')
190- keyauthapp.register(user,password,license)
202+ keyauthapp.register(user,password,license)
203+ authfile = jsond.load(open("auth.json"))
204+ authfile["authusername"] = user
205+ authfile["authpassword"] = password
206+ jsond.dump(authfile, open('auth.json', 'w'), sort_keys=False, indent=4)
191207 else:
192208 print("\n Not Valid Option")
193209 os._exit(1)
@@ -198,50 +214,6 @@ def answer():
198214 print(e)
199215 os._exit(1)'''
200216
201- # Writing user data on login:
202- # Check Keyauth.py file --> Line 158
203- # Replace the whole login function with this login function (This has auto user data dumping, so the user only have to log in once), don't forget to remove the ''' on line 206,243
204- # Note: The auto login function above is needed for this bc it creates the auth file, if the auth file is missing this won't work
205-
206- '''def login(self, user, password, hwid=None):
207- self.checkinit()
208- if hwid is None:
209- hwid = others.get_hwid()
210-
211- init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()
212-
213- post_data = {
214- "type": binascii.hexlify(("login").encode()),
215- "username": encryption.encrypt(user, self.enckey, init_iv),
216- "pass": encryption.encrypt(password, self.enckey, init_iv),
217- "hwid": encryption.encrypt(hwid, self.enckey, init_iv),
218- "sessionid": binascii.hexlify(self.sessionid.encode()),
219- "name": binascii.hexlify(self.name.encode()),
220- "ownerid": binascii.hexlify(self.ownerid.encode()),
221- "init_iv": init_iv
222- }
223-
224- response = self.__do_request(post_data)
225-
226- response = encryption.decrypt(response, self.enckey, init_iv)
227-
228- json = jsond.loads(response)
229-
230- if json["success"]:
231- self.__load_user_data(json["info"])
232- if jsond.load(open("auth.json"))["authusername"] == "": #Check if the authusername is empty so it can write the user data
233- authfile = jsond.load(open("Files/auth.json"))
234- authfile["authusername"] = user #login(self, user)
235- jsond.dump(authfile, open('Files/auth.json', 'w'), sort_keys=False, indent=4) #Dumping username to auth file/You can change the indent
236- authfile["authpassword"] = password #login(self, password)
237- jsond.dump(authfile, open('Files/auth.json', 'w'), sort_keys=False, indent=4) #Dumping password to auth file/You can change the indent
238- else: #Auth file is filled with data so it skips the user data dumping
239- pass
240- print("successfully logged in")
241- else:
242- print(json["message"])
243- os._exit(1)'''
244-
245217# endregion
246218
247219
@@ -276,4 +248,4 @@ def answer():
276248print (f"Current Session Validation Status: { keyauthapp .check ()} " )
277249print ("Exiting in 10 secs...." )
278250sleep (10 )
279- os ._exit (1 )
251+ os ._exit (1 )
0 commit comments