This repository has been archived by the owner on Apr 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Minecraft.py
84 lines (56 loc) · 2.07 KB
/
Minecraft.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
import requests as Requests;
import string as String;
import random as Random;
import json as Json;
from colorama import Fore, Style;
from Rainbow import Rainbow;
Rainbow()
print(Fore.YELLOW + '* Some usernames may be blocked by Microsoft, but still flagged as available. \n\n')
input(Fore.MAGENTA + f'* Do you want to use numbers too? (Y/N): ')
def Characters():
Characters = String.ascii_letters
if input == 'y':
Characters += String.digits
return Characters
Chars = Characters()
Length = input('\n' + Fore.LIGHTBLUE_EX + '* How long do you want the username to be? (Max: 16): ')
Char = int(Length)
if Char > 16 or Char < 3:
input(Fore.RED + 'Invalid username.. Press enter to close this menu ... ')
exit()
Amount = input('\n' + Fore.GREEN + '* How many usernames do you want to generate?: ')
Users = int(Amount)
print()
def Generate():
Username = ''.join(Random.choice(Chars) for i in range(Char))
return Username
def Check(Username):
Request = Requests.get('https://api.mojang.com/users/profiles/minecraft/' + Username)
if Request.status_code == 204:
return True
else:
try:
response = Json.loads(Request.text)
if 'errorMessage' in response or 'The request is blocked.' in response:
return True
else:
return False
except:
return False
def Main():
Available = []
for i in range(Users):
Username = Generate()
if Check(Username) == True:
Available.append(Username)
print(Fore.GREEN + Username + Style.RESET_ALL + ' - Available')
else:
print(Fore.RED + Username + Style.RESET_ALL + ' - Taken')
return Available
Available = Main()
if Available:
print(f'\nAvailable Usernames Scraped ({len(Available)}): \n')
for Username in Available:
print(Fore.GREEN + "* " + Username + Style.RESET_ALL)
input('\n' + 'Press enter to continue ... ')
exit()