Advertisement
Guest User

Untitled

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