otmanennvn commited on
Commit
9fa4035
·
verified ·
1 Parent(s): 9bb2403

Delete AlliFF.py

Browse files
Files changed (1) hide show
  1. AlliFF.py +0 -443
AlliFF.py DELETED
@@ -1,443 +0,0 @@
1
-
2
- import requests , json , binascii , time , urllib3 , base64 , datetime , re ,socket , threading , random , os
3
- from protobuf_decoder.protobuf_decoder import Parser
4
- from Crypto.Cipher import AES
5
- from Crypto.Util.Padding import pad , unpad
6
- from datetime import datetime
7
- from google.protobuf.timestamp_pb2 import Timestamp
8
-
9
- urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
10
-
11
- Key , Iv = bytes([89, 103, 38, 116, 99, 37, 68, 69, 117, 104, 54, 37, 90, 99, 94, 56]) , bytes([54, 111, 121, 90, 68, 114, 50, 50, 69, 51, 121, 99, 104, 106, 77, 37])
12
-
13
- def EnC_AEs(HeX):
14
- cipher = AES.new(Key , AES.MODE_CBC , Iv)
15
- return cipher.encrypt(pad(bytes.fromhex(HeX), AES.block_size)).hex()
16
-
17
- def DEc_AEs(HeX):
18
- cipher = AES.new(Key , AES.MODE_CBC , Iv)
19
- return unpad(cipher.decrypt(bytes.fromhex(HeX)), AES.block_size).hex()
20
-
21
- def EnC_PacKeT(HeX , K , V):
22
- return AES.new(K , AES.MODE_CBC , V).encrypt(pad(bytes.fromhex(HeX) ,16)).hex()
23
-
24
- def DEc_PacKeT(HeX , K , V):
25
- return unpad(AES.new(K , AES.MODE_CBC , V).decrypt(bytes.fromhex(HeX)) , 16).hex()
26
-
27
- def EnC_Uid(H , Tp):
28
- e , H = [] , int(H)
29
- while H:
30
- e.append((H & 0x7F) | (0x80 if H > 0x7F else 0)) ; H >>= 7
31
- return bytes(e).hex() if Tp == 'Uid' else None
32
-
33
- def EnC_Vr(N):
34
- if N < 0: ''
35
- H = []
36
- while True:
37
- BesTo = N & 0x7F ; N >>= 7
38
- if N: BesTo |= 0x80
39
- H.append(BesTo)
40
- if not N: break
41
- return bytes(H)
42
-
43
- def DEc_Uid(H):
44
- n = s = 0
45
- for b in bytes.fromhex(H):
46
- n |= (b & 0x7F) << s
47
- if not b & 0x80: break
48
- s += 7
49
- return n
50
-
51
- def CrEaTe_VarianT(field_number, value):
52
- field_header = (field_number << 3) | 0
53
- return EnC_Vr(field_header) + EnC_Vr(value)
54
-
55
- def CrEaTe_LenGTh(field_number, value):
56
- field_header = (field_number << 3) | 2
57
- encoded_value = value.encode() if isinstance(value, str) else value
58
- return EnC_Vr(field_header) + EnC_Vr(len(encoded_value)) + encoded_value
59
-
60
- def CrEaTe_ProTo(fields):
61
- packet = bytearray()
62
- for field, value in fields.items():
63
- if isinstance(value, dict):
64
- nested_packet = CrEaTe_ProTo(value)
65
- packet.extend(CrEaTe_LenGTh(field, nested_packet))
66
- elif isinstance(value, int):
67
- packet.extend(CrEaTe_VarianT(field, value))
68
- elif isinstance(value, str) or isinstance(value, bytes):
69
- packet.extend(CrEaTe_LenGTh(field, value))
70
- return packet
71
-
72
- def DecodE_HeX(H):
73
- R = hex(H)
74
- F = str(R)[2:]
75
- if len(F) == 1: F = "0" + F ; return F
76
- else: return F
77
-
78
- def Fix_PackEt(parsed_results):
79
- result_dict = {}
80
- for result in parsed_results:
81
- field_data = {}
82
- field_data['wire_type'] = result.wire_type
83
- if result.wire_type == "varint":
84
- field_data['data'] = result.data
85
- if result.wire_type == "string":
86
- field_data['data'] = result.data
87
- if result.wire_type == "bytes":
88
- field_data['data'] = result.data
89
- elif result.wire_type == 'length_delimited':
90
- field_data["data"] = Fix_PackEt(result.data.results)
91
- result_dict[result.field] = field_data
92
- return result_dict
93
-
94
- def DeCode_PackEt(input_text):
95
- try:
96
- parsed_results = Parser().parse(input_text)
97
- parsed_results_objects = parsed_results
98
- parsed_results_dict = Fix_PackEt(parsed_results_objects)
99
- json_data = json.dumps(parsed_results_dict)
100
- return json_data
101
- except Exception as e:
102
- print(f"error {e}")
103
- return None
104
-
105
- def xMsGFixinG(n):
106
- return '🗿'.join(str(n)[i:i + 3] for i in range(0 , len(str(n)) , 3))
107
-
108
- def ArA_CoLor():
109
- Tp = ["32CD32" , "00BFFF" , "00FA9A" , "90EE90" , "FF4500" , "FF6347" , "FF69B4" , "FF8C00" , "FF6347" , "FFD700" , "FFDAB9" , "F0F0F0" , "F0E68C" , "D3D3D3" , "A9A9A9" , "D2691E" , "CD853F" , "BC8F8F" , "6A5ACD" , "483D8B" , "4682B4", "9370DB" , "C71585" , "FF8C00" , "FFA07A"]
110
- return random.choice(Tp)
111
-
112
- def xBunnEr():
113
- bN = [902000306 , 902000305 , 902000003 , 902000016 , 902000017 , 902000019 , 902000020 , 902000021 , 902000023 , 902000070 , 902000087 , 902000108 , 902000011 , 902049020 , 902049018 , 902049017 , 902049016 , 902049015 , 902049003 , 902033016 , 902033017 , 902033018 , 902048018 , 902000306 , 902000305]
114
- return random.choice(bN)
115
-
116
- def xSEndMsg(Msg , Tp , Tp2 , id , K , V):
117
- feilds = {1: id, 2: Tp2, 3: Tp, 4: Msg , 5: 1735129800, 7: 2, 9: {1: "xBesTo - C4­", 2: xBunnEr(), 3: 901048018, 4: 330, 5: 909034009, 8: "xBesTo - C4", 10: 1, 11: 1, 14: {1: 1158053040, 2: 8, 3: "\u0010\u0015\b\n\u000b\u0015\f\u000f\u0011\u0004\u0007\u0002\u0003\r\u000e\u0012\u0001\u0005\u0006"}}, 10: "en", 13: {2: 1, 3: 1}, 14: {}}
118
- Pk = str(CrEaTe_ProTo(feilds).hex())
119
- Pk = "080112" + EnC_Uid(len(Pk) // 2 , Tp = 'Uid') + Pk
120
- return GeneRaTePk(str(Pk) , '1215' , K , V)
121
-
122
- def Auth_Chat(idT, sq, K, V):
123
- fields = {
124
- 1: 3,
125
- 2: {
126
- 1: idT,
127
- 3: "fr",
128
- 4: sq
129
- }
130
- }
131
- return GeneRaTePk(str(CrEaTe_ProTo(fields).hex()) , '1215' , K , V)
132
- def xSendTeamMsg(msg, idT, K, V):
133
- fields = {
134
- 1: 1,
135
- 2: {
136
- 1: int(idT),
137
- 2: int(idT),
138
- 4: msg,
139
- 7: 2,
140
- 10: "fr",
141
- 9: {
142
- 1: "AlliFF",
143
- 2: xBunnEr(),
144
- 4: 330,
145
- 5: 827001005,
146
- 8: "AlliFF",
147
- 10: 1,
148
- 11: 1,
149
- 12: {
150
- 1: 2
151
- },
152
- 14: {
153
- 1: 1158053040,
154
- 2: 8,
155
- 3: "\u0010\u0015\b\n\u000b\u0015\f\u000f\u0011\u0004\u0007\u0002\u0003\r\u000e\u0012\u0001\u0005\u0006"
156
- }
157
- },
158
- 13: {
159
- 1: 2,
160
- 2: 1
161
- },
162
- 14:{}
163
- }
164
- }
165
-
166
- return GeneRaTePk(str(CrEaTe_ProTo(fields).hex()) , '1215' , K , V)
167
-
168
- def OpEnSq(K , V):
169
- fields = {1: 1, 2: {2: "\u0001", 3: 1, 4: 1, 5: "en", 9: 1, 11: 1, 13: 1, 14: {2: 5756, 6: 11, 8: "1.111.5", 9: 2, 10: 4}}}
170
- return GeneRaTePk(str(CrEaTe_ProTo(fields).hex()) , '0515' , K , V)
171
-
172
- def cHSq(Nu , Uid , K , V):
173
- fields = {1: 17, 2: {1: int(Uid), 2: 1, 3: int(Nu - 1), 4: 62, 5: "\u001a", 8: 5, 13: 329}}
174
- return GeneRaTePk(str(CrEaTe_ProTo(fields).hex()) , '0515' , K , V)
175
-
176
- def SEnd_InV(Nu , Uid , K , V):
177
- fields = {1: 2 , 2: {1: int(Uid) , 2: "ME" , 4: int(Nu)}}
178
- return GeneRaTePk(str(CrEaTe_ProTo(fields).hex()) , '0515' , K , V)
179
-
180
- def ExiT(id , K , V):
181
- fields = {
182
- 1: 7,
183
- 2: {
184
- 1: int(11037044965)
185
- }
186
- }
187
- return GeneRaTePk(str(CrEaTe_ProTo(fields).hex()) , '0515' , K , V)
188
-
189
- def AuthClan(CLan_Uid , AuTh , K , V):
190
- fields = {1: 3, 2: {1: int(CLan_Uid) , 2: 1, 4: str(AuTh)}}
191
- return GeneRaTePk(str(CrEaTe_ProTo(fields).hex()) , '1201' , K , V)
192
-
193
- def GeT_Status(PLayer_Uid , K , V):
194
- PLayer_Uid = EnC_Uid(PLayer_Uid , Tp = 'Uid')
195
- if len(PLayer_Uid) == 8: Pk = f'080112080a04{PLayer_Uid}1005'
196
- elif len(PLayer_Uid) == 10: Pk = f"080112090a05{PLayer_Uid}1005"
197
- return GeneRaTePk(Pk , '0f15' , K , V)
198
-
199
- def SPam_Room(Uid , Rm , Nm , K , V):
200
- fields = {1: 78, 2: {1: int(Rm), 2: f"[{ArA_CoLor()}]{Nm}", 3: {2: 1, 3: 1}, 4: 330, 5: 1, 6: 201, 10: xBunnEr(), 11: int(Uid), 12: 1}}
201
- return GeneRaTePk(str(CrEaTe_ProTo(fields).hex()) , '0e15' , K , V)
202
-
203
- def Join_Room(room_id , K , V):
204
- fields = {1: 3, 2: {1: int(room_id), 8: {1: "IDC1", 2: 3000, 3: "ME"}, 9: "\x01\t\n\x12\x19 ", 10: 1, 12: b"\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01", 13: 3, 14: 3, 16: "ME"}}
205
- return GeneRaTePk(str(CrEaTe_ProTo(fields).hex()) , '0e10' , K , V)
206
-
207
- def SPamSq(Uid , K , V):
208
- fields = {1: 33, 2: {1: int(Uid) , 2: 'ME', 3: 1, 4: 1, 7: 330, 8: 19459, 9: 100, 12: 1, 16: 1, 17: {2: 94, 6: 11, 8: '1.111.5', 9: 3, 10: 2}, 18: 201, 23: {2: 1, 3: 1}, 24: xBunnEr() , 26: {}, 28: {}}}
209
- return GeneRaTePk(str(CrEaTe_ProTo(fields).hex()) , '0515' , K , V)
210
-
211
- def AccEpT(PLayer_Uid , AuTh_CodE_Sq , K , V):
212
- fields = {1: 4, 2: {1: int(PLayer_Uid), 3: int(PLayer_Uid), 4: "\u0001\u0007\t\n\u0012\u0019\u001a ", 8: 1, 9: {2: 1393, 4: "wW_T", 6: 11, 8: "1.111.5", 9: 3, 10: 2}, 10: AuTh_CodE_Sq, 12: 1, 13: "en", 16: "OR"}}
213
- return GeneRaTePk(str(CrEaTe_ProTo(fields).hex()) , '0515' , K , V)
214
-
215
- def GenJoinSquadsPacket(code, key, iv):
216
- fields = {}
217
- fields[1] = 4
218
- fields[2] = {}
219
- fields[2][4] = bytes.fromhex("01090a0b121920")
220
- fields[2][5] = str(code)
221
- fields[2][6] = 6
222
- fields[2][8] = 1
223
- fields[2][9] = {}
224
- fields[2][9][2] = 800
225
- fields[2][9][6] = 11
226
- fields[2][9][8] = "1.111.1"
227
- fields[2][9][9] = 5
228
- fields[2][9][10] = 1
229
- print(fields)
230
- return GeneRaTePk(str(CrEaTe_ProTo(fields).hex()), '0515', key, iv)
231
- #1750287629500765351_vfhkisb7hv 8679231987
232
- def ghost_pakcet(player_id , nm , secret_code , key ,iv):
233
- fields = {
234
- 1: 61,
235
- 2: {
236
- 1: int(player_id),
237
- 2: {
238
- 1: int(player_id),
239
- 2: 1159,
240
- 3: f"[b][c][{ArA_CoLor()}]{nm}",
241
- 5: 12,
242
- 6: 15,
243
- 7: 1,
244
- 8: {
245
- 2: 1,
246
- 3: 1,
247
- },
248
- 9: 3,
249
- },
250
- 3: secret_code,},}
251
- return GeneRaTePk(str(CrEaTe_ProTo(fields).hex()), '0515', key, iv)
252
-
253
- def _V(b, i):
254
- r = s = 0
255
- while True:
256
- c = b[i]; i += 1
257
- r |= (c & 0x7F) << s
258
- if c < 0x80: break
259
- s += 7
260
- return r, i
261
-
262
- def PrOtO(hx):
263
- b, i, R = bytes.fromhex(hx), 0, {}
264
- while i < len(b):
265
- H, i = _V(b, i)
266
- F, T = H >> 3, H & 7
267
- if T == 0:
268
- R[F], i = _V(b, i)
269
- elif T == 2:
270
- L, i = _V(b, i)
271
- S = b[i:i+L]; i += L
272
- try: R[F] = S.decode()
273
- except:
274
- try: R[F] = PrOtO(S.hex())
275
- except: R[F] = S
276
- elif T == 5:
277
- R[F] = int.from_bytes(b[i:i+4], 'little'); i += 4
278
- else:
279
- raise ValueError(f'Unknown wire type: {T}')
280
- return R
281
-
282
- def GeT_KEy(obj , target):
283
- values = []
284
- def collect(o):
285
- if isinstance(o, dict):
286
- for k, v in o.items():
287
- if k == target:
288
- values.append(v)
289
- collect(v)
290
- elif isinstance(o, list):
291
- for v in o:
292
- collect(v)
293
- collect(obj)
294
- return values[-1] if values else None
295
-
296
-
297
- def GeneRaTePk(Pk , N , K , V):
298
- PkEnc = EnC_PacKeT(Pk , K , V)
299
- _ = DecodE_HeX(int(len(PkEnc) // 2))
300
- if len(_) == 2: HeadEr = N + "000000"
301
- elif len(_) == 3: HeadEr = N + "00000"
302
- elif len(_) == 4: HeadEr = N + "0000"
303
- elif len(_) == 5: HeadEr = N + "000"
304
- return bytes.fromhex(HeadEr + _ + PkEnc)
305
-
306
- def GuiLd_AccEss(Tg , Nm , Uid , BLk , OwN , AprV):
307
- return Tg in Nm and Uid not in BLk and Uid in (OwN | AprV)
308
-
309
- def ChEck_Commande(id):
310
- return "<" not in id and ">" not in id and "[" not in id and "]" not in id
311
-
312
- def L_DaTa():
313
- load = lambda f: json.load(open(f)) if os.path.exists(f) else {}
314
- return map(load, ["BesTo_CLan_LiKes.json" , "BesTo_RemaininG_LiKes.json" , "BesTo_RemaininG_Room.json"])
315
-
316
- def ChEck_Limit_CLan(Uid , STaTus):
317
- data , max_use , file = (like_data_clan, 10, "BesTo_CLan_LiKes.json") if STaTus == "like" else ''
318
- t , limit = time.time(), 86400
319
- u = data.get(str(Uid), {"count": 0, "start_time": t})
320
- if t - u["start_time"] >= limit:
321
- u = {"count": 0, "start_time": t}
322
- if u["count"] < max_use:
323
- u["count"] += 1
324
- data[str(Uid)] = u
325
- json.dump(data , open(file, "w"))
326
- return f"{max_use - u['count']}" , datetime.fromtimestamp(u["start_time"] + limit).strftime("%I:%M %p - %d/%m/%y")
327
- return False , datetime.fromtimestamp(u["start_time"] + limit).strftime("%I:%M %p - %d/%m/%y")
328
-
329
- def ChEck_Limit(Uid , STaTus):
330
- data , max_use , file = (like_data, 10, "BesTo_RemaininG_LiKes.json") if STaTus == "like" else (room_data, 10, "BesTo_RemaininG_Room.json")
331
- t , limit = time.time(), 86400
332
- u = data.get(str(Uid), {"count": 0, "start_time": t})
333
- if t - u["start_time"] >= limit:
334
- u = {"count": 0, "start_time": t}
335
- if u["count"] < max_use:
336
- u["count"] += 1
337
- data[str(Uid)] = u
338
- json.dump(data , open(file, "w"))
339
- return f"{max_use - u['count']}" , datetime.fromtimestamp(u["start_time"] + limit).strftime("%I:%M %p - %d/%m/%y")
340
- return False , datetime.fromtimestamp(u["start_time"] + limit).strftime("%I:%M %p - %d/%m/%y")
341
-
342
- f = 'blacklist.txt'
343
- approvee = 'approved.txt'
344
- black , approve = [] , []
345
-
346
- def load_blacklist():
347
- global black
348
- try:
349
- with open(f, 'r') as file:
350
- black = [line.strip() for line in file if line.strip()]
351
- except: black = []
352
-
353
- def encrypt_uids():
354
- global black
355
- try:
356
- if black: black = [EnC_Uid(uid , Tp = 'Uid') for uid in black]
357
- except:
358
- try: open(f, 'w').close()
359
- except: pass
360
- load_blacklist()
361
-
362
- if not black: open(f, 'w').close()
363
-
364
- def load_approve():
365
- global approve
366
- try:
367
- with open(approvee, 'r') as file: approve = [line.strip() for line in file if line.strip()]
368
- except: approve = []
369
-
370
- def encrypt_uids2():
371
- global approve
372
- try:
373
- if approve: approve = [EnC_Uid(uid , Tp = 'Uid') for uid in approve]
374
- except:
375
- try: open(approvee, 'w').close()
376
- except: pass
377
- load_approve()
378
-
379
- if not approve: open(approvee, 'w').close()
380
-
381
- def Add_Uid(user_id):
382
- with open(f, 'r') as file: lines = file.read().splitlines()
383
- if str(user_id) not in lines:
384
- with open(f, 'a') as file: file.write(f"{user_id}\n")
385
-
386
- def Remove_Uid(f, player_uid):
387
- try:
388
- with open(f, 'r+') as file: lines = file.readlines() ; file.seek(0), file.truncate(), file.writelines(l for l in lines if l.strip() != player_uid) ; return True
389
- except FileNotFoundError: return False
390
-
391
- def A(user_id):
392
- with open(approvee, 'r') as file: lines = file.read().splitlines()
393
- if str(user_id) not in lines:
394
- with open(approvee, 'a') as file: file.write(f"{user_id}\n")
395
-
396
- def D(approvee, player_uid):
397
- try:
398
- with open(approvee, 'r+') as file: lines = file.readlines() ; file.seek(0), file.truncate(), file.writelines(l for l in lines if l.strip() != player_uid) ; return True
399
- except FileNotFoundError: return False
400
-
401
- def Clear():
402
- try:
403
- open(f, 'w').close() ; black.clear() ; return True
404
- except: return False
405
-
406
- def Add_Black(user_id):
407
- Add_Uid(user_id)
408
- if EnC_Uid(user_id , Tp = 'Uid') not in black: black.append(EnC_Uid(user_id , Tp = 'Uid')) ; return True
409
- else: return False
410
-
411
- def Rem_Black(user_id):
412
- user_id_encrypted = EnC_Uid(user_id , Tp = 'Uid')
413
- if user_id_encrypted in black: black.remove(user_id_encrypted) ; Remove_Uid(f , user_id) ; return True
414
- else: return False
415
-
416
- def Show_Uids():
417
- try:
418
- with open(f) as file: return "\n".join(sorted(file.read().splitlines(), key=int)) or False
419
- except (FileNotFoundError, ValueError): return False
420
-
421
- def Approved(user_id):
422
- A(user_id)
423
- if EnC_Uid(user_id , Tp = 'Uid') not in approve: approve.append(EnC_Uid(user_id , Tp = 'Uid')) ; return True
424
- else: return False
425
-
426
- def DeApproved(user_id):
427
- user_id_encrypted = EnC_Uid(user_id , Tp = 'Uid')
428
- if user_id_encrypted in approve: approve.remove(user_id_encrypted) ; D(approvee , user_id) ; return True
429
- else: return False
430
-
431
- def Show_Approvs():
432
- try:
433
- with open(approvee) as file: return "\n".join(sorted(file.read().splitlines(), key=int)) or False
434
- except (FileNotFoundError, ValueError): return False
435
-
436
- def Clear_Approvs():
437
- try:
438
- open(approvee, 'w').close() ; approve.clear() ; return True
439
- except: return False
440
-
441
- load_blacklist() ; encrypt_uids()
442
- load_approve() ; encrypt_uids2()
443
- like_data_clan , like_data , room_data = L_DaTa()