forked from vida1338/MassDN-source
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
359 lines (297 loc) · 14.5 KB
/
main.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
from itertools import cycle
from tasksio import TaskPool
from colorama import Fore, Back, Style
from scrape import scrape
from websocket import create_connection
import authsocket
import subprocess
import hashlib
import json
import psutil
import os
import global_variables
import asyncio
import utils
import api
import title_worker
import random
import emoji
import traceback
async def GPUtil():
try:
title_worker.WORKER_MODE = "main"
global_variables.tokens = [line.rstrip(
"\n") for line in open("data/tokens.txt", "r")]
print()
count = input("LIMITER> Limit tokens? (blank if not): ")
if count != "":
global_variables.tokens = global_variables.tokens[:int(count)]
# CUSTOM SCRIPT
print()
if global_variables.app_data["customScripts"] == "true":
if input("LUA> Use custom scripts? Y/N: ").lower() == "y":
pass
guild_info = None
# JOINER
if input("JOINER> Run Joiner? Y/N: ").lower() == "y":
title_worker.WORKER_MODE = "joiner"
invite = input("JOINER> Invite: ")
delay = input("JOINER> Delay? (blank if not): ")
if delay == "":
delay = 0
else:
delay = float(delay)
if invite.endswith("/"):
invite = invite[:-1]
if 'discord' in invite and '/' in invite and 'http' in invite:
splitter = invite.split('/')
invite = splitter[len(splitter)-1]
guild_info = await api.getInviteInfo(invite)
if guild_info == {"message": "Unknown Invite", "code": 10006}:
print("JOINER> ERROR, Unknown invite.")
return await GPUtil()
global_variables.current_guild_info = guild_info
if 'approximate_member_count' in guild_info and 'approximate_presence_count' in guild_info:
member_count = utils.returnApproxCount(
guild_info["approximate_member_count"], guild_info["approximate_presence_count"])
print("JOINER> Recommended token count: approx. " + str(round(member_count / 4)
) + ", risk mode: approx. " + str(round((member_count / 9))))
global_variables.approximate_presence_count = guild_info["approximate_presence_count"]
global_variables.approximate_member_count = guild_info["approximate_member_count"]
count = input("JOINER> Limit tokens? (blank if not): ")
if count != "":
global_variables.tokens = global_variables.tokens[:int(count)]
print(
f"JOINER> Attempting to join: {Fore.CYAN}{guild_info['guild']['name']}{Fore.RESET}")
print()
#global_variables.ws.send(json.dumps(authsocket.obfuscateObj({"op": "science", "event": "guild_joiner", "guild_id": guild_info["guild"]["id"], "guild_name": guild_info["guild"]["name"], "invite": invite})))
async with TaskPool(10_000) as pool:
for token in global_variables.tokens:
await pool.put(api.joinGuild(invite, token, guild_info))
await asyncio.sleep(delay)
print()
token_list_scraping_token = global_variables.tokens
if len(global_variables.joined_tokens) != 0:
token_list_scraping_token = global_variables.joined_tokens
scrapingToken = input(
"SCRAPER> Scraping token? (blank to pick one from the list): ")
if scrapingToken == "":
scrapingToken = random.choice(token_list_scraping_token)
# EMOJI VERIFICATOR
if input("REACTOR> Run emoji verificator? Y/N: ").lower() == "y":
channels = None
selected_channel = None
if guild_info != None:
channels = await api.getGuildChannels(scrapingToken, guild_info["guild"]["id"])
else:
channels = await api.getGuildChannels(scrapingToken, input("REACTOR> Guild ID: "))
while True:
id = input("REACTOR> Channel ID: ")
for channel in channels:
if str(channel["id"]) == id:
selected_channel = channel
break
if selected_channel != None:
break
print("REACTOR> Invalid ID! ")
reactions = []
channelReactions = await api.getReactions(scrapingToken, selected_channel["id"])
# print(channelReactions)
if len(channelReactions) != 0:
reactions.append({"channel": {
"id": selected_channel["id"], "name": selected_channel["name"]}, "reactions": channelReactions})
emojis = []
for reaction in reactions:
obj = {"channel_id": reaction["channel"]["id"],
"channel_name": reaction["channel"]["name"], "reactions": []}
for reactionEmojis in reaction["reactions"]:
emojiList = {
"message_id": reactionEmojis["message"]["id"], "reactions": []}
for reactionEmoji in reactionEmojis["reactions"]:
if reactionEmoji["emoji"]["id"] == None:
emojiOutput = emoji.demojize(
reactionEmoji["emoji"]["name"])
else:
emojiOutput = reactionEmoji["emoji"]["name"] + \
":" + reactionEmoji["emoji"]["id"]
emojiList["reactions"].append(emojiOutput)
obj["reactions"].append(emojiList)
obj["reactions"].reverse()
emojis.append(obj)
print()
choices = {}
choosen = None
i = 1
emojis.reverse()
for avaiableMessage in emojis:
for avaiableReactions in avaiableMessage["reactions"]:
for reaction in avaiableReactions["reactions"]:
print(
f"REACTOR> Choice #{i} {avaiableMessage['channel_name']} - messageID: {avaiableReactions['message_id']} - {reaction}")
choices[i] = {"channel_id": avaiableMessage["channel_id"],
"message_id": avaiableReactions["message_id"], "emoji": reaction}
i += 1
while True:
choice = input("\nREACTOR> Choice: ")
if choice.isdigit() and int(choice) in choices:
choosen = choices[int(choice)]
break
else:
print("REACTOR> Invalid choice.")
if choosen["emoji"][0] == ":" and choosen["emoji"][len(choosen["emoji"]) - 1] == ":":
choosen["emoji"] = emoji.emojize(choosen["emoji"])
res = await api.addReaction(scrapingToken, choosen)
if res.status_code == 204:
print(
f"{Fore.GREEN}REACTOR> Successfully added reaction{Fore.RESET} from scraping token '{utils.getTokenId(scrapingToken)}'")
else:
print("REACTOR> No reactions found.")
# SCRAPER
print()
loading_method = input(
"SCRAPER> Load ID's from ids.txt? Y/N: ").lower()
if loading_method == "y":
with open("data/ids.txt", "r") as ids:
ids = ids.read().split("\n")
else:
title_worker.WORKER_MODE = "scraper"
if guild_info != None:
guild_id = str(guild_info["guild"]["id"])
else:
guild_id = input("SCRAPER> Guild ID: ")
channels = await api.getGuildChannels(scrapingToken, guild_id)
print()
choices = {}
choosen = None
i = 1
for channel in channels:
print(
f"SCRAPER> Choice #{i} #{channel['name']} - {channel['id']}")
choices[i] = channel["id"]
i += 1
while True:
choice = input(
"\nSCRAPER> Choice (either on list or channelID): ")
if choice.isdigit() and len(str(choice)) == 18:
choosen = choice
break
if choice.isdigit() and int(choice) in choices:
choosen = choices[int(choice)]
break
else:
print("SCRAPER> Invalid choice.")
print("SCRAPER> See title for updates.")
ids = scrape(scrapingToken, guild_id, str(choosen))
#ids = list(dict.fromkeys(ids))
print(f"{Fore.GREEN}SCRAPER> {len(ids)} IDs loaded.{Fore.RESET}")
global_variables.ids_scraped_finished = len(ids)
# DMER
print()
embed_msg = None
use_embeds = input("MASS DM> Use embeds? Y/N: ").lower()
if use_embeds == "y":
with open("data/embed_data.json", "r", encoding="utf-8-sig") as embed:
embed = json.loads(embed.read())
embed_msg = input(
"MASS DM> Embed message? (leave empty if just the embed): ")
else:
msg_loading_method = input(
"MASS DM> Load message from message.txt? Y/N: ").lower()
if msg_loading_method == "y":
with open("data/message.txt", "r", encoding="utf-8-sig") as msgs:
message = msgs.read()
else:
message = input("MASS DM> Message: ")
mdm_delay = input("MASS DM> Delay? (blank if not): ")
if mdm_delay == "":
mdm_delay = 0
else:
mdm_delay = float(mdm_delay)
title_worker.WORKER_MODE = "dmer"
token_list = global_variables.tokens
if len(global_variables.joined_tokens) != 0:
token_list = global_variables.joined_tokens
blacklisted_ids = [utils.getTokenId(token) for token in token_list] + [
line.rstrip('\n') for line in open('data/blacklist.txt')]
maxDms = input(
"MASS DM> Limit DM's? (if yes input a DM count, else leave blank): ")
if maxDms == '':
maxDms = -1
global_variables.successful_dm_limit = int(maxDms)
print()
async with TaskPool(10_000) as pool:
for id in ids:
if global_variables.successful_dm_limit == 0:
break
if id in blacklisted_ids or id in global_variables.dmed_users: continue
additionalData = {
"user_id": id
}
if use_embeds == "y":
payload = {
"content": utils.prepareMessage(embed_msg, additionalData),
"embeds": [ utils.prepareEmbed(embed, additionalData) ],
"nonce": utils.generateNonce()
}
await pool.put(utils.sendDm(utils.getToken(), id, payload))
else:
payload = {
"content": utils.prepareMessage(message, additionalData),
"nonce": utils.generateNonce()
}
await pool.put(utils.sendDm(utils.getToken(), id, payload))
await asyncio.sleep(mdm_delay)
print(
f"\nOUTPUT> Successfully sent {str(global_variables.messages_sent)} messages and {str(global_variables.messages_failed)} failed. Checking tokens...")
with open("data/dmed_ids.txt", "w") as f:
f.write('\n'.join(global_variables.dmed_users))
f.close()
async with TaskPool(10_000) as pool:
for token in token_list_scraping_token:
await pool.put(api.checkToken(token))
print(
f"OUTPUT> Tokens checked, {global_variables.valid_tokens_count}/{len(token_list_scraping_token)} valid.")
with open("data/tokens.txt", "w") as f:
f.write('\n'.join(global_variables.valid_tokens))
f.close()
input()
except Exception as e:
print(
f"{global_variables.app_data['tool_name']}> A unexpected error occured. Please report it in the {Fore.CYAN}discord server{Fore.RESET}.", e)
return await GPUtil()
def FrozerImporter():
global_variables.ws = create_connection("ws://91.244.197.101:6942")
global_variables.ws.send(json.dumps(
authsocket.obfuscateObj({"op": "app_init"})))
global_variables.app_data = authsocket.deobfuscateObject(
json.loads(global_variables.ws.recv()))
title_worker.initializeWorker()
hwid = hashlib.md5(subprocess.check_output(
'wmic csproduct get uuid').decode().split('\n')[1].strip().encode()).hexdigest()
utils.clearConsole()
print(f"> HWID: {Fore.CYAN}{hwid}{Style.RESET_ALL}")
print(
f"> Discord Server: {Fore.CYAN}{global_variables.app_data['discord']}{Style.RESET_ALL}")
print(
f"> Telegram Group: {Fore.CYAN}{global_variables.app_data['telegram']}{Style.RESET_ALL}")
print(
f"> MOTD: {Fore.CYAN}{global_variables.app_data['motd']}{Style.RESET_ALL}")
if float(global_variables.app_data["app_lock"]) >= global_variables.current_version:
print(f"> {Fore.RED}WARNING: {Style.RESET_ALL}Application is currently locked for this version. Please download an update.")
input()
exit()
global_variables.ws.send(json.dumps(
authsocket.obfuscateObj({"op": "auth", "hwid": hwid})))
auth_data = authsocket.deobfuscateObject(
json.loads(global_variables.ws.recv()))
if auth_data["status"] == "loggedIn":
print(f"> {Fore.CYAN}Successfully logged in!{Style.RESET_ALL}")
Fernet()
else:
print(
f"> You are not authenticated, please create a ticket in {Fore.CYAN}discord server{Style.RESET_ALL}.")
input()
def Fernet():
asyncio.run(GPUtil())
if __name__ == '__main__':
FrozerImporter()