22from uuid import uuid4 # gen random guid
33
44try :
5- if os .name == 'nt' :
6- import win32security # get sid (WIN only)
5+ if os .name == 'nt' : import win32security # get sid (WIN only)
76 import requests # https requests
87 from Crypto .Cipher import AES
98 from Crypto .Hash import SHA256
109 from Crypto .Util .Padding import pad , unpad
1110except ModuleNotFoundError :
1211 print ("Exception when importing modules, Installing necessary modules...." )
12+
1313 if os .path .isfile ("requirements.txt" ):
14+ print ("[+] Unable to find requirements file, Installing modules manually...." )
1415 os .system ("pip install -r requirements.txt" )
15- else :
16- os . system ( "pip install pywin32; pip install pycryptodome; pip install requests" )
17- print ( "Modules installed! " )
18- exit (1 )
16+ sys . exit ( "Modules installed!" )
17+
18+ os . system ( "pip install pywin32; pip install pycryptodome; pip install requests " )
19+ sys . exit ("Modules installed!" )
1920
2021try : # Connection check
2122 requests .get ('https://google.com' )
22- except requests .exceptions .RequestException as e :
23- print (e )
24- exit (1 )
25-
26- msg_exit = lambda a : print (a )
27-
23+ except :
24+ sys .exit ("[!] You have no internet connectivity...." )
2825
29- class api :
26+ class KeyAuth :
3027 name : str
3128 ownerid : str
3229 secret : str
@@ -72,12 +69,9 @@ def init(self):
7269 os .system (f"start { download_link } " )
7370 os ._exit (1 )
7471 else :
75- print ("Invalid Version, Contact owner to add download link to latest app version" )
76- os ._exit (1 )
72+ sys .exit ("Invalid Version, Contact owner to add download link to latest app version" )
7773
78- if not json ["success" ]:
79- print (json ["message" ])
80- os ._exit (1 )
74+ if not json ["success" ]: sys .exit (json ["message" ])
8175
8276 self .sessionid = json ["sessionid" ]
8377 self .initialized = True
@@ -111,8 +105,7 @@ def register(self, user, password, license, hwid=None):
111105 self .__load_user_data (json ["info" ])
112106 return
113107
114- print (json ["message" ])
115- os ._exit (1 )
108+ sys .exit (json ["message" ])
116109
117110 def upgrade (self , user : str , license : str ) -> None :
118111 self .checkinit ()
@@ -133,12 +126,9 @@ def upgrade(self, user: str, license: str) -> None:
133126 json = jsond .loads (response )
134127
135128 if json ["success" ]:
136- print ("successfully upgraded user" )
137- print ("please restart program and login" )
138- os ._exit (1 )
129+ sys .exit ("successfully upgraded user, please restart program and login" )
139130
140- print (json ["message" ])
141- os ._exit (1 )
131+ sys .exit (json ["message" ])
142132
143133 def login (self , user , password : str , hwid = None ):
144134 self .checkinit ()
@@ -166,8 +156,7 @@ def login(self, user, password: str, hwid=None):
166156 print ("successfully logged in" )
167157 return
168158
169- print (json ["message" ])
170- os ._exit (1 )
159+ sys .exit (json ["message" ])
171160
172161 def license (self , key : str , hwid = None ) -> None :
173162 self .checkinit ()
@@ -195,8 +184,7 @@ def license(self, key: str, hwid=None) -> None:
195184 print ("successfully logged into license" )
196185 return
197186
198- print (json ["message" ])
199- os ._exit (1 )
187+ sys .exit (json ["message" ])
200188
201189 def var (self , name : str ) -> str :
202190 self .checkinit ()
@@ -218,9 +206,7 @@ def var(self, name: str) -> str:
218206 if json ["success" ]:
219207 return json ["message" ]
220208
221- print (json ["message" ])
222- time .sleep (5 )
223- os ._exit (1 )
209+ sys .exit (json ["message" ])
224210
225211 def getvar (self , var_name : str ) -> str :
226212 self .checkinit ()
@@ -241,8 +227,7 @@ def getvar(self, var_name: str) -> str:
241227 if json ["success" ]:
242228 return json ["response" ]
243229
244- print (json ["message" ])
245- os ._exit (1 )
230+ sys .exit (json ["message" ])
246231
247232 def setvar (self , var_name : str , var_data : str ) -> bool :
248233 self .checkinit ()
@@ -265,9 +250,7 @@ def setvar(self, var_name: str, var_data: str) -> bool:
265250 if json ["success" ]:
266251 return True
267252
268- print (json ["message" ])
269- time .sleep (5 )
270- os ._exit (1 )
253+ sys .exit (json ["message" ])
271254
272255 def ban (self ) -> bool :
273256 self .checkinit ()
@@ -289,9 +272,7 @@ def ban(self) -> bool:
289272 if json ["success" ]:
290273 return True
291274
292- print (json ["message" ])
293- time .sleep (5 )
294- os ._exit (1 )
275+ sys .exit (json ["message" ])
295276
296277 def file (self , fileid : str ) -> str :
297278 self .checkinit ()
@@ -313,8 +294,7 @@ def file(self, fileid: str) -> str:
313294 json = jsond .loads (response )
314295
315296 if not json ["success" ]:
316- print (json ["message" ])
317- exit (1 )
297+ sys .exit (json ["message" ])
318298
319299 return binascii .unhexlify (json ["contents" ])
320300
@@ -342,8 +322,7 @@ def webhook(self, webid: str, param: str, body = "", conttype = "") -> str:
342322 if json ["success" ]:
343323 return json ["message" ]
344324
345- print (json ["message" ])
346- exit (1 )
325+ sys .exit (json ["message" ])
347326
348327 def check (self ) -> bool :
349328 self .checkinit ()
@@ -493,8 +472,7 @@ def changeUsername(self, username: str) -> None:
493472 if json ["success" ]:
494473 print ("successfully Changed Username" )
495474
496- print (json ["message" ])
497- exitt (0 )
475+ sys .exit (json ["message" ])
498476
499477 def __do_request (self , post_data ) -> str :
500478 try :
@@ -605,5 +583,4 @@ def decrypt(message: str, enc_key: str, iv: str) -> str:
605583
606584 return encryption .decrypt_string (message .encode (), _key .encode (), _iv .encode ()).decode ()
607585 except :
608- print ("Invalid Application Information. Long text is secret short text is ownerid. Name is supposed to be app name not username" )
609- os ._exit (1 )
586+ sys .exit ("Invalid Application Information. Long text is secret short text is ownerid. Name is supposed to be app name not username" )
0 commit comments