-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchecker.py
200 lines (164 loc) · 10.7 KB
/
checker.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
import requests
import json
import random
import concurrent.futures
class config():
with open("config.json", "r") as cfg:
data = json.load(cfg)
min_members = data[0]["min_members"]
max_members = data[0]["max_members"]
min_members_online = data[0]["min_members_online"]
min_boosts = data[0]["min_boosts"]
use_proxies = data[0]["use_proxies"]
threads = data[0]["threads"]
save_only_permanent_invites = data[0]["save_only_permanent_invites"]
class counter():
hit = 0
bad = 0
failed = 0
deduped_proxies = []
def send_request(invite_code):
if config.use_proxies == True:
global deduped_proxies
proxy = random.choice(deduped_proxies)
try:
# print(f"DEBUG > Using proxy: {proxy}")
r = requests.get(url=f"https://discordapp.com/api/v6/invites/{invite_code}?with_counts=true&?with_expiration=true", timeout=7.5, proxies={"http": f"http://{proxy}", "https": f"https://{proxy}"})
return r.json()
except Exception as e:
print(f"[FAILED] - Failed Request: {invite_code} - {e}")
with open("failed.txt", "a") as failed_file:
failed_file.write(f"{invite_code}\n")
counter.failed += 1
return None
else:
try:
r = requests.get(url=f"https://discordapp.com/api/v6/invites/{invite_code}?with_counts=true&?with_expiration=true", timeout=5) # no proxy
return r.json()
except Exception as e:
print(f"[FAILED] - Failed Request: {invite_code} - {e}")
with open("failed.txt", "a") as failed_file:
failed_file.write(f"{invite_code}\n")
counter.failed += 1
return None
def check_invite(invite_code):
response_data = send_request(invite_code=invite_code)
if response_data != None:
try:
invite_type = response_data["type"] # Should be 0, otherwhise its not a server invite
expires_at = response_data["expires_at"] # if == "null" it never expires, otherwhise shows a date
guild_id = response_data["guild"]["id"] # Server ID. Can be used later to counter dupes
guild_name = response_data["guild"]["name"] # Name of the guild. Only used to show in displayed log
boosts = response_data["guild"]["premium_subscription_count"] # Count boosts amount
members = response_data["approximate_member_count"] # Member count
members_online = response_data["approximate_presence_count"] # Members online count
# print(f"""Debug test:\nCode: {invite_code}\nInvite Type: {invite_type}\nExpires At: {expires_at}\nGuild ID: {guild_id}\nGuild Name: {guild_name}\nBoosts: {boosts}\nMembers: {members}\nMembers Online: {members_online}\n\nWohoo!""")
guilds_ids = []
if guild_id in guilds_ids: # Guild was already checked before
print("Duped guild!")
pass
else:
if invite_type == 0:
guilds_ids.append(guild_id)
if members >= config.min_members and members <= config.max_members:
if boosts >= config.min_boosts:
if members_online >= config.min_members_online:
if config.save_only_permanent_invites == True:
if expires_at == None:
print(f"[HIT] - Valid Invite: {invite_code} · Members: {members_online}/{members} · Boosts: {boosts} · Guild: {guild_name} ({guild_id})")
with open("valid.txt", "a") as validfile:
validfile.write(f"{invite_code}\n")
with open("valid_ids.txt", "a") as valid_ids_file:
valid_ids_file.write(f"{guild_id}\n")
counter.hit += 1
else:
print(f"[BAD] - Invite Not Permanent: {invite_code}")
with open("bad.txt", "a") as bad_file:
bad_file.write(f"{invite_code}\n")
counter.bad += 1
else:
print(f"[HIT] - Valid Invite: {invite_code} · Members: {members_online}/{members} · Boosts: {boosts} · Guild: {guild_name} ({guild_id})")
with open("valid.txt", "a") as validfile:
validfile.write(f"{invite_code}\n")
with open("valid_ids.txt", "a") as valid_ids_file:
valid_ids_file.write(f"{guild_id}")
counter.hit += 1
else:
print(f"[BAD] - Not Enough Members Online: {invite_code}")
with open("bad.txt", "a") as bad_file:
bad_file.write(f"{invite_code}\n")
counter.bad += 1
else:
print(f"[BAD] - Not Enough Boosts: {invite_code}")
with open("bad.txt", "a") as bad_file:
bad_file.write(f"{invite_code}\n")
counter.bad += 1
else:
print(f"[BAD] - Member Amount Mismatch: {invite_code}")
with open("bad.txt", "a") as bad_file:
bad_file.write(f"{invite_code}\n")
counter.bad += 1
else:
print(f"[BAD] - Not a Server Invite: {invite_code}")
with open("bad.txt", "a") as bad_file:
bad_file.write(f"{invite_code}\n")
counter.bad += 1
except KeyError:
print(f"[BAD] - Dead Invite: {invite_code}")
with open("invalid.txt", "a") as invalid_file:
invalid_file.write(f"{invite_code}\n")
counter.bad += 1
except Exception as e:
print(f"[FAILED] - Failed Checking: {invite_code} - {e}")
with open("failed.txt", "a") as failed_file:
failed_file.write(f"{invite_code}\n")
counter.failed += 1
else:
pass
def main():
title = """
██▓ ███▄ █ ██▒ █▓ ██▓▄▄▄█████▓▓█████ ▄████▄ ██░ ██ ▓█████ ▄████▄ ██ ▄█▀▓█████ ██▀███
▓██▒ ██ ▀█ █▓██░ █▒▓██▒▓ ██▒ ▓▒▓█ ▀ ▒██▀ ▀█ ▓██░ ██▒▓█ ▀ ▒██▀ ▀█ ██▄█▒ ▓█ ▀ ▓██ ▒ ██▒
▒██▒▓██ ▀█ ██▒▓██ █▒░▒██▒▒ ▓██░ ▒░▒███ ▒▓█ ▄ ▒██▀▀██░▒███ ▒▓█ ▄ ▓███▄░ ▒███ ▓██ ░▄█ ▒
░██░▓██▒ ▐▌██▒ ▒██ █░░░██░░ ▓██▓ ░ ▒▓█ ▄ ▒▓▓▄ ▄██▒░▓█ ░██ ▒▓█ ▄ ▒▓▓▄ ▄██▒▓██ █▄ ▒▓█ ▄ ▒██▀▀█▄
░██░▒██░ ▓██░ ▒▀█░ ░██░ ▒██▒ ░ ░▒████▒ ▒ ▓███▀ ░░▓█▒░██▓░▒████▒▒ ▓███▀ ░▒██▒ █▄░▒████▒░██▓ ▒██▒
░▓ ░ ▒░ ▒ ▒ ░ ▐░ ░▓ ▒ ░░ ░░ ▒░ ░ ░ ░▒ ▒ ░ ▒ ░░▒░▒░░ ▒░ ░░ ░▒ ▒ ░▒ ▒▒ ▓▒░░ ▒░ ░░ ▒▓ ░▒▓░
▒ ░░ ░░ ░ ▒░ ░ ░░ ▒ ░ ░ ░ ░ ░ ░ ▒ ▒ ░▒░ ░ ░ ░ ░ ░ ▒ ░ ░▒ ▒░ ░ ░ ░ ░▒ ░ ▒░
▒ ░ ░ ░ ░ ░░ ▒ ░ ░ ░ ░ ░ ░░ ░ ░ ░ ░ ░░ ░ ░ ░░ ░
░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░░ ░ ░ ░ ░ ░ ░
░ ░ ░
-> Coded by @tec9_xd#0 / @tec9_eu
Version: Release 1.0
"""
print(title)
input(f"Please put your invite CODES (not invite links) into invites.txt. An invite link looks like this: https://discord.gg/example123 , It's code is \"example123\".\n\nPress ENTER to launch the checker.")
with open("proxies.txt", "r", encoding="utf-8", errors="ignore") as proxies_file:
proxies = proxies_file.readlines()
print(f"Successfully loaded {sum(1 for proxie in proxies)} proxies from proxies.txt!")
global deduped_proxies
p_dupes_count = 0
for proxie in proxies:
proxie = proxie.strip()
if proxie not in deduped_proxies:
deduped_proxies.append(proxie)
else:
p_dupes_count =+ 1
print(f"Ignoring {p_dupes_count} duplicate proxies...")
with open("invites.txt", "r", encoding="utf-8", errors="ignore") as invites_file:
invites = invites_file.readlines()
print(f"Successfully loaded {sum(1 for invite in invites)} invites from invites.txt!")
deduped_invites = []
dupes_count = 0
for invite in invites:
invite = invite.strip()
if invite not in deduped_invites:
deduped_invites.append(invite)
else:
dupes_count =+ 1
print(f"Ignoring {dupes_count} duplicate invites...")
#for deduped_invite in deduped_invites:
#check_invite(deduped_invite)
with concurrent.futures.ThreadPoolExecutor(max_workers=config.threads) as executor:
executor.map(check_invite, deduped_invites)
print(f"Checking Process Finished. Results: \nHits: {counter.hit}, Bad: {counter.bad}, Failed: {counter.failed}")
main()