Skip to content

Commit

Permalink
added ios safari 17 browser profile;
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdanfinn committed Apr 10, 2024
1 parent 269c53c commit bc3e215
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
21 changes: 21 additions & 0 deletions profiles/internal_browser_profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,27 @@ var Safari_Ipad_15_6 = ClientProfile{
connectionFlow: 10485760,
}

var Safari_IOS_17_0 = ClientProfile{
clientHelloId: tls.HelloIOS_16_0,
settings: map[http2.SettingID]uint32{
http2.SettingEnablePush: 0,
http2.SettingInitialWindowSize: 2097152,
http2.SettingMaxConcurrentStreams: 100,
},
settingsOrder: []http2.SettingID{
http2.SettingEnablePush,
http2.SettingInitialWindowSize,
http2.SettingMaxConcurrentStreams,
},
pseudoHeaderOrder: []string{
":method",
":scheme",
":path",
":authority",
},
connectionFlow: 10485760,
}

var Safari_IOS_16_0 = ClientProfile{
clientHelloId: tls.HelloIOS_16_0,
settings: map[http2.SettingID]uint32{
Expand Down
1 change: 1 addition & 0 deletions profiles/profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var MappedTLSClients = map[string]ClientProfile{
"safari_ios_15_5": Safari_IOS_15_5,
"safari_ios_15_6": Safari_IOS_15_6,
"safari_ios_16_0": Safari_IOS_16_0,
"safari_ios_17_0": Safari_IOS_17_0,
"firefox_102": Firefox_102,
"firefox_104": Firefox_104,
"firefox_105": Firefox_105,
Expand Down
27 changes: 27 additions & 0 deletions tests/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ func TestClients(t *testing.T) {
time.Sleep(2 * time.Second)
t.Log("testing opera 91")
opera_91(t)
t.Log("testing safari ios 17")
safariIos17(t)
}

func TestCustomClients(t *testing.T) {
Expand Down Expand Up @@ -634,6 +636,31 @@ func opera_91(t *testing.T) {
compareResponse(t, "opera", clientFingerprints[opera][tls.HelloOpera_91.Str()], resp)
}

func safariIos17(t *testing.T) {
options := []tls_client.HttpClientOption{
tls_client.WithClientProfile(profiles.Safari_IOS_17_0),
}

client, err := tls_client.NewHttpClient(nil, options...)
if err != nil {
t.Fatal(err)
}

req, err := http.NewRequest(http.MethodGet, peetApiEndpoint, nil)
if err != nil {
t.Fatal(err)
}

req.Header = defaultHeader

resp, err := client.Do(req)
if err != nil {
t.Fatal(err)
}

compareResponse(t, "safari_IOS", clientFingerprints[safariIos][profiles.Safari_IOS_17_0.GetClientHelloStr()], resp)
}

func compareResponse(t *testing.T, clientName string, expectedValues map[string]string, resp *http.Response) {
defer resp.Body.Close()

Expand Down
6 changes: 6 additions & 0 deletions tests/client_test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,12 @@ var clientFingerprints = map[string]map[string]map[string]string{
akamaiFingerprint: "4:2097152,3:100|10485760|0|m,s,p,a",
akamaiFingerprintHash: "8fe3e4ae51fb38d5c5108eabbf2a123c",
},
profiles.Safari_IOS_17_0.GetClientHelloStr(): map[string]string{
ja3String: "771,4865-4866-4867-49196-49195-52393-49200-49199-52392-49162-49161-49172-49171-157-156-53-47-49160-49170-10,0-23-65281-10-11-16-5-13-18-51-45-43-27-21,29-23-24-25,0",
ja3Hash: "773906b0efdefa24a7f2b8eb6985bf37",
akamaiFingerprint: "2:0,4:2097152,3:100|10485760|0|m,s,p,a",
akamaiFingerprintHash: "44e2112c513fdb93cd12e6ccd1b9dce5",
},
},
okhttpAndroid: {
profiles.Okhttp4Android13.GetClientHelloStr(): map[string]string{
Expand Down

0 comments on commit bc3e215

Please sign in to comment.