-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
4029 lines (3402 loc) · 216 KB
/
main.py
File metadata and controls
4029 lines (3402 loc) · 216 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import requests , os , psutil , sys , jwt , pickle , json , binascii , time , urllib3 , base64 , datetime , re , socket , threading , ssl , pytz , aiohttp
from protobuf_decoder.protobuf_decoder import Parser
from xC4 import * ; from xHeaders import *
from datetime import datetime
from google.protobuf.timestamp_pb2 import Timestamp
from concurrent.futures import ThreadPoolExecutor
from threading import Thread
from Pb2 import DEcwHisPErMsG_pb2 , MajoRLoGinrEs_pb2 , PorTs_pb2 , MajoRLoGinrEq_pb2 , sQ_pb2 , Team_msg_pb2
from cfonts import render, say
from APIS import insta
from flask import Flask, jsonify, request
import asyncio
import signal
import sys
# Add these imports if not already present
import re
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad, unpad
import random
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad, unpad
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
# VariabLes dyli
#------------------------------------------#
online_writer = None
whisper_writer = None
spam_room = False
spammer_uid = None
spam_chat_id = None
spam_uid = None
Spy = False
Chat_Leave = False
fast_spam_running = False
fast_spam_task = None
custom_spam_running = False
custom_spam_task = None
spam_request_running = False
spam_request_task = None
evo_fast_spam_running = False
evo_fast_spam_task = None
evo_custom_spam_running = False
evo_custom_spam_task = None
# Add with other global variables
reject_spam_running = False
insquad = None
joining_team = False
reject_spam_task = None
lag_running = False
lag_task = None
# Add these with your other global variables at the top
reject_spam_running = False
reject_spam_task = None
evo_cycle_running = False
evo_cycle_task = None
# Add with other global variables at the top
auto_start_running = False
auto_start_teamcode = None
stop_auto = False
auto_start_task = None
start_spam_duration = 18 # seconds to spam start
wait_after_match = 20 # seconds to wait after match
start_spam_delay = 0.2 # delay between start packets
evo_emotes = {
"1": "909052002", # 100lv
"2": "909052011", # SCAR
"3": "909052012", # 1st MP40
"4": "909052004", # 2nd MP40
"5": "909052007", # 1st M1014
"6": "909052009", # 2nd M1014
"7": "909052003", # XM8
"8": "909051001", # Famas
"9": "909052005", # UMP
"10": "909052001", # M1887
"11": "909042008", # Woodpecker
"12": "909041005", # Groza
"13": "909033001", # M4A1
"14": "909038010", # Thompson
"15": "909038012", # G18
"16": "909045001", # Parafal
"17": "909049010", # P90
"18": "909051003", # m60
"19": "909000063", #ak
"20": "909037011", #Fist
"21": "909049012", #open fire
"22": "909000002", #lol
"23": "909051014", #puffy ride
"24": "909050009", #circle
"25": "909051013", #petals
"26": "909051010", #motorbike
"27": "909051004", #shower
"28": "909051002", #dream
"29": "909048015", #paint
"30": "909051001", #angelic
"31": "909044015", #sword
"32": "909041008", #flare
"33": "909049003", #owl
"34": "909050008", #thor
"35": "909049001", #bigdill
"36": "909041013", #cs gm
"37": "909050014", #map readi
"38": "909050015", #tomato
"39": "909050002", #ninja summon
"40": "909000034", #pushup
"41": "909000012", #pirate flag
"42": "909000020", #devil move
"43": "909000014", #throne
"44": "909000010", #rose
"45": "909038004", #heart
"46": "909040004", #insoke
"47": "909041012", #br gm
"48": "909041003", #insok
"49": "909000084", #vutt
"50": "909000142", #pacha
"51": "909000086", #mythos
"52": "909000087", #champion
"53": "909000088", #sprrcar
"54": "909000095", #penguin
"55": "909000125", #sick move
"56": "909000129", #money
"57": "909000130", #bullet
"58": "909000135", #rps
"59": "909000143", #cricket
"60": "909034003", #agunn
"61": "909033005", #sick down
"62": "909000034", #flag
"63": "909000039", #mkney car
"64": "909000055", #ami dhonii
"65": "909000064", #choto saitama
"66": "909000071", #cobra dance
"67": "909000074", #cobra bike
"68": "909000080", #2021 ffws
"69": "909034009", #pasa 2
"70": "909035006", #flying sauce
"71": "909034014", #tiktoker
"72": "909035001", #free taka
"73": "909035002", #singer
"74": "909035003", #item not found
"75": "909035010", #gaan kora
"76": "909036001", #bhoot2
"77": "909036002", #shuvra
"78": "909036004", #cameraman
"79": "909036008", #skateboard
"80": "909036010", #signal
"81": "909037003", #omg
"82": "909037004", #pighy
"83": "909037009", #neor
"84": "909038001", #big bro
"85": "909037002", #bamboo
"86": "909037006", #ymmy
"87": "909037008", #juggle
"88": "909037010", #beast
"89": "909037011", #darcen
"90": "909038003", #lovebut
"91": "909038006", #ghonta
"92": "909038008", #mama coco
"93": "909038011", #should i
"94": "909039004", #bkndhuu
"95": "909039006", #what
"96": "909040001", #gariwala
"97": "909039013", #crush
"98": "909040004", #mach
"99": "909040005", #pop
"100": "909046001" #border
}
#------------------------------------------#
# Emote mapping for evo commands
EMOTE_MAP = {
1: 909000063,
2: 909000081,
3: 909000075,
4: 909000085,
5: 909000134,
6: 909000098,
7: 909035007,
8: 909051012,
9: 909000141,
10: 909034008,
11: 909051015,
12: 909041002,
13: 909039004,
14: 909042008,
15: 909051014,
16: 909039012,
17: 909040010,
18: 909035010,
19: 909041005,
20: 909051003,
21: 909034001,
22: 909042007,
23: 909037011,
24: 909049012,
25: 909000002,
26: 909051010,
27: 909051004,
28: 909051002,
29: 909048015,
30: 909051001,
31: 909044015,
32: 909041008,
33: 909049003,
34: 909050008,
35: 909049001,
36: 909041013,
37: 909050014,
38: 909050015,
39: 909050002,
40: 909000034,
41: 909000020,
42: 909000012,
43: 909000014,
44: 909000010,
45: 909038004,
46: 909040004,
47: 909041012,
48: 909041003,
49: 909000084,
50: 909000142,
51: 909000086,
52: 909000087,
53: 909000088,
54: 909000095,
55: 909000125,
56: 909000129,
57: 909000130,
58: 909000135,
59: 909000143,
60: 909034003,
61: 909033005,
62: 909000034,
63: 909000039,
64: 909000055,
65: 909000064,
66: 909000071,
67: 909000074,
68: 909000080,
69: 909034009,
70: 909035006,
71: 909034014,
72: 909035001,
73: 909035002,
74: 909035003,
75: 909035010,
76: 909036001,
77: 909036002,
78: 909036004,
79: 909036008,
80: 909036010,
81: 909037003,
82: 909037004,
83: 909037009,
84: 909038001,
85: 909037002,
86: 909037006,
87: 909037008,
88: 909037010,
89: 909037011,
90: 909038004,
91: 909038006,
92: 909038008,
93: 909038011,
94: 909039004,
95: 909039006,
96: 909040001,
97: 909039013,
98: 909040004,
99: 909040005,
100: 909046001
}
# Badge values for s1 to s5 commands - using your exact values
BADGE_VALUES = {
"s1": 1048576, # Your first badge
"s2": 32768, # Your second badge
"s3": 2048, # Your third badge
"s4": 64, # Your fourth badge
"s5": 262144 # Your seventh badge
}
# ------------------- Insta API Thread -------------------
def start_insta_api():
port = insta.find_free_port()
print(f"🚀 Starting Insta API on port {port}")
insta.app.run(host="0.0.0.0", port=port, debug=False)
# ------------------- End Insta API Thread -------------------
# Helper functions for ghost join
def dec_to_hex(decimal):
"""Convert decimal to hex string"""
hex_str = hex(decimal)[2:]
return hex_str.upper() if len(hex_str) % 2 == 0 else '0' + hex_str.upper()
async def encrypt_packet(packet_hex, key, iv):
"""Encrypt packet using AES CBC"""
cipher = AES.new(key, AES.MODE_CBC, iv)
packet_bytes = bytes.fromhex(packet_hex)
padded_packet = pad(packet_bytes, AES.block_size)
encrypted = cipher.encrypt(padded_packet)
return encrypted.hex()
async def nmnmmmmn(packet_hex, key, iv):
"""Wrapper for encrypt_packet"""
return await encrypt_packet(packet_hex, key, iv)
def get_idroom_by_idplayer(packet_hex):
"""Extract room ID from packet - converted from your other TCP"""
try:
json_result = get_available_room(packet_hex)
parsed_data = json.loads(json_result)
json_data = parsed_data["5"]["data"]
data = json_data["1"]["data"]
idroom = data['15']["data"]
return idroom
except Exception as e:
print(f"Error extracting room ID: {e}")
return None
async def check_player_in_room(target_uid, key, iv):
"""Check if player is in a room by sending status request"""
try:
# Send status request packet
status_packet = await GeT_Status(int(target_uid), key, iv)
await SEndPacKeT(whisper_writer, online_writer, 'OnLine', status_packet)
# You'll need to capture the response packet and parse it
# For now, return True and we'll handle room detection in the main loop
return True
except Exception as e:
print(f"Error checking player room status: {e}")
return False
class MultiAccountManager:
def __init__(self):
self.accounts_file = "accounts.json"
self.accounts_data = self.load_accounts()
def load_accounts(self):
"""Load multiple accounts from JSON file"""
try:
with open(self.accounts_file, "r", encoding="utf-8") as f:
accounts = json.load(f)
return accounts
except FileNotFoundError:
print(f"❌ Accounts file {self.accounts_file} not found!")
return {}
except Exception as e:
print(f"❌ Error loading accounts: {e}")
return {}
async def get_account_token(self, uid, password):
"""Get access token for a specific account"""
try:
url = "https://100067.connect.garena.com/oauth/guest/token/grant"
headers = {
"Host": "100067.connect.garena.com",
"User-Agent": await Ua(),
"Content-Type": "application/x-www-form-urlencoded",
"Accept-Encoding": "gzip, deflate, br",
"Connection": "close"
}
data = {
"uid": uid,
"password": password,
"response_type": "token",
"client_type": "2",
"client_secret": "2ee44819e9b4598845141067b281621874d0d5d7af9d8f7e00c1e54715b7d1e3",
"client_id": "100067"
}
async with aiohttp.ClientSession() as session:
async with session.post(url, headers=headers, data=data) as response:
if response.status == 200:
data = await response.json()
open_id = data.get("open_id")
access_token = data.get("access_token")
return open_id, access_token
return None, None
except Exception as e:
print(f"❌ Error getting token for {uid}: {e}")
return None, None
async def send_join_from_account(self, target_uid, account_uid, password, key, iv, region):
"""Send join request from a specific account"""
try:
# Get token for this account
open_id, access_token = await self.get_account_token(account_uid, password)
if not open_id or not access_token:
return False
# Create join packet using the account's credentials
join_packet = await self.create_account_join_packet(target_uid, account_uid, open_id, access_token, key, iv, region)
if join_packet:
await SEndPacKeT(whisper_writer, online_writer, 'OnLine', join_packet)
return True
return False
except Exception as e:
print(f"❌ Error sending join from {account_uid}: {e}")
return False
async def SEnd_InV_with_Cosmetics(Nu, Uid, K, V, region):
"""Simple version - just add field 5 with basic cosmetics"""
region = "ind"
fields = {
1: 2,
2: {
1: int(Uid),
2: region,
4: int(Nu),
# Simply add field 5 with basic cosmetics
5: {
1: "BOT", # Name
2: int(await get_random_avatar()), # Avatar
5: random.choice([1048576, 32768, 2048]), # Random badge
}
}
}
if region.lower() == "ind":
packet = '0514'
elif region.lower() == "bd":
packet = "0519"
else:
packet = "0515"
return await GeneRaTePk((await CrEaTe_ProTo(fields)).hex(), packet, K, V)
async def join_custom_room(room_id, room_password, key, iv, region):
"""Join custom room with proper Free Fire packet structure"""
fields = {
1: 61, # Room join packet type (verified for Free Fire)
2: {
1: int(room_id),
2: {
1: int(room_id), # Room ID
2: int(time.time()), # Timestamp
3: "BOT", # Player name
5: 12, # Unknown
6: 9999999, # Unknown
7: 1, # Unknown
8: {
2: 1,
3: 1,
},
9: 3, # Room type
},
3: str(room_password), # Room password
}
}
if region.lower() == "ind":
packet_type = '0514'
elif region.lower() == "bd":
packet_type = "0519"
else:
packet_type = "0515"
return await GeneRaTePk((await CrEaTe_ProTo(fields)).hex(), packet_type, key, iv)
async def leave_squad(key, iv, region):
"""Leave squad - converted from your old TCP leave_s()"""
fields = {
1: 7,
2: {
1: 12480598706 # Your exact value from old TCP
}
}
packet = (await CrEaTe_ProTo(fields)).hex()
if region.lower() == "ind":
packet_type = '0514'
elif region.lower() == "bd":
packet_type = "0519"
else:
packet_type = "0515"
return await GeneRaTePk(packet, packet_type, key, iv)
async def RedZed_SendInv(bot_uid, uid, key, iv):
"""Async version of send invite function"""
try:
fields = {
1: 33,
2: {
1: int(uid),
2: "IND",
3: 1,
4: 1,
6: "RedZedKing!!",
7: 330,
8: 1000,
9: 100,
10: "DZ",
12: 1,
13: int(uid),
16: 1,
17: {
2: 159,
4: "y[WW",
6: 11,
8: "1.118.1",
9: 3,
10: 1
},
18: 306,
19: 18,
24: 902000306,
26: {},
27: {
1: 11,
2: int(bot_uid),
3: 99999999999
},
28: {},
31: {
1: 1,
2: 32768
},
32: 32768,
34: {
1: bot_uid,
2: 8,
3: b"\x10\x15\x08\x0A\x0B\x13\x0C\x0F\x11\x04\x07\x02\x03\x0D\x0E\x12\x01\x05\x06"
}
}
}
# Convert bytes properly
if isinstance(fields[2][34][3], str):
fields[2][34][3] = b"\x10\x15\x08\x0A\x0B\x13\x0C\x0F\x11\x04\x07\x02\x03\x0D\x0E\x12\x01\x05\x06"
# Use async versions of your functions
packet = await CrEaTe_ProTo(fields)
packet_hex = packet.hex()
# Generate final packet
final_packet = await GeneRaTePk(packet_hex, '0515', key, iv)
return final_packet
except Exception as e:
print(f"❌ Error in RedZed_SendInv: {e}")
import traceback
traceback.print_exc()
return None
async def request_join_with_badge(target_uid, badge_value, key, iv, region):
"""Send join request with specific badge - converted from your old TCP"""
fields = {
1: 33,
2: {
1: int(target_uid),
2: region.upper(),
3: 1,
4: 1,
5: bytes([1, 7, 9, 10, 11, 18, 25, 26, 32]),
6: "iG:[C][B][FF0000] KRISHNA",
7: 330,
8: 1000,
10: region.upper(),
11: bytes([49, 97, 99, 52, 98, 56, 48, 101, 99, 102, 48, 52, 55, 56,
97, 52, 52, 50, 48, 51, 98, 102, 56, 102, 97, 99, 54, 49, 50, 48, 102, 53]),
12: 1,
13: int(target_uid),
14: {
1: 2203434355,
2: 8,
3: "\u0010\u0015\b\n\u000b\u0013\f\u000f\u0011\u0004\u0007\u0002\u0003\r\u000e\u0012\u0001\u0005\u0006"
},
16: 1,
17: 1,
18: 312,
19: 46,
23: bytes([16, 1, 24, 1]),
24: int(await get_random_avatar()),
26: "",
28: "",
31: {
1: 1,
2: badge_value # Dynamic badge value
},
32: badge_value, # Dynamic badge value
34: {
1: int(target_uid),
2: 8,
3: bytes([15,6,21,8,10,11,19,12,17,4,14,20,7,2,1,5,16,3,13,18])
}
},
10: "en",
13: {
2: 1,
3: 1
}
}
packet = (await CrEaTe_ProTo(fields)).hex()
if region.lower() == "ind":
packet_type = '0514'
elif region.lower() == "bd":
packet_type = "0519"
else:
packet_type = "0515"
return await GeneRaTePk(packet, packet_type, key, iv)
async def start_auto_packet(key, iv, region):
"""Create start match packet"""
fields = {
1: 9,
2: {
1: 12480598706,
},
}
if region.lower() == "ind":
packet_type = '0514'
elif region.lower() == "bd":
packet_type = "0519"
else:
packet_type = "0515"
return await GeneRaTePk((await CrEaTe_ProTo(fields)).hex(), packet_type, key, iv)
async def leave_squad_packet(key, iv, region):
"""Leave squad packet"""
fields = {
1: 7,
2: {
1: 12480598706,
},
}
if region.lower() == "ind":
packet_type = '0514'
elif region.lower() == "bd":
packet_type = "0519"
else:
packet_type = "0515"
return await GeneRaTePk((await CrEaTe_ProTo(fields)).hex(), packet_type, key, iv)
async def join_teamcode_packet(team_code, key, iv, region):
"""Join team using code"""
fields = {
1: 4,
2: {
4: bytes.fromhex("01090a0b121920"),
5: str(team_code),
6: 6,
8: 1,
9: {
2: 800,
6: 11,
8: "1.111.1",
9: 5,
10: 1
}
}
}
if region.lower() == "ind":
packet_type = '0514'
elif region.lower() == "bd":
packet_type = "0519"
else:
packet_type = "0515"
return await GeneRaTePk((await CrEaTe_ProTo(fields)).hex(), packet_type, key, iv)
async def auto_start_loop(team_code, uid, chat_id, chat_type, key, iv, region):
"""Auto start loop that joins, starts match, waits, leaves, repeats"""
global auto_start_running, stop_auto
print(f"[AUTO] Auto start loop started for team {team_code}")
while not stop_auto:
try:
# Send status message
status_msg = f"[B][C][FFA500]🤖 Auto Start Bot\n🎯 Team: {team_code}\n⚡ Joining team..."
await safe_send_message(chat_type, status_msg, uid, chat_id, key, iv)
# Join team
join_packet = await join_teamcode_packet(team_code, key, iv, region)
await SEndPacKeT(whisper_writer, online_writer, 'OnLine', join_packet)
await asyncio.sleep(2)
# Send start spam status
start_msg = f"[B][C][00FF00]✅ Joined team {team_code}\n🎯 Starting match for {start_spam_duration} seconds..."
await safe_send_message(chat_type, start_msg, uid, chat_id, key, iv)
# Start spam
start_packet = await start_auto_packet(key, iv, region)
end_time = time.time() + start_spam_duration
spam_count = 0
while time.time() < end_time and not stop_auto:
await SEndPacKeT(whisper_writer, online_writer, 'OnLine', start_packet)
spam_count += 1
await asyncio.sleep(start_spam_delay)
if stop_auto:
break
# Wait after match
wait_msg = f"[B][C][FFFF00]⏳ Match started! Bot in lobby waiting {wait_after_match} seconds..."
await safe_send_message(chat_type, wait_msg, uid, chat_id, key, iv)
waited = 0
while waited < wait_after_match and not stop_auto:
await asyncio.sleep(1)
waited += 1
if stop_auto:
break
# Leave squad
leave_msg = f"[B][C][FF0000]🔄 Leaving team {team_code} to rejoin and start again..."
await safe_send_message(chat_type, leave_msg, uid, chat_id, key, iv)
leave_packet = await leave_squad_packet(key, iv, region)
await SEndPacKeT(whisper_writer, online_writer, 'OnLine', leave_packet)
await asyncio.sleep(2)
except Exception as e:
print(f"[AUTO] Error in auto_start_loop: {e}")
error_msg = f"[B][C][FF0000]❌ Auto start error: {str(e)}\n"
await safe_send_message(chat_type, error_msg, uid, chat_id, key, iv)
break
auto_start_running = False
stop_auto = False
print(f"[AUTO] Auto start loop stopped for team {team_code}")
async def reset_bot_state(key, iv, region):
"""Reset bot to solo mode before spam - Critical step from your old TCP"""
try:
# Leave any current squad (using your exact leave_s function)
leave_packet = await leave_squad(key, iv, region)
await SEndPacKeT(whisper_writer, online_writer, 'OnLine', leave_packet)
await asyncio.sleep(0.5)
print("✅ Bot state reset - left squad")
return True
except Exception as e:
print(f"❌ Error resetting bot: {e}")
return False
async def create_custom_room(room_name, room_password, max_players, key, iv, region):
"""Create a custom room"""
fields = {
1: 3, # Create room packet type
2: {
1: room_name,
2: room_password,
3: max_players, # 2, 4, 8, 16, etc.
4: 1, # Room mode
5: 1, # Map
6: "en", # Language
7: { # Player info
1: "BotHost",
2: int(await get_random_avatar()),
3: 330,
4: 1048576,
5: "BOTCLAN"
}
}
}
if region.lower() == "ind":
packet_type = '0514'
elif region.lower() == "bd":
packet_type = "0519"
else:
packet_type = "0515"
return await GeneRaTePk((await CrEaTe_ProTo(fields)).hex(), packet_type, key, iv)
async def real_multi_account_join(target_uid, key, iv, region):
"""Send join requests using real account sessions"""
try:
# Load accounts
accounts_data = load_accounts()
if not accounts_data:
return 0, 0
success_count = 0
total_accounts = len(accounts_data)
for account_uid, password in accounts_data.items():
try:
print(f"🔄 Authenticating account: {account_uid}")
# Get proper tokens for this account
open_id, access_token = await GeNeRaTeAccEss(account_uid, password)
if not open_id or not access_token:
print(f"❌ Failed to authenticate {account_uid}")
continue
# Create a proper join request using the account's identity
# We'll use the existing SEnd_InV function but with account context
join_packet = await create_authenticated_join(target_uid, account_uid, key, iv, region)
if join_packet:
await SEndPacKeT(whisper_writer, online_writer, 'OnLine', join_packet)
success_count += 1
print(f"✅ Join sent from authenticated account: {account_uid}")
# Important: Wait between requests
await asyncio.sleep(2)
except Exception as e:
print(f"❌ Error with account {account_uid}: {e}")
continue
return success_count, total_accounts
except Exception as e:
print(f"❌ Multi-account join error: {e}")
return 0, 0
async def handle_badge_command(cmd, inPuTMsG, uid, chat_id, key, iv, region, chat_type):
"""Handle individual badge commands"""
parts = inPuTMsG.strip().split()
if len(parts) < 2:
error_msg = f"[B][C][FF0000]❌ Usage: /{cmd} (uid)\nExample: /{cmd} 123456789\n"
await safe_send_message(chat_type, error_msg, uid, chat_id, key, iv)
return
target_uid = parts[1]
badge_value = BADGE_VALUES.get(cmd, 1048576)
if not target_uid.isdigit():
error_msg = f"[B][C][FF0000]❌ Please write a valid player ID!\n"
await safe_send_message(chat_type, error_msg, uid, chat_id, key, iv)
return
# Send initial message
initial_msg = f"[B][C][1E90FF]🌀 Request received! Preparing to spam {target_uid}...\n"
await safe_send_message(chat_type, initial_msg, uid, chat_id, key, iv)
try:
# Reset bot state
await reset_bot_state(key, iv, region)
# Create and send join packets
join_packet = await request_join_with_badge(target_uid, badge_value, key, iv, region)
spam_count = 3
for i in range(spam_count):
await SEndPacKeT(whisper_writer, online_writer, 'OnLine', join_packet)
print(f"✅ Sent /{cmd} request #{i+1} with badge {badge_value}")
await asyncio.sleep(0.1)
success_msg = f"[B][C][00FF00]✅ Successfully Sent {spam_count} Join Requests!\n🎯 Target: {target_uid}\n🏷️ Badge: {badge_value}\n"
await safe_send_message(chat_type, success_msg, uid, chat_id, key, iv)
# Cleanup
await asyncio.sleep(1)
await reset_bot_state(key, iv, region)
except Exception as e:
error_msg = f"[B][C][FF0000]❌ Error in /{cmd}: {str(e)}\n"
await safe_send_message(chat_type, error_msg, uid, chat_id, key, iv)
async def create_authenticated_join(target_uid, account_uid, key, iv, region):
"""Create join request that appears to come from the specific account"""
try:
# Use the standard invite function but ensure it uses account context
join_packet = await SEnd_InV(5, int(target_uid), key, iv, region)
return join_packet
except Exception as e:
print(f"❌ Error creating join packet: {e}")
return None
async def create_account_join_packet(self, target_uid, account_uid, open_id, access_token, key, iv, region):
"""Create join request packet for specific account"""
try:
# This is where you use the account's actual UID instead of main bot UID
fields = {
1: 33,
2: {
1: int(target_uid), # Target UID
2: region.upper(),
3: 1,
4: 1,
5: bytes([1, 7, 9, 10, 11, 18, 25, 26, 32]),
6: f"BOT:[C][B][FF0000] ACCOUNT_{account_uid[-4:]}", # Show account UID
7: 330,
8: 1000,
10: region.upper(),
11: bytes([49, 97, 99, 52, 98, 56, 48, 101, 99, 102, 48, 52, 55, 56,
97, 52, 52, 50, 48, 51, 98, 102, 56, 102, 97, 99, 54, 49, 50, 48, 102, 53]),
12: 1,
13: int(account_uid), # Use the ACCOUNT'S UID here, not target UID!
14: {
1: 2203434355,
2: 8,
3: "\u0010\u0015\b\n\u000b\u0013\f\u000f\u0011\u0004\u0007\u0002\u0003\r\u000e\u0012\u0001\u0005\u0006"
},
16: 1,
17: 1,
18: 312,
19: 46,
23: bytes([16, 1, 24, 1]),
24: int(await get_random_avatar()),
26: "",
28: "",
31: {
1: 1,
2: 32768 # V-Badge
},
32: 32768,
34: {
1: int(account_uid), # Use the ACCOUNT'S UID here too!
2: 8,
3: bytes([15,6,21,8,10,11,19,12,17,4,14,20,7,2,1,5,16,3,13,18])
}
},
10: "en",
13: {
2: 1,
3: 1
}
}
packet = (await CrEaTe_ProTo(fields)).hex()
if region.lower() == "ind":
packet_type = '0514'
elif region.lower() == "bd":
packet_type = "0519"
else:
packet_type = "0515"
return await GeneRaTePk(packet, packet_type, key, iv)
except Exception as e:
print(f"❌ Error creating join packet for {account_uid}: {e}")
return None
# Global instance
multi_account_manager = MultiAccountManager()
async def auto_rings_emote_dual(sender_uid, key, iv, region):
"""Send The Rings emote to both sender and bot for dual emote effect"""
try:
# The Rings emote ID
rings_emote_id = 909050009
# Get bot's UID
bot_uid = 13699776666
# Send emote to SENDER (person who invited)
emote_to_sender = await Emote_k(int(sender_uid), rings_emote_id, key, iv, region)
await SEndPacKeT(whisper_writer, online_writer, 'OnLine', emote_to_sender)
# Small delay between emotes
await asyncio.sleep(0.5)
# Send emote to BOT (bot performs emote on itself)
emote_to_bot = await Emote_k(int(bot_uid), rings_emote_id, key, iv, region)
await SEndPacKeT(whisper_writer, online_writer, 'OnLine', emote_to_bot)
print(f"🤖 Bot performed dual Rings emote with sender {sender_uid} and bot {bot_uid}!")
except Exception as e:
print(f"Error sending dual rings emote: {e}")
async def Room_Spam(Uid, Rm, Nm, K, V):
same_value = random.choice([32768]) #you can add any badge value
fields = {
1: 78,
2: {
1: int(Rm),
2: "iG:[C][B][FF0000] BLACK_APIS",