Created
July 3, 2021 15:38
-
-
Save connorslade/38ed98d88e1045cd3238fbcecb6e391e to your computer and use it in GitHub Desktop.
A simple python program to find available short account names in Minecraft
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import requests | |
import time | |
# Mojang Auth | |
USERNAME = "" | |
PASSWORD = "" | |
chars = [chr(x) for x in range(ord('a'), ord('z') + 1)] | |
usedNames = [] | |
def genName(len): | |
working = '' | |
for _ in range(len): | |
working += random.choice(chars) | |
return working | |
def newName(len, usedNames): | |
name = genName(len) | |
if name in usedNames: | |
return newName(len, usedNames) | |
return name | |
def checkName(name, token): | |
r = requests.get(f'https://api.minecraftservices.com/minecraft/profile/name/{name}/available', headers={"Authorization": f"Bearer {token}"}) | |
if r.status_code == 200: | |
return r.json() | |
time.sleep(5) | |
return checkName(name, token) | |
def main(): | |
auth = requests.post('https://authserver.mojang.com/authenticate', json={"agent": { "name": "Minecraft", "version": 1 }, "username": USERNAME, "password": PASSWORD, "clientToken": "a73661b0c690b66d4bc3ea90d21bef9b", "requestUser": True}) | |
token = auth.json()['accessToken'] | |
for _ in range(50): | |
name = newName(4, usedNames) | |
usedNames.append(name) | |
print(f'[*] Trying: {name}') | |
r = checkName(name, token) | |
if 'status' in r and r['status'] == 'AVAILABLE': | |
print(f'[+] Found: {name}') | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment