Advertisement
i3llawix_

user tiktok Aribic

Aug 19th, 2024 (edited)
700
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 9.52 KB | Software | 0 0
  1. import os
  2.  
  3. try:
  4.     import requests
  5. except:
  6.     os.system('pip install requests')
  7. try:
  8.     import hashlib
  9. except:
  10.     os.system('pip install hashlib')
  11. try:
  12.     import json
  13. except:
  14.     os.system('pip install json')
  15. try:
  16.     import random
  17. except:
  18.     os.system('pip install random')
  19.  
  20. import hashlib
  21. import json
  22. from time import time
  23. from hashlib import md5
  24. from copy import deepcopy
  25. from random import choice
  26. import requests
  27. import random
  28. from urllib.parse import quote
  29.  
  30.  
  31. def hex_string(num):
  32.     tmp_string = hex(num)[2:]
  33.     if len(tmp_string) < 2:
  34.         tmp_string = '0' + tmp_string
  35.     return tmp_string
  36.  
  37.  
  38. def RBIT(num):
  39.     result = ''
  40.     tmp_string = bin(num)[2:]
  41.     while len(tmp_string) < 8:
  42.         tmp_string = '0' + tmp_string
  43.     for i in range(0, 8):
  44.         result = result + tmp_string[7 - i]
  45.     return int(result, 2)
  46.  
  47.  
  48. def file_data(path):
  49.     with open(path, 'rb') as f:
  50.         result = f.read()
  51.     return result
  52.  
  53.  
  54. def reverse(num):
  55.     tmp_string = hex(num)[2:]
  56.     if len(tmp_string) < 2:
  57.         tmp_string = '0' + tmp_string
  58.     return int(tmp_string[1:] + tmp_string[:1], 16)
  59.  
  60.  
  61. class XG:
  62.     def __init__(self, debug):
  63.         self.length = 0x14
  64.         self.debug = debug
  65.         self.hex_CE0 = [0x05, 0x00, 0x50, choice(range(0, 0xFF)), 0x47, 0x1e, 0x00, choice(range(0, 0xFF)) & 0xf0]
  66.  
  67.     def addr_BA8(self):
  68.         tmp = ''
  69.         hex_BA8 = []
  70.         for i in range(0x0, 0x100):
  71.             hex_BA8.append(i)
  72.         for i in range(0, 0x100):
  73.             if i == 0:
  74.                 A = 0
  75.             elif tmp:
  76.                 A = tmp
  77.             else:
  78.                 A = hex_BA8[i - 1]
  79.             B = self.hex_CE0[i % 0x8]
  80.             if A == 0x05:
  81.                 if i != 1:
  82.                     if tmp != 0x05:
  83.                         A = 0
  84.             C = A + i + B
  85.             while C >= 0x100:
  86.                 C = C - 0x100
  87.             if C < i:
  88.                 tmp = C
  89.             else:
  90.                 tmp = ''
  91.             D = hex_BA8[C]
  92.             hex_BA8[i] = D
  93.         return hex_BA8
  94.  
  95.     def initial(self, debug, hex_BA8):
  96.         tmp_add = []
  97.         tmp_hex = deepcopy(hex_BA8)
  98.         for i in range(self.length):
  99.             A = debug[i]
  100.             if not tmp_add:
  101.                 B = 0
  102.             else:
  103.                 B = tmp_add[-1]
  104.             C = hex_BA8[i + 1] + B
  105.             while C >= 0x100:
  106.                 C = C - 0x100
  107.             tmp_add.append(C)
  108.             D = tmp_hex[C]
  109.             tmp_hex[i + 1] = D
  110.             E = D + D
  111.             while E >= 0x100:
  112.                 E = E - 0x100
  113.             F = tmp_hex[E]
  114.             G = A ^ F
  115.             debug[i] = G
  116.         return debug
  117.  
  118.     def calculate(self, debug):
  119.         for i in range(self.length):
  120.             A = debug[i]
  121.             B = reverse(A)
  122.             C = debug[(i + 1) % self.length]
  123.             D = B ^ C
  124.             E = RBIT(D)
  125.             F = E ^ self.length
  126.             G = ~F
  127.             while G < 0:
  128.                 G += 0x100000000
  129.             H = int(hex(G)[-2:], 16)
  130.             debug[i] = H
  131.         return debug
  132.  
  133.     def main(self):
  134.         result = ''
  135.         for item in self.calculate(self.initial(self.debug, self.addr_BA8())):
  136.             result = result + hex_string(item)
  137.  
  138.         return '8404{}{}{}{}{}'.format(hex_string(self.hex_CE0[7]), hex_string(self.hex_CE0[3]),
  139.                                        hex_string(self.hex_CE0[1]), hex_string(self.hex_CE0[6]), result)
  140.  
  141.  
  142. def X_Gorgon(param, data, cookie):
  143.     gorgon = []
  144.     ttime = time()
  145.     Khronos = hex(int(ttime))[2:]
  146.     url_md5 = md5(bytearray(param, 'utf-8')).hexdigest()
  147.     for i in range(0, 4):
  148.         gorgon.append(int(url_md5[2 * i: 2 * i + 2], 16))
  149.     if data:
  150.         if isinstance(data, str):
  151.             data = data.encode(encoding='utf-8')
  152.         data_md5 = md5(data).hexdigest()
  153.         for i in range(0, 4):
  154.             gorgon.append(int(data_md5[2 * i: 2 * i + 2], 16))
  155.     else:
  156.         for i in range(0, 4):
  157.             gorgon.append(0x0)
  158.     if cookie:
  159.         cookie_md5 = md5(bytearray(cookie, 'utf-8')).hexdigest()
  160.         for i in range(0, 4):
  161.             gorgon.append(int(cookie_md5[2 * i: 2 * i + 2], 16))
  162.     else:
  163.         for i in range(0, 4):
  164.             gorgon.append(0x0)
  165.     gorgon = gorgon + [0x1, 0x1, 0x2, 0x4]
  166.     for i in range(0, 4):
  167.         gorgon.append(int(Khronos[2 * i: 2 * i + 2], 16))
  168.     return {'X-Gorgon': XG(gorgon).main(), 'X-Khronos': str(int(ttime))}
  169.  
  170.  
  171. def run(param="", stub="", cookie=""):
  172.     gorgon = []
  173.     ttime = time()
  174.     Khronos = hex(int(ttime))[2:]
  175.     url_md5 = md5(bytearray(param, 'utf-8')).hexdigest()
  176.     for i in range(0, 4):
  177.         gorgon.append(int(url_md5[2 * i: 2 * i + 2], 16))
  178.     if stub:
  179.         data_md5 = stub
  180.         for i in range(0, 4):
  181.             gorgon.append(int(data_md5[2 * i: 2 * i + 2], 16))
  182.     else:
  183.         for i in range(0, 4):
  184.             gorgon.append(0x0)
  185.     if cookie:
  186.         cookie_md5 = md5(bytearray(cookie, 'utf-8')).hexdigest()
  187.         for i in range(0, 4):
  188.             gorgon.append(int(cookie_md5[2 * i: 2 * i + 2], 16))
  189.     else:
  190.         for i in range(0, 4):
  191.             gorgon.append(0x0)
  192.     gorgon = gorgon + [0x1, 0x1, 0x2, 0x4]
  193.     for i in range(0, 4):
  194.         gorgon.append(int(Khronos[2 * i: 2 * i + 2], 16))
  195.     return {'X-Gorgon': XG(gorgon).main(), 'X-Khronos': str(int(ttime))}
  196.  
  197.  
  198. def get_stub(data):
  199.     if isinstance(data, dict):
  200.         data = json.dumps(data)
  201.  
  202.     if isinstance(data, str):
  203.         data = data.encode(encoding='utf-8')
  204.     if data == None or data == "" or len(data) == 0:
  205.         return "00000000000000000000000000000000"
  206.  
  207.     m = hashlib.md5()
  208.     m.update(data)
  209.     res = m.hexdigest()
  210.     res = res.upper()
  211.     return res
  212.  
  213.  
  214. def get_profile(session_id, device_id, iid):
  215.     """Retrieve the current TikTok username for a given session, device, and iid."""
  216.     try:
  217.  
  218.         url = f"https://api.tiktokv.com/passport/account/info/v2/?id=kaa&version_code=34.0.0&language=en&app_name=lite&app_version=34.0.0&carrier_region=SA&device_id=7256623439258404357&tz_offset=10800&mcc_mnc=42001&locale=en&sys_region=SA&aid=473824&screen_width=1284&os_api=18&ac=WIFI&os_version=17.3&app_language=en&tz_name=Asia/Riyadh&carrier_region1=SA&build_number=340002&device_platform=iphone&iid=7353686754157692689&device_type=iPhone13,4"
  219.         headers = {
  220.             "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
  221.             "Cookie": f"sessionid={session_id}",
  222.             "sdk-version": "2",
  223.             "user-agent": "com.zhiliaoapp.musically/432424234 (Linux; U; Android 5; en; fewfwdw; Build/PI;tt-ok/3.12.13.1)",
  224.  
  225.         }
  226.  
  227.         response = requests.get(url, headers=headers, cookies={"sessionid": session_id})
  228.         return response.json()["data"]["username"]
  229.     except Exception as e:
  230.         return "None"
  231.  
  232.  
  233. def check_is_changed(last_username, session_id, device_id, iid):
  234.     """Check if the username has been changed in the TikTok profile."""
  235.     return get_profile(session_id, device_id, iid) != last_username
  236.  
  237.  
  238. def change_username(session_id, device_id, iid, last_username, new_username):
  239.     """Attempt to change a TikTok username."""
  240.     data = f"aid=364225&unique_id={quote(new_username)}"
  241.     parm = f"aid=364225&residence=&device_id={device_id}&version_name=1.1.0&os_version=17.4.1&iid={iid}&app_name=tiktok_snail&locale=en&ac=4G&sys_region=SA&version_code=1.1.0&channel=App%20Store&op_region=SA&os_api=18&device_brand=iPad&idfv=16045E07-1ED5-4350-9318-77A1469C0B89&device_platform=iPad&device_type=iPad13,4&carrier_region1=&tz_name=Asia/Riyadh&account_region=sa&build_number=11005&tz_offset=10800&app_language=en&carrier_region=&current_region=&aid=364225&mcc_mnc=&screen_width=1284&uoo=1&content_language=&language=en&cdid=B75649A607DA449D8FF2ADE97E0BC3F1&openudid=7b053588b18d61b89c891592139b68d918b44933&app_version=1.1.0"
  242.  
  243.     sig = run(parm, md5(data.encode("utf-8")).hexdigest() if data else None, None)
  244.     url = f"https://api.tiktokv.com/aweme/v1/commit/user/?{parm}"
  245.     headers = {
  246.         "Connection": "keep-alive",
  247.         "User-Agent": "Whee 1.1.0 rv:11005 (iPad; iOS 17.4.1; en_SA@calendar=gregorian) Cronet",
  248.  
  249.         "Cookie": f"sessionid={session_id}",
  250.     }
  251.     headers.update(sig)
  252.     response = requests.post(url, data=data, headers=headers)
  253.     result = response.text
  254.     if "unique_id" in result:
  255.         if (check_is_changed(last_username, session_id, device_id, iid)):
  256.             return "تم تغيير اسم المستخدم بنجاح."
  257.         else:
  258.             return "فشل في تغيير اسم المستخدم: " + str(result)
  259.     else:
  260.         return "فشل في تغيير اسم المستخدم:  " + str(result)
  261.  
  262.  
  263. def main():
  264.     """Main function to handle user interaction and username change."""
  265.     device_id = str(random.randint(777777788, 999999999999))
  266.     iid = str(random.randint(777777788, 999999999999))
  267.  
  268.     session_id = input("أدخل معرف الجلسة: ")
  269.  
  270.     last_username = get_profile(session_id, device_id, iid)
  271.     if last_username != "None":  # tiktokthailand
  272.         print(f"اسم مستخدم TikTok الحالي الخاص بك هو: {last_username}")
  273.         new_username = input("أدخل اسم المستخدم العربي الذي ترغب به:  ")
  274.         print(change_username(session_id, device_id, iid, last_username, new_username))
  275.  
  276.     else:
  277.         print("معرف الجلسة غير صالح أو خطأ آخر.")
  278.     print("telegram: @iNmbory")
  279.  
  280.  
  281. if __name__ == "__main__":
  282.     main()
  283.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement