Guest User

Untitled

a guest
Aug 2nd, 2016
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 5.95 KB | None | 0 0
  1. # creates PTC accounts
  2. # by anonymous_scripter
  3.  
  4. import random
  5. import time
  6. import os
  7. import sys
  8. import hashlib
  9. import urllib2
  10. import urllib
  11. # these are all external modules you'll need to download
  12. # note: faker is installed via pip as "fake-factory" at the moment
  13. import requests
  14. from faker import Factory
  15. from tempmail import TempMail
  16. from simplejson import scanner
  17. from bs4 import BeautifulSoup
  18.  
  19. fake = Factory.create('en_GB')
  20. countries = [x.replace('\n', '').split('|') for x in open('./countries.txt').readlines()]
  21.  
  22. if len(sys.argv) > 1:
  23.     times = int(sys.argv[1])
  24. else:
  25.     times = 100
  26. for attempt in range(times):
  27.     # get names, DOB
  28.     fname, lname = fake.first_name(), fake.last_name()
  29.     dob = fake.date_time_between('-40y', '-20y')
  30.     dob = [x.zfill(2) for x in map(str, [dob.year, dob.month, dob.day])]
  31.     rand_country = random.choice(countries)
  32.     ua = fake.user_agent()
  33.  
  34.     # first part of email, also used for username currently
  35.     emailprefix = fname + str(random.randint(0, 999)).zfill(3)  
  36.    
  37.     tm = TempMail(login=emailprefix)
  38.     # full email
  39.     try:
  40.         email = tm.get_email_address()
  41.     except scanner.JSONDecodeError:
  42.         # this generally doesn't fall through unless you try and get the email before
  43.         # the TempMail call finishes...
  44.         time.sleep(0.5)
  45.         email = tm.get_email_address()
  46.  
  47.     password = fname + str(random.randint(0, 999)).zfill(5)
  48.     email = emailprefix.lower() + "@divismail.ru"
  49.     md5email = hashlib.md5()
  50.     md5email.update(email)
  51.     #print m.hexdigest()   
  52.     #md5email = md5 (emaildivis)
  53.     emailurl = "http://api.temp-mail.ru/request/mail/id/" + md5email.hexdigest()
  54.     print "%s : %s - %s %s - %s - %s" % (email, password, fname, lname, '-'.join(dob), rand_country[0])
  55.  
  56.     highload = True
  57.  
  58.     sess = requests.Session()
  59.  
  60.     print 'First request...'
  61.     r = sess.get('https://club.pokemon.com/us/pokemon-trainer-club/sign-up/')
  62.     while highload or 'csrftoken' not in dict(r.cookies):
  63.         if 'try again in an hour' in r.text or 'csrftoken' not in dict(r.cookies):
  64.             print 'High load.'
  65.             time.sleep(2)
  66.             r = sess.get('https://club.pokemon.com/us/pokemon-trainer-club/sign-up/')
  67.         else:
  68.             highload = False
  69.  
  70.     time.sleep(2)
  71.  
  72.     print 'Second request...'
  73.     # second request
  74.     csrf = dict(r.cookies)['csrftoken']
  75.     year = dob[0]
  76.     month = dob[1]
  77.     day = dob[2]
  78.     country = rand_country[1]
  79.     s = sess.post("https://club.pokemon.com/us/pokemon-trainer-club/sign-up/",
  80.         data='csrfmiddlewaretoken={0}&dob={1}-{2}-{3}&undefined={5}&undefined={1}&country={4}&country={4}'.format(csrf, year, month, day, country, str(int(month) - 1)),
  81.         headers={
  82.             "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
  83.             "Accept-Encoding": "gzip, deflate, br",
  84.             "Accept-Language": "en-GB,en-US;q=0.8,en;q=0.6",
  85.             "Cache-Control": "max-age=0",
  86.             "Connection": "keep-alive",
  87.             "Content-Type": "application/x-www-form-urlencoded",
  88.             "Origin": "https://club.pokemon.com",
  89.             "Referer": "https://club.pokemon.com/us/pokemon-trainer-club/sign-up/",
  90.             "Upgrade-Insecure-Requests": "1",
  91.             "User-Agent": "%s" % ua,
  92.         },
  93.     )
  94.  
  95.     if 'I accept the Pokemon.com Terms of Use.' in s.text:
  96.         print 'Second worked!'
  97.     else:
  98.         print 'Second did not work.'
  99.         #break
  100.  
  101.     time.sleep(2)
  102.  
  103.     print 'Third request...'
  104.     t = sess.post("https://club.pokemon.com/us/pokemon-trainer-club/parents/sign-up",
  105.         data='csrfmiddlewaretoken={0}&username={1}&password={2}&confirm_password={2}&email={3}&confirm_email={3}&public_profile_opt_in=True&screen_name={1}&terms=on'.format(csrf, emailprefix, password, email),
  106.         headers={
  107.             "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
  108.             "Accept-Encoding": "gzip, deflate, br",
  109.             "Accept-Language": "en-GB,en-US;q=0.8,en;q=0.6",
  110.             "Cache-Control": "max-age=0",
  111.             "Connection": "keep-alive",
  112.             "Content-Type": "application/x-www-form-urlencoded",
  113.             "Origin": "https://club.pokemon.com",
  114.             "Referer": "https://club.pokemon.com/us/pokemon-trainer-club/parents/sign-up",
  115.             "Upgrade-Insecure-Requests": "1",
  116.             "User-Agent": "%s" % ua,
  117.         },
  118.     )
  119.  
  120.     time.sleep(2)
  121.  
  122.     print 'Last request...'
  123.  
  124.     u = sess.get("https://club.pokemon.com/us/pokemon-trainer-club/parents/email",
  125.         headers={
  126.             "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
  127.             "Accept-Encoding": "gzip, deflate, sdch, br",
  128.             "Accept-Language": "en-GB,en-US;q=0.8,en;q=0.6",
  129.             "Cache-Control": "max-age=0",
  130.             "Connection": "keep-alive",
  131.             "Referer": "https://club.pokemon.com/us/pokemon-trainer-club/parents/sign-up",
  132.             "Upgrade-Insecure-Requests": "1",
  133.             "User-Agent": "%s" % ua,
  134.         },
  135.     )
  136.  
  137.     print 'Getting mail...'
  138.  
  139.     time.sleep(1)
  140.     print emailurl
  141.     response = urllib2.urlopen(emailurl)
  142.     html = response.read()
  143.     bs = BeautifulSoup(html)
  144.     activation_url = bs.find_all('a')[1]['href']
  145.     print 'Activating account...'
  146.     response = urllib2.urlopen(activation_url)
  147.     html = response.read()
  148.     if 'Thank you for signing up!' in html:
  149.         print "Activation worked!"
  150.         if os.path.exists("accounts.txt"):
  151.             f = open('./accounts.txt', 'a+b')
  152.         else:
  153.             f = open('./accounts.txt', 'w+b')
  154.  
  155.         f.write("%s:%s - %s - %s %s - %s - %s\n" % (emailprefix, password, email, fname, lname, '-'.join(dob), rand_country[0]))
  156.  
  157.         f.close()
  158.     else:
  159.         print "It didn't seem to work. If you like, here's the info so you can check yourself.\n%s : %s - %s %s - %s" % (email, password, fname, lname, '-'.join(dob))
Add Comment
Please, Sign In to add comment