Skip to content

[Bug]: failed to do request: Get "https://get.ja3.zone/": tls: unknown ClientHelloID: Custom-1' #38

Open
@tngo-tool98

Description

@tngo-tool98

TLS Requests version

wrapper-tls-requests==1.1.4

Issue description

import json
from datetime import datetime
from typing import Dict, Optional

import requests
import tls_requests

PROXY = "your-proxy" # Ex: http://username:password@ip:port
CUSTOM_TLS_CLIENT_CRHOME_133_KWARGS = {
    "alpnProtocols": [  # Done
        "h2",
        "http/1.1"
    ],
    "alpsProtocols": [  # Done
        "h2"
    ],
    "certCompressionAlgo": "brotli",    # Done
    "connectionFlow": 15663105,  # Done
    "h2Settings": {  # Done
        "HEADER_TABLE_SIZE": 65536,
        "ENABLE_PUSH": 0,
        "INITIAL_WINDOW_SIZE": 6291456,
        "MAX_HEADER_LIST_SIZE": 262144
    },
    "h2SettingsOrder": [    # Done
        "HEADER_TABLE_SIZE",
        "ENABLE_PUSH",
        "INITIAL_WINDOW_SIZE",
        "MAX_HEADER_LIST_SIZE"
    ],
    "headerPriority": None,
    "ja3String": "771,2570-4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,2570-0-23-65281-10-11-35-16-5-13-18-51-45-43-27-17513-2570-21,2570-29-23-24,0",
    "keyShareCurves": [
        "GREASE",
        "X25519"
    ],
    "priorityFrames": [],
    "pseudoHeaderOrder": [  # Done
        ":method",
        ":authority",
        ":scheme",
        ":path"
    ],
    "supportedSignatureAlgorithms": [   # Done
        "ECDSAWithP256AndSHA256",
        "PSSWithSHA256",
        "PKCS1WithSHA256",
        "ECDSAWithP384AndSHA384",
        "PSSWithSHA384",
        "PKCS1WithSHA384",
        "PSSWithSHA512",
        "PKCS1WithSHA512"
    ],
    "supportedVersions": [  # Done
        "GREASE",
        "1.3",
        "1.2"
    ]
}
CUSTOM_TLS_CLIENT = tls_requests.tls.CustomTLSClientConfig.from_kwargs(**CUSTOM_TLS_CLIENT_CRHOME_133_KWARGS)

def check_fingerprint(is_using_python_requests_lib: bool = False) -> Optional[Dict]:
    try:
        # if not mv.session_captcha:
        #     print("Can't get fingerprint: session_captcha is None.")
        #     return None

        try:
            url = "https://get.ja3.zone/"
            headers = {
                'accept': '*/*',
                'accept-language': "en-US,en;q=0.9",
                'cache-control': 'no-cache',
                'origin': 'https://ja3.zone',
                'pragma': 'no-cache',
                'priority': 'u=1, i',
                'referer': 'https://ja3.zone',
                'sec-ch-ua': '"Chromium";v="133", "Google Chrome";v="133", "Not A;Brand";v="99"',
                'sec-ch-ua-mobile': '?0',
                'sec-ch-ua-platform': '"Windows"',
                'sec-fetch-dest': 'empty',
                'sec-fetch-mode': 'cors',
                'sec-fetch-site': 'same-site',
                'user-agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
            }

            if is_using_python_requests_lib:
                response = requests.get(url, headers=headers, proxies=PROXY, verify=False)
            else:
                try:
                    response = tls_requests.get(
                        url,
                        proxy=PROXY,
                        http2=True,
                        headers=headers,
                        verify=True,
                        customTlsClient=CUSTOM_TLS_CLIENT,
                        tlsClientIdentifier=None
                    )
                except Exception as e:
                    print("Failed to get fingerprint: ", e)
                    return None
            if response.status_code == 200:
                if not response.text:
                    return None
                json_resp = json.loads(response.text)
                now = datetime.now()
                timestamp = now.strftime("%Y-%m-%d_%H-%M-%S")
                with open(f"tls_check/fingerprint_{timestamp}.json", "w", encoding="utf-8") as f:
                    json.dump(json_resp, f, indent=4)
                return json_resp
            else:
                return None
        except Exception as e:
            print("Failed to get fingerprint: ", e)
            return None
    except Exception as e:
        print("Can't get fingerprint: ", e)
        return None

Steps to reproduce / Code Sample

When I try to use a custom profile with the code above, I get the following error message

failed to do request: Get "https://get.ja3.zone/": tls: unknown ClientHelloID: Custom-1

I already rechecked it by using the shared library: https://github.com/bogdanfinn/tls-client/blob/master/cffi_dist/example_python/example_custom_client.py, and it worked.

Could you please re-test it? I really don't know what’s wrong with my collected TLS fingerprint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions