Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- import requests, time, urllib.parse, hashlib, json, threading, sys #line:1
- _views = 0
- class Xgorgon:
- def __init__(self, params: str, data: str, cookies: str) -> None:
- self.params = params
- self.data = data
- self.cookies = cookies
- def hash(self, data: str) -> str:
- _hash = str(
- hashlib.md5(
- data.encode()
- ).hexdigest()
- )
- return _hash
- def get_base_string(self) -> str:
- base_str = self.hash(self.params)
- base_str = (
- base_str + self.hash(self.data)
- if self.data
- else base_str + str(
- "0"
- *
- 32
- )
- )
- base_str = (
- base_str + self.hash(self.cookies)
- if self.cookies
- else base_str + str(
- "0"
- *
- 32
- )
- )
- return base_str
- def get_value(self) -> json:
- base_str = self.get_base_string()
- return self.encrypt(base_str)
- def encrypt(self, data: str) -> json:
- unix = int(time.time())
- len = 0x14
- key = [
- 0xDF,
- 0x77,
- 0xB9,
- 0x40,
- 0xB9,
- 0x9B,
- 0x84,
- 0x83,
- 0xD1,
- 0xB9,
- 0xCB,
- 0xD1,
- 0xF7,
- 0xC2,
- 0xB9,
- 0x85,
- 0xC3,
- 0xD0,
- 0xFB,
- 0xC3,
- ]
- param_list = []
- for i in range(0, 12, 4):
- temp = data[8 * i : 8 * (i + 1)]
- for j in range(4):
- H = int(temp[j * 2 : (j + 1) * 2], 16)
- param_list.append(H)
- param_list.extend([0x0, 0x6, 0xB, 0x1C])
- H = int(hex(unix), 16)
- param_list.append(
- (
- H & 0xFF000000
- )
- >> 24
- )
- param_list.append(
- (
- H & 0x00FF0000
- )
- >> 16
- )
- param_list.append(
- (
- H & 0x0000FF00
- )
- >> 8
- )
- param_list.append(
- (
- H & 0x000000FF
- )
- >> 0
- )
- eor_result_list = []
- for A, B in zip(param_list, key):
- eor_result_list.append(A ^ B)
- for i in range(len):
- C = self.reverse(eor_result_list[i])
- D = eor_result_list[
- (
- i + 1
- )
- % len
- ]
- E = C ^ D
- F = self.rbit_algorithm(E)
- H = (
- (
- F ^ 0xFFFFFFFF
- )
- ^ len
- ) & 0xFF
- eor_result_list[i] = H
- result = ""
- for param in eor_result_list:
- result += self.hex_string(param)
- return {
- "X-Gorgon": (
- "0404b0d30000"
- + result
- ),
- "X-Khronos": str(unix)
- }
- def rbit_algorithm(self, num):
- result = ""
- tmp_string = bin(num)[2:]
- while len(tmp_string) < 8:
- tmp_string = (
- "0"
- + tmp_string
- )
- for i in range(0, 8):
- result = (
- result
- + tmp_string[
- 7 - i
- ]
- )
- return int(result, 2)
- def hex_string(self, num):
- tmp_string = hex(num)[2:]
- if len(tmp_string) < 2:
- tmp_string = "0" + tmp_string
- return tmp_string
- def reverse(self, num):
- tmp_string = self.hex_string(num)
- return int(tmp_string[1:] + tmp_string[:1], 16)
- def send():
- global _views
- querystring = {
- "os_api": "25",
- "device_type": "G011A",
- "ssmix": "a",
- "manifest_version_code": "2021903030",
- "dpi": "320",
- "carrier_region": "IE",
- "uoo": "0",
- "region": "US",
- "carrier_region_v2": "310",
- "app_name": "musical_ly",
- "version_name": "19.3.3",
- "timezone_offset": "7200",
- "ts": int(time.time()),
- "ab_version": "19.3.3",
- "residence": "IE",
- "cpu_support64": "false",
- "current_region": "US",
- "ac2": "wifi",
- "ac": "wifi",
- "app_type": "normal",
- "host_abi": "armeabi-v7a",
- "channel": "googleplay",
- "update_version_code": "2021903030",
- "_rticket": int(round((time.time() * 1000)) + 0),
- "device_platform": "android",
- "iid": "7037880313762858758",
- "build_number": "19.3.3",
- "locale": "en",
- "op_region": "IE",
- "version_code": "190303",
- "timezone_name": "Africa/Harare",
- "cdid": "6ad560a8-8209-4fe3-b771-6bbe64880e4c",
- "openudid": "0e96eaebc0c2e44f",
- "sys_region": "US",
- "device_id": "6906478625937278469",
- "app_language": "en",
- "resolution": "1600*900",
- "device_brand": "samsung",
- "language": "en",
- "os_version": "7.1.2",
- "aid": "1233",
- "mcc_mnc": "31002"
- }
- params = urllib.parse.urlencode(querystring)
- 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"
- headers = {
- "x-ss-stub": str(hashlib.md5(payload.encode()).hexdigest()).upper(),
- "accept-encoding": "gzip",
- "passport-sdk-version": "19",
- "sdk-version": "2",
- "x-ss-req-ticket": str(int(round((time.time() * 1000)) + 0)),
- "x-tt-dm-status": "login=1;ct=1",
- "x-tt-cmpl-token": "AgQQAPObF-RPsI8CtPIKJt0_xfZsL4wdv4BpYMZArg",
- "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
- "host": "api16-va.tiktokv.com",
- "connection": "Keep-Alive",
- "user-agent": "okhttp/3.12.1"
- }
- url = "https://api16-va.tiktokv.com/aweme/v1/aweme/stats/?" + params
- gorgon = Xgorgon(params=params, data=payload, cookies=None).get_value()
- headers.update(gorgon)
- req = requests.post(url, data=payload, headers=headers).json()
- if req["status_code"] == 0:
- _views += 1
- # threading.Lock().acquire()
- sys.stdout.write(f"\r [root@localhost ~]# Views sent: {_views}")
- sys.stdout.flush()
- # threading.Lock().release()
- else:
- print(req)
- for x in range(1):
- threading.Thread(target=send).start()
- time.sleep(0.1)
- send()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement