FlorianREGAZ / Python-Tls-Client

Advanced HTTP Library
MIT License
689 stars 134 forks source link

Custom TLS Fingerprints aren't working #4

Closed JFuqX closed 2 years ago

JFuqX commented 2 years ago

Hi i just wanted to submit, that custom fingerprints aren't working. With presets everything is working fine.

I am on MacOS with M1 and on the recent version of your package.

I thought I did something wrong but even with your custom example I get the following error:

File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/tls_client/sessions.py", line 334, in get return self.execute_request(method="GET", url=url, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/tls_client/sessions.py", line 317, in execute_request raise TLSClientExeption(response_object["body"]) tls_client.exceptions.TLSClientExeption: failed to do request: Get "https://tls.peet.ws/api/all": unknown extension with id 27 provided

FlorianREGAZ commented 2 years ago

Hey JFuqX,

could you send me a code snippet with which I can replicate the error please?

JFuqX commented 2 years ago

Just a small example, its basically on every request I do. The custom fingerprint is from your example ...

import tls_client

session = tls_client.Session(
    ja3_string="771,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,0-23-65281-10-11-35-16-5-13-18-51-45-43-27-17513,29-23-24,0",
    h2_settings={
        "HEADER_TABLE_SIZE": 65536,
        "MAX_CONCURRENT_STREAMS": 1000,
        "INITIAL_WINDOW_SIZE": 6291456,
        "MAX_HEADER_LIST_SIZE": 262144
    },
    h2_settings_order=[
        "HEADER_TABLE_SIZE",
        "MAX_CONCURRENT_STREAMS",
        "INITIAL_WINDOW_SIZE",
        "MAX_HEADER_LIST_SIZE"
    ],
    supported_signature_algorithms=[
        "ECDSAWithP256AndSHA256",
        "PSSWithSHA256",
        "PKCS1WithSHA256",
        "ECDSAWithP384AndSHA384",
        "PSSWithSHA384",
        "PKCS1WithSHA384",
        "PSSWithSHA512",
        "PKCS1WithSHA512",
    ],
    supported_versions=["GREASE", "1.3", "1.2"],
    key_share_curves=["GREASE", "X25519"],
    cert_compression_algo="brotli",
    pseudo_header_order=[
        ":method",
        ":authority",
        ":scheme",
        ":path"
    ],
    connection_flow=15663105,
    header_order=[
        "accept",
        "user-agent",
        "accept-encoding",
        "accept-language"
    ]
)

res = session.get("https://tls.peet.ws/api/all").json()
print(res)
FlorianREGAZ commented 2 years ago

Could you try the latest version please? The code snippet you send me works for me. If it still doesn't work, please let me know. I'll try to get my hands on a Mac then.

JFuqX commented 2 years ago

Everthing works now!

Again thank you for this awesome contribution!