Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TLS Version not changing #282

Open
Nixh5 opened this issue Mar 31, 2024 · 6 comments
Open

TLS Version not changing #282

Nixh5 opened this issue Mar 31, 2024 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@Nixh5
Copy link

Nixh5 commented Mar 31, 2024

I'm trying to get 771 at the ja3 fingerprint but its not working, the curl_cffi asks me for an integer and I've tried what it allows me but the 772 never changes to 771 so I assume the TLS version is not changing no matter what I do, or something else...

from curl_cffi import CurlOpt, requests

response = requests.get("https://tools.scrapfly.io/api/fp/ja3",
    curl_options={
        CurlOpt.SSLVERSION: 6, #tried also, 0, 1 ...
})
print(response.text)

I've looked to use CURL_SSLVERSION_MAX_TLSv1_2 as well but I dont find any way to do that with curl_cffi.

Versions
curl_cffi 0.6.3b1
Kubuntu 12
Python 3.11.6

@Nixh5 Nixh5 added the bug Something isn't working label Mar 31, 2024
@Nixh5 Nixh5 changed the title [BUG] TLS Version not changing Mar 31, 2024
@Nixh5
Copy link
Author

Nixh5 commented Mar 31, 2024

ok I'll close this, I would say its a bug of scrapfly or something because here I get 771:
https://check.ja3.zone/

@Nixh5 Nixh5 closed this as completed Mar 31, 2024
@Nixh5 Nixh5 reopened this Mar 31, 2024
@Nixh5
Copy link
Author

Nixh5 commented Mar 31, 2024

ok at https://check.ja3.zone/ I get 771 but the TLS version is still 1.3, when what I want is 1.2, for example using this code it uses 1.2 how can I do this with curl_cffi?:


import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.poolmanager import PoolManager
import ssl
from urllib3.util.ssl_ import create_urllib3_context


class ForceTLS12Adapter(HTTPAdapter):

    def init_poolmanager(self, *args, **kwargs):
        context = create_urllib3_context(ssl_version=ssl.PROTOCOL_TLSv1_2)
        self.poolmanager = PoolManager(*args, ssl_context=context, **kwargs)


s = requests.Session()
s.mount('https://', ForceTLS12Adapter())

response = s.get('https://check.ja3.zone/')

print(response.text)

@yifeikong
Copy link
Owner

Sorry, this won't work, as curl_cffi does not use urllib3 under the hood. The reason is probably that TLS version is fixed in upstream curl-impersonate. Anyway, TLS 1.3 is preferred to TLS 1.2.

@Alexei17
Copy link

Alexei17 commented Apr 3, 2024

Sorry, this won't work, as curl_cffi does not use urllib3 under the hood. The reason is probably that TLS version is fixed in upstream curl-impersonate. Anyway, TLS 1.3 is preferred to TLS 1.2.

Hi, here #30 you suggested that putting in CURL_SSLVERSION_MAX_TLSv1_2 will work. Getting mixed signals, is changing TLS versions not supported by this library?

@Nixh5
Copy link
Author

Nixh5 commented Apr 3, 2024

I would like it to be supported because I'm trying to achieve an specific ja3 fingerprint so not being allowed to change the TLS version is breaking my ja3.

@yifeikong
Copy link
Owner

Hi, here #30 you suggested that putting in CURL_SSLVERSION_MAX_TLSv1_2 will work. Getting mixed signals, is changing TLS versions not supported by this library?

This SHOULD work theoretically, but I havn't tried that in practice. If it does not work, it's probably because TLS version is fixed by the patch.

I'm trying to achieve an specific ja3 fingerprint

You can follow the updates of the pinned issue, customized fingerprints support is tracked there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants