Advertisement
Guest User

Nainonail

a guest
Sep 7th, 2018
2,124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.15 KB | None | 0 0
  1. import requests, json, time, random
  2.  
  3. names = [
  4. 'Pepito Grillo',
  5. 'Pablo Guitarra',
  6. 'Pedro Sanchez',
  7. 'Gustavo Pollo',
  8. 'Analisa Melculo',
  9. 'Casimiro Ciego',
  10. 'Aitor Menta'
  11. ]
  12.  
  13.  
  14. def script_menu():
  15. print ('----------------')
  16. print ('Accounts Creator')
  17. print ('----------------')
  18.  
  19. #proxy_list = input ('Proxy list >> ')
  20. #username_list = input ('Username list >> ')
  21. #email_list = input ('Email list (Leave it in blank to use username + @gmail.com) >> ')
  22. #password = input ('Password for all accounts >> ')
  23. output_file = input ('Output file >> ')
  24. #accounts_count = input ('Accounts to create? (Leave it in blank to use all users) >> ')
  25. #threads = input ('Threads to use >> ')
  26.  
  27. #proxy_list = 'proxy.txt'
  28. proxy_list = 'proxy.txt'
  29. username_list = 'Resources/users.txt'
  30. password = 'cyb0rwashere'
  31.  
  32. # Setting up data
  33. if proxy_list == '':
  34. print ('IMPORTANT ADVICE! You are not using any list of proxies, this could produce a ban from your ip')
  35. proxy_mode = False
  36. input ('Press enter to continue')
  37. else:
  38. try:
  39. with open (proxy_list, 'r') as pl:
  40. proxies = pl.readlines()
  41.  
  42. proxy_mode = True
  43. except:
  44. print ('Error ocurred opening proxy list!')
  45.  
  46. with open (username_list, 'r') as ul:
  47. usernames = ul.readlines()
  48.  
  49. if not output_file == '':
  50. file = open (output_file, 'w')
  51.  
  52. for username in usernames:
  53. correct_accounts = []
  54.  
  55. user = username.strip()
  56. mail = user + '@gmail.com'
  57. name = random.choice(names)
  58.  
  59. if proxy_mode:
  60. proxy = random.choice (proxies)
  61. fixed_proxy = proxy.strip()
  62. else:
  63. proxy = ''
  64. fixed_proxy = ''
  65.  
  66. attemp = createAccount (mail, name, user, password, fixed_proxy)
  67. attemp_json = attemp.json()
  68. print (f'\n\nUser: {user}, Mail: {mail}, Name: {name}, Proxy: {fixed_proxy}\n')
  69. print (attemp_json)
  70.  
  71.  
  72. while 0 == 0:
  73. try:
  74. if attemp_json['message'] == 'Espera unos minutos antes de volver a intentarlo.':
  75. attemp = createAccount (mail, name, user, password, fixed_proxy)
  76. attemp_json = attemp.json()
  77. print ('Trying again in a few secconds...')
  78. time.sleep (5)
  79. print (attemp_json)
  80. else:
  81. break
  82. except:
  83. break
  84.  
  85. if attemp_json['account_created'] == True:
  86. print ('Account created!')
  87. correct_accounts.append (f'{user}:{password}')
  88. else:
  89. print ('Account wasn´t created')
  90. # Error manager
  91. error = attemp_json['error_type']
  92. if error == 'signup_block':
  93. try:
  94. proxies.remove (proxy)
  95. except:
  96. print ('Proxy deletion failed')
  97. print (f'Proxy {proxy} is blocked!')
  98.  
  99. if not output_file == '':
  100. for account in correct_accounts:
  101. file.write (account)
  102. file.close()
  103.  
  104.  
  105. def createAccount (mail, name, username, password, proxy):
  106. ses = requests.Session()
  107.  
  108. PROXY = {'http' : proxy}
  109.  
  110. USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0'
  111.  
  112. CSRFTOKEN = ses.get('https://www.instagram.com/').cookies['csrftoken']
  113.  
  114. if not proxy == '':
  115. ses.proxies.update (PROXY)
  116. else:
  117. print ('Proxy not enabled!')
  118.  
  119. ses.headers.update ({
  120. 'Origin' : 'https://www.instagram.com',
  121. 'Pragma' : 'no-cache',
  122. 'Accept' : '*/*',
  123. 'Accept-Language' : 'es-ES,es',
  124. 'Connection' : 'keep-alive',
  125. 'Content-Type' : 'application/x-www-form-urlencoded',
  126. 'DNT' : '1',
  127. 'Host' : 'www.instagram.com',
  128. 'Referer' : 'https://www.instagram.com/',
  129. 'User-Agent' : USER_AGENT,
  130. 'X-CSRFToken' : CSRFTOKEN,
  131. 'X-Instagram-AJAX' : '1',
  132. 'X-Requested-With' : 'XMLHttpRequest'
  133. })
  134.  
  135. register_req = ses.post ('https://www.instagram.com/accounts/web_create_ajax/', data={
  136. 'email' : mail,
  137. 'first_name' : name,
  138. 'opt_into_one_tap' : 'false',
  139. 'password' : password,
  140. 'seamless_login_enabled' : '0',
  141. 'tos_version' : 'row',
  142. 'username' : username
  143. })
  144. print (f'Request made using proxy {PROXY}')
  145. return register_req
  146. time.sleep (5)
  147.  
  148. #NAME = 'Pepito Sanchez'
  149. #USERNAME = input ('Username >> ')
  150. #PASSWORD = input ('Password >> ')
  151. #PROXY = input ('Proxy >> ')
  152. #MAIL = f'{USERNAME}@gmail.com'
  153.  
  154. #createAccount (MAIL, NAME, USERNAME, PASSWORD, PROXY)
  155. #input ('\nFinish!')
  156.  
  157. if __name__ == '__main__':
  158. script_menu()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement