lexiforest / curl_cffi

Python binding for curl-impersonate fork via cffi. A http client that can impersonate browser tls/ja3/http2 fingerprints.
https://curl-cffi.readthedocs.io/
MIT License
2.19k stars 251 forks source link

[Feature] Can it be used as a proxy? I would like to use it with puppeteer #213

Closed marcusdiy closed 6 months ago

marcusdiy commented 9 months ago

Is your feature request related to a problem? Please describe. Yeah curl_cffi allows to change TLS fingerpints, but it can only be used in limited scenarios. Would be great to be able to use like a proxy so i can keep using for example chromium browser and look like safari if the curl_cffi acts like a proxy server.

Describe the solution you'd like Create a script that allows to use it like a proxy. It should support proxies too. For example: curl_cffi_proxy.py --clientPort=9658 --proxy=https://proxyused:bycurlcffi@example.com:9658

perklet commented 9 months ago

https proxy is a tunnel, which means the TLS handshake is done by the client and server even if a proxy stands in the middle. TLS fingerprint, as the name suggests, uses the Hello package of TLS handshake. Since the proxy is not able to intercept and change the whole TLS traffic, it's not able to alter the Hello package, neither.

However, it is possible that the proxy performs some kind of man-in-the-middle(MITM) "attack", but it means that the client, in your case the browser, has to accept the self-signed certificates of the proxy, which is very tricky to implement.