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

[Feature] Websocket work #392

Open
Cataphract89 opened this issue Sep 23, 2024 · 2 comments
Open

[Feature] Websocket work #392

Cataphract89 opened this issue Sep 23, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@Cataphract89
Copy link

I need to set up a large number of websocket connections to the site\app. At my volume I am starting to get connection errors. I manage to get around this by randomizing impersonate:

     impersonate=random.choice(['chrome110, chrome120, ...])

And using custom settings for the latest version of chrome128 with several variants ja3 static customizations of real android devices

    tls_version = "771"
cipher_suites = "4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53"
supported_groups = "25497-29-23-24"
compression_methods = "0"
possible_extensions = [
    "0", "5", "10", "11", "13", "16", "18", "23", "27", "35", "43", "45", "51",
    "65281", "65037", "17513"
]
akamai = "1:65536;2:0;4:6291456;6:262144|15663105|0|m,a,s,p"

extra_fp = {
    "tls_signature_algorithms": [
        "ecdsa_secp256r1_sha256",
        "rsa_pss_rsae_sha256",
        "rsa_pkcs1_sha256",
        "ecdsa_secp384r1_sha384",
        "rsa_pss_rsae_sha384",
        "rsa_pkcs1_sha384",
        "rsa_pss_rsae_sha512",
        "rsa_pkcs1_sha512",
    ],
    'tls_cert_compression': "brotli",
    'http2_stream_weight': 256,
    'http2_stream_exclusive': 1
}
extensions = gen_random_extensions(possible_extensions)
ja3 = ",".join(
    [
        tls_version,
        cipher_suites,
        extensions,
        supported_groups,
        compression_methods,
    ]
)

(IOS works the worst, and the latest custom version gives only errors)
But after a while, I'm starting to run into more and more connection errors..
Websocket settings

                   if not self.imp:
                ws = s.ws_connect(
                    url,
                    on_message=self.on_message, proxies={
                        'https': f"http://{self.proxies_ws['login']}:"
                                 f"{self.proxies_ws['password']}@{self.proxies_ws['ip']}:{rand_port}"},
                    headers=headers, on_error=self.on_error, ja3=self.ja3, extra_fp=self.extra_fp, akamai=self.akamai)
            else:
                ws = s.ws_connect(
                    url,
                    on_message=self.on_message, proxies={
                        'https': f"http://{self.proxies_ws['login']}:"
                                 f"{self.proxies_ws['password']}@{self.proxies_ws['ip']}:{rand_port}"},
                    headers=headers, on_error=self.on_error, impersonate=self.imp)

Question - am I missing something in the websocket operation and is the setup different from the requests? How can I randomize more settings for successful connections ?

@Cataphract89
Copy link
Author

My other similar question pertaining to the same thing - Android extensions randomize #393

@dolfies
Copy link
Contributor

dolfies commented Dec 3, 2024

You aren't using your proxies here. You need to change 'https': ... to 'wss': ... or 'ws': ... depending on your URL.

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

No branches or pull requests

2 participants