Advertisement
Br1in

Untitled

Feb 16th, 2021
1,552
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.18 KB | None | 0 0
  1. import requests , threading
  2. from uuid import uuid4
  3. import json
  4. req = requests.session()
  5. uid = uuid4()
  6. username = ''
  7. password = ''
  8. target = ''
  9. print("""
  10. ____ ______ __
  11. | _ \ ____|____ /_ |
  12. | |_) |_ _ / __ \ / / | | ___ ___
  13. | _ <| | | | / / _` | / / | |/ _ \ / __|
  14. | |_) | |_| | | | (_| |/ / | | (_) | (__
  15. |____/ \__, | \ \__,_/_/ |_|\___/ \___|
  16. __/ | \____/
  17. |___/ Swap < @71oc!!
  18. """)
  19. username = input("[+] Username : ")
  20. password = input("[+] Password : ")
  21. target = input("[+] Target : ")
  22. thread = int(input("[+] Thread : "))
  23. logurl = 'https://i.instagram.com/api/v1/accounts/login/'
  24.  
  25. headers = {
  26. 'User-Agent': 'Instagram 113.0.0.39.122 Android (24/5.0; 515dpi; 1440x2416; huawei/google; Nexus 6P; angler; angler; en_US)',
  27. "Accept": "*/*",
  28. "Accept-Encoding": "gzip, deflate",
  29. "Accept-Language": "en-US",
  30. "X-IG-Capabilities": "3brTvw==",
  31. "X-IG-Connection-Type": "WIFI",
  32. "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
  33. 'Host': 'i.instagram.com',
  34. 'Connection': 'keep-alive'
  35. }
  36. nameurl = 'https://i.instagram.com/api/v1/accounts/set_username/'
  37. namedata = {
  38.  
  39. "username": target
  40. }
  41. Att = 0
  42. def edit():
  43. global coo , Att
  44. while True:
  45. r2 = req.post(nameurl, headers=headers, data=namedata, cookies=coo).status_code
  46. if r2 == 200:
  47. print(f"\r[+] Swapped > @{target}")
  48. exit()
  49. elif r2 == 400:
  50. Att += 1
  51. print(f"\r[+] Request > @{target} => {Att}")
  52. elif r2 == 429:
  53. print(f"\r[+] Blocked > @{username}")
  54. exit()
  55. logdata = {
  56. 'uuid': uid,
  57. 'password': password,
  58. 'username': username,
  59. 'device_id': uid,
  60. 'from_reg': 'false',
  61. '_csrftoken': 'missing',
  62. 'login_attempt_countn': '0'
  63. }
  64. def get_challenge_choices(last_json):
  65. choices = []
  66.  
  67. if last_json.get("step_name", "") == "select_verify_method":
  68. choices.append("[+] Challenge received")
  69. if "phone_number" in last_json["step_data"]:
  70. choices.append("[+] 0 - Phone")
  71. if "email" in last_json["step_data"]:
  72. choices.append("[+] 1 - Email")
  73.  
  74. if last_json.get("step_name", "") == "delta_login_review":
  75. choices.append("[+] Login attempt challenge received")
  76. choices.append("[+] 0 - It was me")
  77. choices.append("[+] 0 - It wasn't me")
  78.  
  79. if not choices:
  80. choices.append(
  81. '"{}" challenge received'.format(last_json.get("step_name", "Unknown"))
  82. )
  83. choices.append("[+] 0 - Default")
  84.  
  85. return choices
  86.  
  87.  
  88. def challange(login_json):
  89. global coo
  90. challenge_url = 'https://i.instagram.com/api/v1/' + login_json["challenge"]["api_path"][1:]
  91. try:
  92. b = requests.get(challenge_url, headers=headers, cookies=coo)
  93. except Exception as e:
  94. print("solve_challenge; {}".format(e))
  95. return False
  96. choiccc = get_challenge_choices(b.json())
  97. for choice in choiccc:
  98. print(choice)
  99. code = input("[+] Enter Email Or Phone : ")
  100. data_c = {
  101. 'choice': code,
  102. '_uuid': uid,
  103. '_uid': uid,
  104. '_csrftoken': 'missing'
  105. }
  106. send_c = requests.post(challenge_url, data=data_c, headers=headers, cookies=coo)
  107. print("[+] Done sent Code To {}".format(send_c.json()['step_data']['contact_point']))
  108. code = input("[+] Enter Code : ").strip()
  109. data_co = {
  110. 'security_code': code,
  111. '_uuid': uid,
  112. '_uid': uid,
  113. '_csrftoken': 'missing'
  114. }
  115. send_o = requests.post(challenge_url, data=data_co, headers=headers, cookies=coo)
  116. send_coj = send_o.json()
  117. if ('logged_in_user') in send_coj:
  118. coo = send_o.cookies
  119. input("[+] Are Your Ready?")
  120. threads = []
  121. for i in range(thread):
  122. th = threading.Thread(target=edit)
  123. th.start()
  124. threads.append(th)
  125. for thread2 in threads:
  126. thread2.join()
  127. return True
  128. else:
  129. login()
  130. return False
  131.  
  132. def login():
  133. global log, loginJS
  134. global coo
  135. log = req.post(logurl, headers=headers, data=logdata)
  136. loginJS = log.json()
  137. if 'logged_in_user' in log.text:
  138. coo = log.cookies
  139. input("[+] Are Your Ready?")
  140. threads = []
  141. for i in range(thread):
  142. th = threading.Thread(target=edit)
  143. th.start()
  144. threads.append(th)
  145. for thread2 in threads:
  146. thread2.join()
  147. pass
  148. elif "The username you entered doesn't appear to belong to an account" in log.text:
  149. print("\n Please Check Your Username And Try Again !")
  150. exit()
  151. elif "The password you entered is incorrect. Please try again." in log.text:
  152. print('The password you entered is incorrect , Please try again.')
  153. exit()
  154. elif "challenge_required" in log.text:
  155. coo = log.cookies
  156. return challange(log.json())
  157. elif '"two_factor_required":true' in log.text:
  158. print("Two Factor Required !")
  159. exit()
  160. else:
  161. print("Some Error Happend , Try again !")
  162. exit()
  163. login()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement