Advertisement
xtekky_

Untitled

Jul 25th, 2022
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.91 KB | None | 0 0
  1. import re
  2. import requests, time, urllib.parse, hashlib, json, threading, sys #line:1
  3. _views = 0
  4.  
  5. class Xgorgon:
  6. def __init__(self, params: str, data: str, cookies: str) -> None:
  7.  
  8. self.params = params
  9. self.data = data
  10. self.cookies = cookies
  11.  
  12. def hash(self, data: str) -> str:
  13. _hash = str(
  14. hashlib.md5(
  15. data.encode()
  16. ).hexdigest()
  17. )
  18.  
  19. return _hash
  20.  
  21. def get_base_string(self) -> str:
  22. base_str = self.hash(self.params)
  23. base_str = (
  24. base_str + self.hash(self.data)
  25. if self.data
  26. else base_str + str(
  27. "0"
  28. *
  29. 32
  30. )
  31. )
  32. base_str = (
  33. base_str + self.hash(self.cookies)
  34. if self.cookies
  35. else base_str + str(
  36. "0"
  37. *
  38. 32
  39. )
  40. )
  41.  
  42. return base_str
  43.  
  44. def get_value(self) -> json:
  45. base_str = self.get_base_string()
  46.  
  47. return self.encrypt(base_str)
  48.  
  49. def encrypt(self, data: str) -> json:
  50. unix = int(time.time())
  51. len = 0x14
  52. key = [
  53. 0xDF,
  54. 0x77,
  55. 0xB9,
  56. 0x40,
  57. 0xB9,
  58. 0x9B,
  59. 0x84,
  60. 0x83,
  61. 0xD1,
  62. 0xB9,
  63. 0xCB,
  64. 0xD1,
  65. 0xF7,
  66. 0xC2,
  67. 0xB9,
  68. 0x85,
  69. 0xC3,
  70. 0xD0,
  71. 0xFB,
  72. 0xC3,
  73. ]
  74.  
  75. param_list = []
  76.  
  77. for i in range(0, 12, 4):
  78. temp = data[8 * i : 8 * (i + 1)]
  79. for j in range(4):
  80. H = int(temp[j * 2 : (j + 1) * 2], 16)
  81. param_list.append(H)
  82.  
  83. param_list.extend([0x0, 0x6, 0xB, 0x1C])
  84.  
  85. H = int(hex(unix), 16)
  86.  
  87. param_list.append(
  88. (
  89. H & 0xFF000000
  90. )
  91. >> 24
  92. )
  93. param_list.append(
  94. (
  95. H & 0x00FF0000
  96. )
  97. >> 16
  98. )
  99. param_list.append(
  100. (
  101. H & 0x0000FF00
  102. )
  103. >> 8
  104. )
  105. param_list.append(
  106. (
  107. H & 0x000000FF
  108. )
  109. >> 0
  110. )
  111.  
  112. eor_result_list = []
  113.  
  114. for A, B in zip(param_list, key):
  115. eor_result_list.append(A ^ B)
  116.  
  117. for i in range(len):
  118.  
  119. C = self.reverse(eor_result_list[i])
  120. D = eor_result_list[
  121. (
  122. i + 1
  123. )
  124. % len
  125. ]
  126. E = C ^ D
  127.  
  128. F = self.rbit_algorithm(E)
  129. H = (
  130. (
  131. F ^ 0xFFFFFFFF
  132. )
  133. ^ len
  134. ) & 0xFF
  135. eor_result_list[i] = H
  136.  
  137. result = ""
  138. for param in eor_result_list:
  139. result += self.hex_string(param)
  140.  
  141. return {
  142. "X-Gorgon": (
  143. "0404b0d30000"
  144. + result
  145. ),
  146. "X-Khronos": str(unix)
  147. }
  148.  
  149. def rbit_algorithm(self, num):
  150. result = ""
  151. tmp_string = bin(num)[2:]
  152.  
  153. while len(tmp_string) < 8:
  154. tmp_string = (
  155. "0"
  156. + tmp_string
  157. )
  158.  
  159. for i in range(0, 8):
  160. result = (
  161. result
  162. + tmp_string[
  163. 7 - i
  164. ]
  165. )
  166.  
  167. return int(result, 2)
  168.  
  169. def hex_string(self, num):
  170. tmp_string = hex(num)[2:]
  171.  
  172. if len(tmp_string) < 2:
  173. tmp_string = "0" + tmp_string
  174.  
  175. return tmp_string
  176.  
  177. def reverse(self, num):
  178. tmp_string = self.hex_string(num)
  179.  
  180. return int(tmp_string[1:] + tmp_string[:1], 16)
  181.  
  182. def send():
  183. global _views
  184. querystring = {
  185. "os_api": "25",
  186. "device_type": "G011A",
  187. "ssmix": "a",
  188. "manifest_version_code": "2021903030",
  189. "dpi": "320",
  190. "carrier_region": "IE",
  191. "uoo": "0",
  192. "region": "US",
  193. "carrier_region_v2": "310",
  194. "app_name": "musical_ly",
  195. "version_name": "19.3.3",
  196. "timezone_offset": "7200",
  197. "ts": int(time.time()),
  198. "ab_version": "19.3.3",
  199. "residence": "IE",
  200. "cpu_support64": "false",
  201. "current_region": "US",
  202. "ac2": "wifi",
  203. "ac": "wifi",
  204. "app_type": "normal",
  205. "host_abi": "armeabi-v7a",
  206. "channel": "googleplay",
  207. "update_version_code": "2021903030",
  208. "_rticket": int(round((time.time() * 1000)) + 0),
  209. "device_platform": "android",
  210. "iid": "7037880313762858758",
  211. "build_number": "19.3.3",
  212. "locale": "en",
  213. "op_region": "IE",
  214. "version_code": "190303",
  215. "timezone_name": "Africa/Harare",
  216. "cdid": "6ad560a8-8209-4fe3-b771-6bbe64880e4c",
  217. "openudid": "0e96eaebc0c2e44f",
  218. "sys_region": "US",
  219. "device_id": "6906478625937278469",
  220. "app_language": "en",
  221. "resolution": "1600*900",
  222. "device_brand": "samsung",
  223. "language": "en",
  224. "os_version": "7.1.2",
  225. "aid": "1233",
  226. "mcc_mnc": "31002"
  227. }
  228.  
  229. params = urllib.parse.urlencode(querystring)
  230. payload = f"item_id=7124332195728198918&sync_origin=false&first_install_time=1653681371&pre_item_playtime=303&follower_status=0&pre_hot_sentence=&pre_item_id=7124331934997597445&play_delta=1&action_time={int(time.time())}&aweme_type=0&follow_status=0"
  231.  
  232. headers = {
  233. "x-ss-stub": str(hashlib.md5(payload.encode()).hexdigest()).upper(),
  234. "accept-encoding": "gzip",
  235. "passport-sdk-version": "19",
  236. "sdk-version": "2",
  237. "x-ss-req-ticket": str(int(round((time.time() * 1000)) + 0)),
  238. "x-tt-dm-status": "login=1;ct=1",
  239. "x-tt-cmpl-token": "AgQQAPObF-RPsI8CtPIKJt0_xfZsL4wdv4BpYMZArg",
  240. "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
  241. "host": "api16-va.tiktokv.com",
  242. "connection": "Keep-Alive",
  243. "user-agent": "okhttp/3.12.1"
  244. }
  245.  
  246. url = "https://api16-va.tiktokv.com/aweme/v1/aweme/stats/?" + params
  247.  
  248. gorgon = Xgorgon(params=params, data=payload, cookies=None).get_value()
  249.  
  250. headers.update(gorgon)
  251. req = requests.post(url, data=payload, headers=headers).json()
  252.  
  253. if req["status_code"] == 0:
  254. _views += 1
  255. # threading.Lock().acquire()
  256. sys.stdout.write(f"\r [root@localhost ~]# Views sent: {_views}")
  257. sys.stdout.flush()
  258. # threading.Lock().release()
  259. else:
  260. print(req)
  261.  
  262.  
  263. for x in range(10):
  264. threading.Thread(target=send).start()
  265. time.sleep(0.1)
  266.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement