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

Customized impersonating fingerprints #194

Closed
T-256 opened this issue Dec 26, 2023 · 5 comments · Fixed by #331
Closed

Customized impersonating fingerprints #194

T-256 opened this issue Dec 26, 2023 · 5 comments · Fixed by #331
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@T-256
Copy link
Contributor

T-256 commented Dec 26, 2023

Is your feature request related to a problem? Please describe.
Yes, I think for solving #169 we need python level fingerprint generator.

Describe the solution you'd like
Ability to create impersonation in python level and use it in requests.

Describe alternatives you've considered
python-tls-client example

@T-256 T-256 added the enhancement New feature or request label Dec 26, 2023
@perklet
Copy link
Collaborator

perklet commented Jan 1, 2024

We need to get a list of customizable fields.

For TLS, there are too many, I have not bothered to collect them implementation is on the way.

For http2, we are almost there, only one part is missing everything is there.

All the options are listed here: https://github.com/yifeikong/curl-impersonate#libcurl-impersonate

We also need to implement a python class like ImpersonateSpec to specify the detailed instructions.

@perklet
Copy link
Collaborator

perklet commented Jan 9, 2024

The first step is to be able to impersonate Firefox with BoringSSL.

These issues need to be resolved at boringssl level.

This issue can be fixed at curl level.

After the above issues are fixed, we need to

  • Export the struct impersonate_opts to Python via cffi.
  • Create corresponding Python class.
  • Add a parser to convert other easily accessible formats(e.g. browserleaks/peet.ws) to our internal format.

@perklet perklet added this to the v0.7 milestone Jan 11, 2024
@novitae novitae mentioned this issue Feb 10, 2024
@perklet perklet changed the title Custom impersonate Customized impersonating fingerprints Feb 23, 2024
@perklet perklet pinned this issue Feb 23, 2024
@perklet
Copy link
Collaborator

perklet commented Jun 27, 2024

Added in v0.7.0b7, examples.

@T-256
Copy link
Contributor Author

T-256 commented Jun 27, 2024

I wished a base class that we could inherited browsers and change some of its parameters.
Actually, I wish to have customizations same as files in https://github.com/yifeikong/curl-impersonate/blob/main/chrome directly in python.

class BaseFingerprint:
   @property
   def property_name(self): ...


class Chrome124(BaseFingerprint):
   """
   # Updates in this version since Chrome123:
   - Added X25519Kyber768 support
   - Added Priority header support
   """

   def __init__(self):
       self._ciphers ="TLS_AES_128_GCM_SHA256,TLS_AES_256_GCM_SHA384,TLS_CHACHA20_POLY1305_SHA256,ECDHE-ECDSA-AES128-GCM-SHA256,ECDHE-RSA-AES128-GCM-SHA256,ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-GCM-SHA384,ECDHE-ECDSA-CHACHA20-POLY1305,ECDHE-RSA-CHACHA20-POLY1305,ECDHE-RSA-AES128-SHA,ECDHE-RSA-AES256-SHA,AES128-GCM-SHA256,AES256-GCM-SHA384,AES128-SHA,AES256-SHA"
       self._curves = "X25519Kyber768Draft00:X25519:P-256:P-384"

   @property
   def ciphers(self):
       return self._ciphers

   @property
   def curves(self):
       return self._curves

@perklet
Copy link
Collaborator

perklet commented Jun 27, 2024

It's my first thought, too.

However, since the fingerprints for browsers have been built into C, I don't feel it necessary to have an exact clone on Python side. If it was designed from ground up with python bindings in mind, I would have the browser settings in Python, too.

Nonetheless, the most common usecase for customized fingerprints should be impersonating other http libs, e.g. okhttp. The easist way to get their fingerprints for users is to copy the JA3 string from WireShark or somewhere.

If your usecase is to alter the browsers' fingerprints a little bit, you can simply add a curl setopt option using the curl_options parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants