最新 抖音 X-Gorgon 0408 和8408 设备注册协议

如果最近更新了新版抖音的app的人应该已经发现了,抖音安卓版的xg算法开头也变成了8408开头,因为84开头之前都是ios平台上的xg算法,到目前为止,IOS平台的xg还是8404开头。

抖音app先是检测了你的手机cpu架构,是x86还是armeabi,通过cpu架构的不同来调用so内不同的xg方法,所以导致现在最新版抖音app的xg算法有0408和8408两种。

两种都是最新版,因为我发现当我使用oppo手机安装最新版抖音抓包的xg是8408,而当我用小米或者华为安装最新版抖音,抓包以后发现xg是0408。

抖音IOS  XG84 设备注册激活协议代码片段

def device_register(proxies):

    vid = str(unid.uuid4()).upper()
    idfa = str(unid.uuid4()).upper()
    openudid = stringRandom(40)
    os_version = '13.4.1'  # ios版本
    device_type = 'iPhone9,1'  # 机型
    device_model = 'iPhone9,1'  # 机型
    resolution = '1080*1920'
    channel = 'App%20Store'
    cdid = str(unid.uuid4()).upper()
    os_api = str(random.randint(29, 29))  # 22,29

    # 固定版本21.5.0
    a, b, c = random.randint(21, 21), random.randint(5, 5), random.randint(0, 0)
    UA = f'Aweme {a}.{b}.{c} rv:{a}{b}013 (iPhone; iOS {os_version}; zh_CN) Cronet'
    print(UA)
    deviceParams = {
        'device_id': '',
        'is_activated': '0',
        'aid': '1128',  # 2329 1128 1112
        'tt_data': 'a',
        'version_code': f'{a}.{b}.{c}',
        'js_sdk_version': '2.19.0.2',
        "tma_jssdk_version": "2.19.0.2",
        'app_name': 'aweme',
        'app_version': f'{a}.{b}.{c}',
        'vid': vid,
        'channel': channel,
        'mcc_mnc': '',
        'minor_status': '0',
        'screen_width': '750',
        'openudid': openudid,
        'cdid': cdid,
        'os_api': os_api,
        'ac': 'WIFI',
        'os_version': os_version,
        'appTheme': 'dark',
        'device_platform': 'iphone',
        'build_number': f'{a}{b}013',
        'is_vcd': '1',
        'device_model': device_model,
        'idfa': idfa,
    }
    custom = {
        'app_region': 'CN',
        'earphone_status': 'off',
        'web_ua': f'Mozilla/5.0 (iPhone; CPU iPhone OS {os_version.replace(".","_")} like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148',
        'filter_warn': 0,
        'user_period': 0,
        'user_mode': 0,
        'app_language': 'zh',
        'build_number': f'{a}{b}013',
    }

    p = url_encode(deviceParams)
    xgorgon = xg84(p, '', '')
    url = 'https://log3-misc.amemv.com/service/2/device_register/?' + p
    print('【注册请求】', url)
    form_data = {"magic_tag": "ss_app_log",
                 "header": {'custom': custom, "display_name": "抖音",
                            "aid": deviceParams['aid'],
                            "app_name" : deviceParams['app_name'],
                            "carrier": "",
                            "vendor_id": vid,
                            "scene": 0,
                            "disk_total": 63926554624,
                            "phone_name": "iPhone",
                            "device_token": "",
                            "boot_time": "1622862193.453870",
                            'app_region': 'CN',
                            'hardware_model': 'D22AP',
                            'auth_status': 3,
                            'mem_total': 2956918784,
                            'idfa': idfa,
                            'mb_time': '1631933669.923198',
                            'cpu_num': 6,
                            'user_agent': UA,
                            "model_display_name": deviceParams['device_model'],

                            "channel": deviceParams['channel'].replace('%20', ' '),
                            # "appkey": "57bfa27c67e58e7d920028d3",
                            "package": "com.ss.iphone.ugc.Aweme",
                            "app_version": deviceParams['app_version'],
                            # "version_code": deviceParams['version_code'],

                            "sdk_version": 265,
                            "os": "iOS",
                            "os_version": deviceParams['os_version'],
                            # "os_api": deviceParams['os_api'],
                            "device_model": deviceParams['device_model'],
                            # "device_brand": deviceParams['device_brand'],
                            "resolution": resolution,
                            "language": "zh",
                            "locale_language": "zh-Hans-CN",
                            "timezone": 8,
                            "access": deviceParams['ac'],
                            "cdid": deviceParams['cdid'],
                            "region": "CN",
                            "tz_name": "Asia/Shanghai",
                            "local_tz_name": "Asia/Shanghai",
                            "is_upgrade_user": False,
                            "is_jailbroken": False,
                            'mcc_mnc': deviceParams['mcc_mnc'],
                            "carrier_region": "",
                            "app_language": "zh",
                            "tz_offset": 28800}}
    headers = {
        'User-Agent': UA,
        'sdk-version': '2',
        'X-SS-STUB': md5(json.dumps(form_data)),
        'X-Khronos': xgorgon['X-Khronos'],
        'X-Gorgon': xgorgon['X-Gorgon'],
        'Content-Type': 'application/octet-stream;tt-data=a'
    }
    en_data = EN(gzip.compress(bytes(json.dumps(form_data), encoding="utf8"))).encrypt()
    try:
        resp = requests.post(url=url, data=en_data, headers=headers, proxies=proxies, verify=False, timeout=10)
        resp_json = resp.json()
        print('【注册结果】', resp_json)
        if resp_json.get('install_id', 0) == 0 or resp_json.get('device_id', 0) == 0:
            return print('【注册失败!】')
        resp_json['iid'] = resp_json['install_id_str']
    except Exception as e:
        return print('【注册失败!】', e)

    param_check = {
        'iid': resp_json['install_id_str'],
        'device_id': resp_json['device_id_str'],
        'timezone': str(form_data['header']['timezone']),
        'device_token': resp_json['device_token'],
        'is_upgrade_user': '0',

        'mcc_mnc': deviceParams['mcc_mnc'],
        'app_name': deviceParams['app_name'],
        'channel': deviceParams['channel'],
        'device_platform': deviceParams['device_platform'],
        'idfa': deviceParams['idfa'],
        'vid': deviceParams['vid'],
        'version_code': deviceParams['version_code'],
        'ac': deviceParams['ac'],
        'os_version': deviceParams['os_version'],
        'aid': deviceParams['aid'],
        'is_activated': deviceParams['is_activated'],
    }
    p = url_encode(param_check)
    url_check = "https://log3-misc.amemv.com/service/2/app_alert_check/?" + p
    print('【激活请求】', url_check)
    xgorgon = xg84(p, '', '')
    headers_check = {
                    'User-Agent': UA,
                    'install_id': param_check['iid'],
                    'X-Khronos': xgorgon['X-Khronos'],
                    'X-Gorgon': xgorgon['X-Gorgon'],
                     }
    try:
        resp = requests.get(url=url_check, headers=headers_check, proxies=proxies, verify=False, timeout=10)
        resp_json2 = resp.json()
        print('【激活结果】', resp_json2)
        if resp_json2.get('message', '') != 'success':
            return print('【激活失败!】')
    except Exception as e:
        return print('【激活失败!】', resp.text,e)

    item = {}
    deviceParams.update(resp_json)
    deviceParams.update(form_data['header'])
    deviceParams['device_type'] = device_type
    deviceParams['resolution'] = resolution
    item['data'] = resp_device(deviceParams)
    item['UA'] = UA
    return item

最新 抖音 X-Gorgon 0408 和8408 设备注册协议_第1张图片

 

{"device": "dmVyc2lvbl9jb2RlPTIxLjUuMCZqc19zZGtfdmVyc2lvbj0yLjE5LjAuMiZ0bWFfanNzZGtfdmVyc2lvbj0yLjE5LjAuMiZhcHBfbmFtZT1hd2VtZSZhcHBfdmVyc2lvbj0yMS41LjAmdmlkPTlCNzUwQ0EyLTdBMEUtNEU1NS04M0RELTIxQzZBRUIzQzNDRCZkZXZpY2VfaWQ9MjUxMTY1Njg0MDA4MDg4JmNoYW5uZWw9QXBwJTIwU3RvcmUmbWNjX21uYz0mYWlkPTExMjgmc2NyZWVuX3dpZHRoPTc1MCZvcGVudWRpZD03NWYwM2MyYzQ2MDVkN2QwMTdmY2Q1ZDE3OWVlMDY1Yjc5MmZhMmEyJmNkaWQ9QUREOTM0Q0QtMkEyOC00NEIzLUI2REQtMTNGMjhBMzI2MzZFJm9zX2FwaT0yOSZhYz1XSUZJJm9zX3ZlcnNpb249MTMuNC4xJmRldmljZV9wbGF0Zm9ybT1pcGhvbmUmYnVpbGRfbnVtYmVyPTIxNTAxMyZpc192Y2Q9MSZkZXZpY2VfdHlwZT1pUGhvbmU5JTJDMSZpaWQ9MzMyOTc5ODI0MjA1NzkxNyZpZGZhPTI3RTkzMUVCLTk4QUMtNDkwNS1BODI4LThGN0M1Nzc4QzhEQw=="}

 

你可能感兴趣的:(ios,iphone)