bogdanfinn / tls-client

net/http.Client like HTTP Client with options to select specific client TLS Fingerprints to use for requests.
BSD 4-Clause "Original" or "Old" License
860 stars 164 forks source link

Add firefox_123 client #105

Closed Probabilities closed 8 months ago

Probabilities commented 8 months ago

Describe the feature / enhancement and how it would improve things

Pretty simple. See the golang example below.

Describe how your proposal will work, with code and/or pseudo-code

here is the client in golang. I wish to have it inside nodejs


profiles.NewClientProfile(
        tls.ClientHelloID{
            Client:               "Firefox",
            RandomExtensionOrder: false,
            Version:              "123",
            Seed:                 nil,
            SpecFactory: func() (tls.ClientHelloSpec, error) {
                return tls.ClientHelloSpec{
                    CipherSuites: []uint16{
                        tls.TLS_AES_128_GCM_SHA256,
                        tls.TLS_CHACHA20_POLY1305_SHA256,
                        tls.TLS_AES_256_GCM_SHA384,
                        tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
                        tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
                        tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,
                        tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256,
                        tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
                        tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
                        tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
                        tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
                        tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
                        tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
                        tls.TLS_RSA_WITH_AES_128_GCM_SHA256,
                        tls.TLS_RSA_WITH_AES_256_GCM_SHA384,
                        tls.TLS_RSA_WITH_AES_128_CBC_SHA,
                        tls.TLS_RSA_WITH_AES_256_CBC_SHA,
                    },
                    CompressionMethods: []byte{
                        tls.CompressionNone,
                    },
                    Extensions: []tls.TLSExtension{
                        &tls.SNIExtension{},
                        &tls.ExtendedMasterSecretExtension{},
                        &tls.RenegotiationInfoExtension{Renegotiation: tls.RenegotiateOnceAsClient},
                        &tls.SupportedCurvesExtension{[]tls.CurveID{
                            tls.X25519,
                            tls.CurveP256,
                            tls.CurveP384,
                            tls.CurveP521,
                            tls.FAKEFFDHE2048,
                            tls.FAKEFFDHE3072,
                        }},
                        &tls.SupportedPointsExtension{SupportedPoints: []byte{
                            tls.PointFormatUncompressed,
                        }},
                        &tls.SessionTicketExtension{},

                        &tls.ALPNExtension{AlpnProtocols: []string{"h2", "http/1.1"}},
                        &tls.StatusRequestExtension{},
                        &tls.DelegatedCredentialsExtension{
                            SupportedSignatureAlgorithms: []tls.SignatureScheme{
                                tls.ECDSAWithP256AndSHA256,
                                tls.ECDSAWithP384AndSHA384,
                                tls.ECDSAWithP521AndSHA512,
                                tls.ECDSAWithSHA1,
                            },
                        },
                        &tls.KeyShareExtension{[]tls.KeyShare{
                            {Group: tls.X25519},
                            {Group: tls.CurveP256},
                        }},
                        &tls.SupportedVersionsExtension{[]uint16{
                            tls.VersionTLS13,
                            tls.VersionTLS12,
                        }},
                        &tls.SignatureAlgorithmsExtension{SupportedSignatureAlgorithms: []tls.SignatureScheme{
                            tls.ECDSAWithP256AndSHA256,
                            tls.ECDSAWithP384AndSHA384,
                            tls.ECDSAWithP521AndSHA512,
                            tls.PSSWithSHA256,
                            tls.PSSWithSHA384,
                            tls.PSSWithSHA512,
                            tls.PKCS1WithSHA256,
                            tls.PKCS1WithSHA384,
                            tls.PKCS1WithSHA512,
                            tls.ECDSAWithSHA1,
                            tls.PKCS1WithSHA1,
                        }},
                        &tls.PSKKeyExchangeModesExtension{[]uint8{
                            tls.PskModeDHE,
                        }},
                        &tls.FakeRecordSizeLimitExtension{0x4001},
                        tls.BoringGREASEECH(),
                    }}, nil
            },
        },
        map[http2.SettingID]uint32{
            http2.SettingHeaderTableSize:   65536,
            http2.SettingInitialWindowSize: 131072,
            http2.SettingMaxFrameSize:      16384,
        },
        []http2.SettingID{
            http2.SettingHeaderTableSize,
            http2.SettingInitialWindowSize,
            http2.SettingMaxFrameSize,
        },
        []string{
            ":method",
            ":path",
            ":authority",
            ":scheme",
        },
        12517377,
        []http2.Priority{
            {StreamID: 3, PriorityParam: http2.PriorityParam{
                StreamDep: 0,
                Exclusive: false,
                Weight:    200,
            }},
            {StreamID: 5, PriorityParam: http2.PriorityParam{
                StreamDep: 0,
                Exclusive: false,
                Weight:    100,
            }},
            {StreamID: 7, PriorityParam: http2.PriorityParam{
                StreamDep: 0,
                Exclusive: false,
                Weight:    0,
            }},
            {StreamID: 9, PriorityParam: http2.PriorityParam{
                StreamDep: 7,
                Exclusive: false,
                Weight:    0,
            }},
            {StreamID: 11, PriorityParam: http2.PriorityParam{
                StreamDep: 3,
                Exclusive: false,
                Weight:    0,
            }},
            {StreamID: 13, PriorityParam: http2.PriorityParam{
                StreamDep: 0,
                Exclusive: false,
                Weight:    240,
            }},
        },
        &http2.PriorityParam{
            StreamDep: 13,
            Exclusive: false,
            Weight:    41,
        },
    )```
bogdanfinn commented 8 months ago

Handled in https://github.com/bogdanfinn/tls-client/pull/106

Thank you for your contribution.