Advertisement
team_CFrame

Untitled

Dec 17th, 2017
545
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.91 KB | None | 0 0
  1. import sys
  2. import re
  3. import recaptcha
  4. import requests
  5. import json
  6. import random
  7. import queue
  8. import threading
  9.  
  10. emails_q = queue.Queue()
  11. proxies_q = queue.Queue()
  12.  
  13. def debug(text, conf):
  14.     if conf['debug']:
  15.         print ("[DEBUG] "+str(text))
  16.  
  17. def read_configurations():
  18.     try:
  19.         conf = json.loads(open('discord_register.json','r').read())
  20.         print ("Loaded configs with values:")
  21.         print ("\temails_file: " + str(conf['emails_file']))
  22.         print ("\toutput_file: " + str(conf['output_file']))
  23.         print ("\tproxy_file: " + str(conf['proxy_file']))
  24.         print ("\tproxy_blacklist_file: " + str(conf['proxy_blacklist_file']))
  25.         print ("\ttimeout: " + str(conf['timeout']))
  26.         print ("\tnb_threads: " + str(conf['nb_threads']))
  27.         print ("\tdebug: " + str(conf['debug']))
  28.         return conf
  29.     except:
  30.         print ("ERROR")
  31.         sys.exit(1)
  32.  
  33. def array_to_queue(arr, q):
  34.     for i in arr:
  35.         q.put(i)
  36.     return q
  37.  
  38. def save_user(email, username, password, discriminator, email_password, api_key, conf):
  39.     debug("saving user", conf)
  40.     output = open(conf['output_file'], 'a')
  41.     output.write(":".join(
  42.         [discriminator, password, email, email_password]
  43.         )+"\n")
  44.     output.flush()
  45.     output.close()
  46.     output = open(conf['output_token_file'], 'a')
  47.     output.write(api_key+"\n")
  48.     output.flush()
  49.     output.close()
  50.  
  51. def generate_user_pass_pair():
  52.     starts = ['touches_','loves_','hates_','licks_','feels_', 'moves_', 'dances_' , 'swipes_', 'kills_', 'trickles_', 'pierces_', 'bananas_', 'quicks_']
  53.     verbs = ['awkward','thin','thick','happy','sad','tall','short','malious','ravenous','smooth','loving','mean','weird','high','sober',"smart",'dumb','rich','poor','mega','music','lord', 'uber', 'magician', 'insane', 'genius', 'incredible']
  54.     nouns = ['hacker','lumberjack','horse','unicorn','guy','girl','man','woman','male','female','men','women','duck','dog','sheep','zombie','tennis','doctor', 'cattle', 'zombie', 'monster', 'destroyer', 'v', 'a','b','c','d']
  55.     random_touch = random.randint(1,1000)
  56.     alphabet = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  57.     pw_length = 12
  58.     mypw = ""
  59.     for i in range(pw_length):
  60.         next_index = random.randrange(len(alphabet))
  61.         mypw = mypw + alphabet[next_index]
  62.     return (random.choice(starts) + random.choice(verbs) + '_' + random.choice(nouns) + str(random_touch), mypw)
  63.  
  64. def set_proxy(session, proxy):
  65.     if proxy != 'none':
  66.         session.proxies.update({
  67.             'http:' : 'http://' + proxy,
  68.             'https:' : 'https://' + proxy
  69.         })
  70.     return session
  71.  
  72. def get_headers():
  73.     return {
  74.         'user-agent': 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16',
  75.         'Host': 'discordapp.com',
  76.         'Accept': '*/*',
  77.         'Accept-Language': 'en-US',
  78.         'Content-Type': 'application/json',
  79.         'Referer': 'https://discordapp.com/register',
  80.         'DNT': '1',
  81.         'Connection': 'keep-alive'
  82.     }
  83.  
  84.  
  85. def register(email, e_password, proxy, conf):
  86.     headers = get_headers()
  87.     s = requests.Session()
  88.     #ss = set_proxy(ss, proxy)
  89.     print (proxy)
  90.     if proxy != 'none':
  91.         proxies = {
  92.             'http' : 'http://' + proxy,
  93.             'https' : 'https://' + proxy
  94.         }
  95.         s.proxies.update(proxies)
  96.     fingerprint_json = s.get(
  97.         "https://discordapp.com/api/v6/experiments",
  98.         timeout=conf['timeout'],
  99.         headers=headers
  100.     ).text
  101.     fingerprint = json.loads(fingerprint_json)["fingerprint"]
  102.     debug(fingerprint, conf)
  103.  
  104.     headers['X-Fingerprint'] = fingerprint
  105.     (username, password) = generate_user_pass_pair()
  106.     payload = {
  107.         'fingerprint': fingerprint,
  108.         'email': email,
  109.         'username': username,
  110.         'password': password,
  111.         'invite': None,
  112.         'captcha_key': None
  113.     }
  114.     debug("first registration post "+email+":"+username+":"+password, conf)
  115.     response = s.post(
  116.         'https://discordapp.com/api/v6/auth/register',
  117.         json=payload,
  118.         headers=headers,
  119.         timeout=conf['timeout']
  120.     )
  121.     debug(response.json(), conf)
  122.  
  123.     if 'captcha-required' in response.text:
  124.         debug("captcha required -> account will be created (might lead to bug if captcha response isn't valid", conf)
  125.     if 'You are being rate limited.' in response.text:
  126.         debug("You are being rate limited.", conf)
  127.         return False
  128.     if 'Email is already registered.' in response.text:
  129.         debug("Already registered", conf)
  130.         return True
  131.  
  132.     debug("fetching captcha", conf)
  133.     captcha = recaptcha.GetCaptcha()
  134.     debug("result is: "+captcha, conf)
  135.     payload['captcha_key'] = captcha
  136.     debug("sending payload:"+str(payload), conf)
  137.     response = s.post(
  138.         'https://discordapp.com/api/v6/auth/register',
  139.         json=payload,
  140.         headers=headers,
  141.         timeout=conf['timeout']
  142.     )
  143.     debug(response.json(), conf)
  144.     if 'unauthorize' in response.text:
  145.         debug('unauthorized', conf)
  146.         return False
  147.     api_key = response.json()['token']
  148.     headers['Authorization'] = api_key
  149.     debug("login in and fetching token/api key", conf)
  150.     response = s.get(
  151.         'https://discordapp.com/api/v6/users/@me',
  152.         headers=headers,
  153.         timeout=conf['timeout']
  154.     )
  155.     debug(response.json(), conf)
  156.     discriminator = response.json()['discriminator']
  157.     save_user(email, username, password, discriminator, e_password, api_key, conf)
  158.     return True
  159.  
  160. def verify(email, password, proxy, conf):
  161.     debug("verifying : "+email+" "+password, conf)
  162.     headers = get_headers()
  163.     ss = requests.Session()
  164.  
  165.     ss = set_proxy(ss, proxy)
  166.     debug("opening email", conf)
  167.     response  = ss.post('https://auth.mail.ru/cgi-bin/auth', {
  168.         'post':None,
  169.         'mhost': 'mail.ru',
  170.         'login_from': None,
  171.         'Login': email,
  172.         'Domain': 'mail.ru',
  173.         'Password': password})
  174.     text = response.text.encode('utf-8').replace("\n","")
  175.     debug("trying to find link", conf)
  176.     open('MAILRU.html','w').write(text)
  177.     link = re.findall('id: "(\d+)",\s*prev:\s*"\d*",\s*next:\s*"\d*",\s*subject:\s*u\("Verify Email Address for Discord"\)',text)[0]
  178.     debug("found email link: "+link, conf)
  179.     response = ss.get('https://m.mail.ru/message/{0}'.format(link))
  180.     activation = re.findall('url=(https%3A%2F%2Fdiscordapp.com%2Fverify[^"]+)"', response.text.encode('utf-8'))[0]
  181.     activation = requests.utils.unquote(activation)
  182.     debug("found activation link: "+activation, conf)
  183.     token = re.findall("token=([^&]+)&", activation)[0]
  184.     debug("token is "+token, conf)
  185.     debug("opening activation link", conf)
  186.     ss.get(activation,
  187.         headers=headers,
  188.         timeout=conf['timeout'])
  189.     debug("fetching a captcha", conf)
  190.     captcha = recaptcha.GetCaptcha()
  191.     payload = {
  192.         'token' : token,
  193.         'captcha_key' : captcha
  194.     }
  195.     debug("sending payload:"+str(payload), conf)
  196.     response = ss.post(
  197.         'https://discordapp.com/api/v6/auth/verify',
  198.         json=payload,
  199.         headers=headers,
  200.         timeout=conf['timeout']
  201.     )
  202.     return True
  203.  
  204.  
  205. def worker(conf, black_proxies):
  206.     debug("worker started", conf)
  207.     already_registered = []
  208.     while not emails_q.empty():
  209.         proxies_used_file = 'usedproxies.txt'
  210.         try:
  211.             proxies_used = open(proxies_used_file).read()
  212.         except:
  213.             proxies_used = ''
  214.      
  215.         proxy = proxies_q.get()
  216.         proxies_q.put(proxy)
  217.         proxies_q.task_done()
  218.         if proxies_used.count(proxy) > 3:
  219.             continue
  220.         email_pwd = emails_q.get()
  221.         emails_q.task_done()
  222.         email = email_pwd.split(":")[0]
  223.         e_password = email_pwd.split(":")[1]
  224.         #while proxy in black_proxies:
  225.          #   proxy = proxies_q.get()
  226.          #   proxies_q.task_done()
  227.         debug("trying to create "+email+" with proxy "+proxy, conf)
  228.         try:
  229.             could_register = register(email, e_password, proxy, conf)
  230.             """
  231.            put the save here
  232.            save also email in output for the verify script
  233.            """
  234.             # if could not register we re-add the email
  235.             if not could_register:
  236.                 debug("couldn't register -> readding email", conf)
  237.                 emails_q.put(email_pwd)
  238.             open(proxies_used_file,'a').write(proxy+'\n')
  239.             #else:
  240.             #    try:
  241.             #        could_verify = verify(email, e_password, proxy, conf)
  242.             #    except Exception, e:
  243.             #        print e
  244.             #        debug("could not verify "+e.message, conf)
  245.         except:
  246.             black_proxies.append("ERROR2")
  247.  
  248.         #if it reaches this point then it means that the proxy was fine
  249.  
  250.  
  251. def main():
  252.     global emails_q
  253.     global proxies_q
  254.     print ("Starting")
  255.     conf = read_configurations()
  256.     emails2 = [x.rstrip() for x in open(conf['emails_file'], 'r').readlines()]
  257.     alreadydone = [x.rstrip().split(':')[0] for x in open(conf['output_file']).readlines()]
  258.     emails = []
  259.     for email in emails2:
  260.         m = email.split(':')[0]
  261.         if m not in alreadydone:
  262.             emails.append(email)
  263.     emails_q = array_to_queue(emails, emails_q)
  264.     proxies = [x.rstrip() for x in open(conf['proxy_file'], 'r').readlines()]
  265.     proxies_q = array_to_queue(proxies, proxies_q)
  266.     black_proxies = [x.rstrip() for x in open(conf['proxy_blacklist_file'], 'r').readlines()]
  267.     tx = []
  268.     debug("Starting "+str(conf['nb_threads'])+" threads", conf)
  269.     for i in range(conf['nb_threads']):
  270.         mT = threading.Thread(target=worker, args=(conf, black_proxies))
  271.         mT.start()
  272.         tx.append(mT)
  273.     for t in tx:
  274.         t.join()
  275.     print ("Finished")
  276.  
  277. if __name__ == "__main__":
  278.     while 1:
  279.         main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement