diff --git a/u_common.go b/u_common.go index 770507c6a1..b74bcee8f1 100644 --- a/u_common.go +++ b/u_common.go @@ -666,8 +666,9 @@ var ( Hello360_7_5 = ClientHelloID{hello360, "7.5", nil, nil} Hello360_11_0 = ClientHelloID{hello360, "11.0", nil, nil} - HelloQQ_Auto = HelloQQ_11_1 + HelloQQ_Auto = HelloQQ_22_5 HelloQQ_11_1 = ClientHelloID{helloQQ, "11.1", nil, nil} + HelloQQ_22_5 = ClientHelloID{helloQQ, "22.5", nil, nil} ) type Weights struct { diff --git a/u_parrots.go b/u_parrots.go index 425ab6ddda..9c26c159c3 100644 --- a/u_parrots.go +++ b/u_parrots.go @@ -2530,6 +2530,8 @@ func utlsIdToSpec(id ClientHelloID) (ClientHelloSpec, error) { }, }, }, nil + case HelloQQ_22_5: + return utlsIdToSpec(HelloChrome_133) case HelloQQ_11_1: return ClientHelloSpec{ TLSVersMin: VersionTLS10, diff --git a/u_qq_profile_test.go b/u_qq_profile_test.go new file mode 100644 index 0000000000..0d229254ef --- /dev/null +++ b/u_qq_profile_test.go @@ -0,0 +1,32 @@ +package tls + +import ( + "net" + "reflect" + "testing" +) + +func TestQQ225ClientHello(t *testing.T) { + conn := UClient(&net.TCPConn{}, &Config{ServerName: "example.com"}, HelloQQ_Auto) + if err := conn.BuildHandshakeState(); err != nil { + t.Fatal(err) + } + hello := conn.HandshakeState.Hello + shares := hello.KeyShares + if len(shares) != 3 || !isGREASEUint16(uint16(shares[0].Group)) || + shares[1].Group != X25519MLKEM768 || len(shares[1].Data) != 1216 || + shares[2].Group != X25519 || len(shares[2].Data) != 32 { + t.Fatal("unexpected key shares") + } + wantVersions := []uint16{VersionTLS13, VersionTLS12} + if len(hello.SupportedVersions) != len(wantVersions)+1 || + !isGREASEUint16(hello.SupportedVersions[0]) || !reflect.DeepEqual(hello.SupportedVersions[1:], wantVersions) { + t.Fatalf("unexpected supported versions: %x", hello.SupportedVersions) + } + for _, ext := range conn.Extensions { + if alps, ok := ext.(*ApplicationSettingsExtensionNew); ok && reflect.DeepEqual(alps.SupportedProtocols, []string{"h2"}) { + return + } + } + t.Fatal("missing new ALPS codepoint for h2") +}