Advertisement
Guest User

Un_Treatable's Python Bot Script #2

a guest
Mar 20th, 2018
1,472
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.44 KB | None | 0 0
  1. from multiprocessing.pool import ThreadPool
  2. import requests
  3. import random
  4. import string
  5. import time
  6. import configparser
  7. import sys
  8. sys.setrecursionlimit(100000);
  9. requests.packages.urllib3.disable_warnings();
  10. def sign_up(proxy):
  11. print('Trying to create account with proxy:', proxy)
  12. # creates a request session
  13. session = requests.session()
  14. # creates headers
  15. headers = {'User-Agent': 'Roblox/WinInet'}
  16. # sets sessions headers
  17. session.headers.update(headers)
  18. session.proxies.update({'http': 'http://' + proxy, 'https': 'https://' + proxy})
  19. # gets cookies used for signup
  20. try:
  21. r = session.get('https://www.roblox.com/', timeout=10)
  22. except:
  23. return
  24. # extracts data site key
  25. sitekey = r.text.split('data-sitekey="')[-1].split('">')[0]
  26. # send request to api to complete captcha
  27. response = complete_captcha(sitekey)
  28. # extracts csrf token
  29. csrf_token = r.text.split("Roblox.XsrfToken.setToken('")[-1].split("');")[0]
  30. # creates headers for post request
  31. headers = {'X-CSRF-TOKEN': csrf_token, 'Referer': 'https://www.roblox.com/', 'Origin': 'https://www.roblox.com'}
  32. # generates random username
  33. username = generate()
  34. # generates random password
  35. password = generate()
  36. # creates payload for post request
  37. payload = {'isEligibleForHideAdsAbTest': 'False', 'username': username, 'password': password, 'birthday': '1 Jan 1990', 'gender': '2', 'isTosAgreementBoxChecked': 'true', 'context': 'RollerCoasterSignupForm'}
  38. # posts data to server in order to achieve account creation
  39. session.post('https://api.roblox.com/signup/v1', headers=headers, data=payload)
  40. # sends captcha response
  41. session.post('https://api.roblox.com/captcha/validate/signup', headers=headers, data={'g-Recaptcha-response': response})
  42. # posts data to server in order to achieve account creation
  43. r = session.post('https://api.roblox.com/signup/v1', headers=headers, data=payload)
  44. # validates sign up
  45. if 'userId' in r.text:
  46. # notifies user account has been created
  47. print('Created account:', username)
  48. # method that uses the gurillamail api to verify email
  49. # creates a get email address payload
  50. payload = {"f": "get_email_address"}
  51. # sends payload and returns email
  52. r = session.get("http://api.guerrillamail.com/ajax.php", params=payload)
  53. # extracts email
  54. email = r.json()["email_addr"].split('@')[0] + '@spam4.me'
  55. # notifies user
  56. print('Got Email Address:', email)
  57. # goes to settings page to grab csrf-token
  58. r = session.get('https://www.roblox.com/my/account#!/info')
  59. # extracts csrf-token
  60. csrf_token = r.text.split("Roblox.XsrfToken.setToken('")[-1].split("');")[0]
  61. # creates change email headers
  62. verification = {'X-CSRF-TOKEN': csrf_token}
  63. # creates change email payload
  64. payload = {'emailAddress': email, 'password': password}
  65. # sends payload to change email
  66. r = session.post('https://www.roblox.com/account/changeemail', data=payload, headers=verification)
  67. # validates change
  68. if not r.json()['Success']:
  69. # notifies user
  70. print('Could not change email.')
  71. print('Reason:', r.json()['Message'])
  72. # returns to main thread
  73. return
  74. print('Successfully changed email.')
  75. # waits for email to arrive via the api
  76. print('Checking email...')
  77. # creates view emails payload
  78. payload = {"f": "check_email", "seq": "1"}
  79. # loops until email is found
  80. while True:
  81. # waits for 10 seconds
  82. time.sleep(10)
  83. # sends request to api
  84. r = session.get("http://api.guerrillamail.com/ajax.php", params=payload)
  85. try:
  86. # iterates through email list
  87. for email in r.json()["list"]:
  88. # check if the email was sent by roblox
  89. if email["mail_from"] == "email_validate@roblox.com":
  90. # extracts email id
  91. email_id = email["mail_id"]
  92. # notifies user
  93. print('Found email ID:', email_id)
  94. # creates a view email payload
  95. payload = {"f": "fetch_email", "email_id": email_id}
  96. # sneds payload to gurillamail
  97. r = session.get("http://api.guerrillamail.com/ajax.php", params=payload)
  98. # grabs verification link
  99. verify_link = r.json()['mail_body'].split('<a href="')[-1].split('">')[0].replace('&amp;', '&')
  100. # prints verify link
  101. print('Got verify link:', verify_link)
  102. # verifies email address
  103. r = session.get(verify_link)
  104. # notifies user
  105. print('Successfully verified email address.')
  106. # writes username and password to file
  107. with open(output_file, 'a') as f:
  108. # seperates username and password with colon
  109. f.write('{}:{}\n'.format(username, password))
  110. # returns to main thread
  111. return
  112. except KeyError:
  113. continue
  114. elif 'reasons' in r.text:
  115. # notifies user of problem
  116. print('There was an error signing up on account:', username)
  117. print('Reason:', r.json()['reasons'][0])
  118. else:
  119. # prints response for debugging
  120. print('Error:', r.text)
  121.  
  122.  
  123. def complete_captcha(sitekey):
  124. # completes captcha and returns response
  125. # sends requests to api to complete capacha
  126. capacha_payload = {'key': api_key, 'method': 'userrecaptcha', 'googlekey': sitekey, 'pageurl': 'https://www.roblox.com/', 'json': '1'}
  127. request = requests.get('http://2captcha.com/in.php', params=capacha_payload)
  128. # gets capacha response key
  129. get_payload = {'key': api_key, 'action': 'get', 'id': request.json()['request'], 'json': '1'}
  130. # loops until a captcha response is grabbed
  131. while True:
  132. # attempts to grab captcha response
  133. capacha_response = requests.get('http://2captcha.com/res.php', params=get_payload, timeout=20)
  134. # checks if the captcha is ready
  135. if capacha_response.json()['request'] != 'CAPCHA_NOT_READY':
  136. # returns captcha response
  137. return capacha_response.json()['request']
  138.  
  139. def generate():
  140. # generates a random string
  141. return ''.join(random.choice(string.ascii_letters + string.digits) for x in range(random.randint(10,20)))
  142.  
  143. if __name__ == '__main__':
  144. # reads config file
  145. config = configparser.ConfigParser()
  146. config.read('config.ini')
  147. try:
  148. # sets api key
  149. api_key = config['account creator']['api_key']
  150. # sets proxy list path
  151. proxy_path = config['account creator']['proxy_list_path']
  152. # gets output file
  153. output_file = config['account creator']['output_file']
  154. # gets thread count
  155. thread_count = int(config['general']['thread_count'])
  156. except KeyError:
  157. sys.exit('Config file error')
  158. # gets proxy list
  159. proxies = open(proxy_path).read().split('\n')
  160. # multi-threaded processes
  161. p = ThreadPool(processes=thread_count)
  162. p.map(sign_up, proxies)
  163. p.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement