Skip to content

Instantly share code, notes, and snippets.

@Kqzz
Last active August 5, 2020 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kqzz/9e96a832d04bf84050d83aa343df757c to your computer and use it in GitHub Desktop.
Save Kqzz/9e96a832d04bf84050d83aa343df757c to your computer and use it in GitHub Desktop.
<email>:<pswd>:q1:q2:q3
import asyncio
from aiohttp import ClientSession
import datetime
import time
import random
import requests
from fake_useragent import UserAgent
from colorama import init, Fore
ua = UserAgent()
init()
import new_proxy_scrape
fonts = ["""
███╗ ███╗ ██████╗███████╗███╗ ██╗██╗██████╗ ███████╗██████╗ ██████╗ ██╗ ██╗
████╗ ████║██╔════╝██╔════╝████╗ ██║██║██╔══██╗██╔════╝██╔══██╗██╔══██╗╚██╗ ██╔╝
██╔████╔██║██║ ███████╗██╔██╗ ██║██║██████╔╝█████╗ ██████╔╝██████╔╝ ╚████╔╝
██║╚██╔╝██║██║ ╚════██║██║╚██╗██║██║██╔═══╝ ██╔══╝ ██╔══██╗██╔═══╝ ╚██╔╝
██║ ╚═╝ ██║╚██████╗███████║██║ ╚████║██║██║ ███████╗██║ ██║██║ ██║
╚═╝ ╚═╝ ╚═════╝╚══════╝╚═╝ ╚═══╝╚═╝╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝
""",
"""
███▄ ▄███▓ ▄████▄ ██████ ███▄ █ ██▓ ██▓███ ▓█████ ██▀███ ██▓███ ▓██ ██▓
▓██▒▀█▀ ██▒▒██▀ ▀█ ▒██ ▒ ██ ▀█ █ ▓██▒▓██░ ██▒▓█ ▀ ▓██ ▒ ██▒▓██░ ██▒▒██ ██▒
▓██ ▓██░▒▓█ ▄ ░ ▓██▄ ▓██ ▀█ ██▒▒██▒▓██░ ██▓▒▒███ ▓██ ░▄█ ▒▓██░ ██▓▒ ▒██ ██░
▒██ ▒██ ▒▓▓▄ ▄██▒ ▒ ██▒▓██▒ ▐▌██▒░██░▒██▄█▓▒ ▒▒▓█ ▄ ▒██▀▀█▄ ▒██▄█▓▒ ▒ ░ ▐██▓░
▒██▒ ░██▒▒ ▓███▀ ░▒██████▒▒▒██░ ▓██░░██░▒██▒ ░ ░░▒████▒░██▓ ▒██▒▒██▒ ░ ░ ░ ██▒▓░
░ ▒░ ░ ░░ ░▒ ▒ ░▒ ▒▓▒ ▒ ░░ ▒░ ▒ ▒ ░▓ ▒▓▒░ ░ ░░░ ▒░ ░░ ▒▓ ░▒▓░▒▓▒░ ░ ░ ██▒▒▒
░ ░ ░ ░ ▒ ░ ░▒ ░ ░░ ░░ ░ ▒░ ▒ ░░▒ ░ ░ ░ ░ ░▒ ░ ▒░░▒ ░ ▓██ ░▒░
░ ░ ░ ░ ░ ░ ░ ░ ░ ▒ ░░░ ░ ░░ ░ ░░ ▒ ▒ ░░
░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
░ ░ ░""",
"""
▄▄▄▄███▄▄▄▄ ▄████████ ▄████████ ███▄▄▄▄ ▄█ ▄███████▄ ▄████████ ▄████████ ▄███████▄ ▄██ ▄
▄██▀▀▀███▀▀▀██▄ ███ ███ ███ ███ ███▀▀▀██▄ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ██▄
███ ███ ███ ███ █▀ ███ █▀ ███ ███ ███▌ ███ ███ ███ █▀ ███ ███ ███ ███ ███▄▄▄███
███ ███ ███ ███ ███ ███ ███ ███▌ ███ ███ ▄███▄▄▄ ▄███▄▄▄▄██▀ ███ ███ ▀▀▀▀▀▀███
███ ███ ███ ███ ▀███████████ ███ ███ ███▌ ▀█████████▀ ▀▀███▀▀▀ ▀▀███▀▀▀▀▀ ▀█████████▀ ▄██ ███
███ ███ ███ ███ █▄ ███ ███ ███ ███ ███ ███ █▄ ▀███████████ ███ ███ ███
███ ███ ███ ███ ███ ▄█ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███
▀█ ███ █▀ ████████▀ ▄████████▀ ▀█ █▀ █▀ ▄████▀ ██████████ ███ ███ ▄████▀ ▀█████▀
███ ███
"""]
print(random.choice(fonts))
def get_accs():
accs = []
with open("accounts.txt", "r") as f:
bad_accs = f.readlines()
for acc in bad_accs:
if acc == ['']:
continue
acc.strip('\n')
acc = acc.split(':')
acc_dict = dict()
acc_dict["email"] = acc[0]
acc_dict["password"] = acc[1]
acc_dict["questions"] = [acc[2], acc[3], acc[4].strip('\n')]
accs.append(acc_dict)
return accs
def authenticate(email, password):
authenticate_json = {"agent": {"name": "Minecraft", "version": 1}, "username": email, "password": password}
headers = {"User-Agent": ua.random, "Content-Type": "application/json"}
r = requests.post("https://authserver.mojang.com/authenticate", json=authenticate_json, headers=headers)
username = r.json()["selectedProfile"]["name"]
return r.json()["accessToken"], r.json()["selectedProfile"]["name"], r.json()["selectedProfile"]["id"]
def get_questions(bearer):
global auth
auth = {"Authorization": "Bearer: " + config["bearer"]}
questions = requests.get("https://api.mojang.com/user/security/challenges", headers=auth)
questions = questions.json()
try:
if questions["errorMessage"] == "The request requires user authentication":
print("Bearer didn't work...")
except TypeError:
return questions
def validate(token):
r = requests.post("https://authserver.mojang.com/validate", json={"accessToken": token}, headers={"User-Agent": ua.random, "Content-Type": "application/json"})
if r.status_code != 204:
print(Fore.RED, "Failed to authenticate", Fore.RESET)
def acc_setup(config, questions, uuid):
answers = []
if len(questions) == 0:
return
for i in range(3):
answers.append({"id": questions[i]["answer"]["id"], "answer": config["questions"][i]})
post_answers = requests.post("https://api.mojang.com/user/security/location", json=answers, headers=auth)
if post_answers.status_code != 204:
print(f"{Fore.RED} Failed: {post_answers.text} {Fore.RESET}")
else:
print(Fore.GREEN, f"credentials for {config['email']} verified {Fore.RESET} ")
def full_auth():
global uuid
config["bearer"], username, uuid = authenticate(config["email"], config["password"])
qs = get_questions(config["bearer"])
acc_setup(config, qs, uuid)
validate(config["bearer"])
async def fetch(url, session, json):
async with session.post(url, headers=auth, json=json) as response:
try:
print("{} | {}".format(datetime.datetime.now(), response.status))
except:
print("request failed")
time.sleep(.0016)
return await response.read()
async def bound_fetch(sem, url, session, json):
# Getter function with semaphore.
async with sem:
await fetch(url, session, json)
async def run(r):
url = f"https://api.mojang.com/user/profile/random/name"
tasks = []
# create instance of Semaphore
sem = asyncio.Semaphore(1000)
# Create client session that will ensure we dont open new connection
# per each request.
async with ClientSession() as session:
for _ in range(r):
# pass Semaphore and session to every GET request
task = asyncio.ensure_future(bound_fetch(sem, url, session, {"name": config["target"], "password": config["password"]}))
tasks.append(task)
responses = asyncio.gather(*tasks)
await responses
loop = asyncio.get_event_loop()
config = get_accs()[0]
config["target"] = input('What name would you like to snipe? >> ')
number = int(input("how many requests? >> "))
future = asyncio.ensure_future(run(number))
input("press enter to get proxies >> ")
# proxies = new_proxy_scrape.run()
input("press enter to run auth >> ")
full_auth()
input("press enter to start sniping >> ")
start = time.time()
loop.run_until_complete(future)
print("took:", time.time() - start, "seconds")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment