Skip to content

curl-impersonate: A special build of curl that can impersonate Chrome & Firefox

Add impersonation support for Safari 15.5

lwthikere5670826ba43
diff --git a/README.md b/README.md
index 0d12763..c9e0e34 100644
--- a/README.md
+++ b/README.md
@@ -40,6 +40,7 @@ The following browsers can be impersonated.
| ![Firefox](https://raw.githubusercontent.com/alrra/browser-logos/main/src/firefox/firefox_24x24.png "Firefox") | 100 | 100.0 | Windows 10 | `ff100` | [curl_ff100](firefox/curl_ff100) |
| ![Firefox](https://raw.githubusercontent.com/alrra/browser-logos/main/src/firefox/firefox_24x24.png "Firefox") | 102 | 102.0 | Windows 10 | `ff102` | [curl_ff102](firefox/curl_ff102) |
| ![Safari](https://github.com/alrra/browser-logos/blob/main/src/safari/safari_24x24.png "Safari") | 15.3 | 16612.4.9.1.8 | MacOS Big Sur | `safari15_3` | [curl_safari15_3](chrome/curl_safari15_3) |
+| ![Safari](https://github.com/alrra/browser-logos/blob/main/src/safari/safari_24x24.png "Safari") | 15.5 | 17613.2.7.1.8 | MacOS Monterey | `safari15_5` | [curl_safari15_5](chrome/curl_safari15_5) |
This list is also available in the [browsers.json](browsers.json) file.
diff --git a/browsers.json b/browsers.json
index d711075..3851aab 100644
--- a/browsers.json
+++ b/browsers.json
@@ -120,6 +120,16 @@
},
"binary": "curl-impersonate-chrome",
"wrapper_script": "curl_safari15_3"
+ },
+ {
+ "name": "safari15_5",
+ "browser": {
+ "name": "safari",
+ "version": "15.5",
+ "os": "macos12.4"
+ },
+ "binary": "curl-impersonate-chrome",
+ "wrapper_script": "curl_safari15_5"
}
]
}
diff --git a/chrome/curl_safari15_5 b/chrome/curl_safari15_5
new file mode 100755
index 0000000..61cdfb1
--- /dev/null
+++ b/chrome/curl_safari15_5
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+
+# Find the directory of this script
+dir=${0%/*}
+
+# The list of ciphers can be obtained by looking at the Client Hello message in
+# Wireshark, then converting it using this reference
+# https://wiki.mozilla.org/Security/Cipher_Suites
+"$dir/curl-impersonate-chrome" \
+ --ciphers TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256:TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256:TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384:TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256:TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256:TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA:TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA:TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA:TLS_RSA_WITH_AES_256_GCM_SHA384:TLS_RSA_WITH_AES_128_GCM_SHA256:TLS_RSA_WITH_AES_256_CBC_SHA:TLS_RSA_WITH_AES_128_CBC_SHA:TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA:TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA:TLS_RSA_WITH_3DES_EDE_CBC_SHA \
+ --curves X25519:P-256:P-384:P-521 \
+ --signature-hashes ecdsa_secp256r1_sha256,rsa_pss_rsae_sha256,rsa_pkcs1_sha256,ecdsa_secp384r1_sha384,ecdsa_sha1,rsa_pss_rsae_sha384,rsa_pss_rsae_sha384,rsa_pkcs1_sha384,rsa_pss_rsae_sha512,rsa_pkcs1_sha512,rsa_pkcs1_sha1 \
+ -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.5 Safari/605.1.15' \
+ -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' \
+ -H 'Accept-Language: en-GB,en-US;q=0.9,en;q=0.8' \
+ -H 'Accept-Encoding: gzip, deflate, br' \
+ --http2 --false-start --compressed \
+ --tlsv1.0 --no-npn --no-tls-session-ticket \
+ --cert-compression zlib \
+ --http2-pseudo-headers-order 'mspa' \
+ "$@"
diff --git a/chrome/patches/curl-impersonate.patch b/chrome/patches/curl-impersonate.patch
index 1f3e120..034cf57 100644
--- a/chrome/patches/curl-impersonate.patch
+++ b/chrome/patches/curl-impersonate.patch
@@ -947,10 +947,10 @@ index d6986d97f..fa5c90e7f 100644
* Store nghttp2 version info in this buffer.
diff --git a/lib/impersonate.c b/lib/impersonate.c
new file mode 100644
-index 000000000..10154a5bc
+index 000000000..bba3f5788
--- /dev/null
+++ b/lib/impersonate.c
-@@ -0,0 +1,306 @@
+@@ -0,0 +1,357 @@
+#include "curl_setup.h"
+
+#include "impersonate.h"
@@ -1253,6 +1253,57 @@ index 000000000..10154a5bc
+ .http2_pseudo_headers_order = "mspa"
+ },
+ {
++ .target = "safari15_5",
++ .httpversion = CURL_HTTP_VERSION_2_0,
++ .ssl_version = CURL_SSLVERSION_TLSv1_0 | CURL_SSLVERSION_MAX_DEFAULT,
++ .ciphers =
++ "TLS_AES_128_GCM_SHA256,"
++ "TLS_AES_256_GCM_SHA384,"
++ "TLS_CHACHA20_POLY1305_SHA256,"
++ "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,"
++ "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,"
++ "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,"
++ "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,"
++ "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,"
++ "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256,"
++ "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,"
++ "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,"
++ "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,"
++ "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,"
++ "TLS_RSA_WITH_AES_256_GCM_SHA384,"
++ "TLS_RSA_WITH_AES_128_GCM_SHA256,"
++ "TLS_RSA_WITH_AES_256_CBC_SHA,"
++ "TLS_RSA_WITH_AES_128_CBC_SHA,"
++ "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA,"
++ "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,"
++ "TLS_RSA_WITH_3DES_EDE_CBC_SHA",
++ .curves = "X25519:P-256:P-384:P-521",
++ .sig_hash_algs =
++ "ecdsa_secp256r1_sha256,"
++ "rsa_pss_rsae_sha256,"
++ "rsa_pkcs1_sha256,"
++ "ecdsa_secp384r1_sha384,"
++ "ecdsa_sha1,"
++ "rsa_pss_rsae_sha384,"
++ "rsa_pss_rsae_sha384,"
++ "rsa_pkcs1_sha384,"
++ "rsa_pss_rsae_sha512,"
++ "rsa_pkcs1_sha512,"
++ "rsa_pkcs1_sha1",
++ .npn = false,
++ .alpn = true,
++ .alps = false,
++ .tls_session_ticket = false,
++ .cert_compression = "zlib",
++ .http_headers = {
++ "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.5 Safari/605.1.15",
++ "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
++ "Accept-Language: en-GB,en-US;q=0.9,en;q=0.8",
++ "Accept-Encoding: gzip, deflate, br"
++ },
++ .http2_pseudo_headers_order = "mspa"
++ },
++ {
+ /* Last one must be NULL. */
+ .target = NULL
+ }
diff --git a/tests/signatures/safari.yaml b/tests/signatures/safari.yaml
index 59a33e2..6e5f2a3 100644
--- a/tests/signatures/safari.yaml
+++ b/tests/signatures/safari.yaml
@@ -82,3 +82,88 @@ signature:
- 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
- 'accept-language: en-us'
- 'accept-encoding: gzip, deflate, br'
+---
+name: safari_15.5_macos12.4
+browser:
+ name: safari
+ version: 15.5
+ os: macos12.4
+ mode: regular
+signature:
+ tls_client_hello:
+ record_version: 'TLS_VERSION_1_0'
+ handshake_version: 'TLS_VERSION_1_2'
+ session_id_length: 32
+ ciphersuites: [
+ 'GREASE',
+ 0x1301, 0x1302, 0x1303, 0xc02c, 0xc02b, 0xcca9, 0xc030, 0xc02f,
+ 0xcca8, 0xc00a, 0xc009, 0xc014, 0xc013, 0x009d, 0x009c, 0x0035,
+ 0x002f, 0xc008, 0xc012, 0x000a
+ ]
+ comp_methods: [0x00]
+ extensions:
+ - type: GREASE
+ length: 0
+ - type: server_name
+ - type: extended_master_secret
+ length: 0
+ - type: renegotiation_info
+ length: 1
+ - type: supported_groups
+ length: 12
+ supported_groups: [
+ 'GREASE',
+ 0x001d, 0x0017, 0x0018, 0x0019
+ ]
+ - type: ec_point_formats
+ length: 2
+ ec_point_formats: [0]
+ - type: application_layer_protocol_negotiation
+ length: 14
+ alpn_list: ['h2', 'http/1.1']
+ - type: status_request
+ length: 5
+ status_request_type: 0x01
+ - type: signature_algorithms
+ length: 24
+ sig_hash_algs: [
+ 0x0403, 0x0804, 0x0401, 0x0503, 0x0203, 0x0805, 0x0805,
+ 0x0501, 0x0806, 0x0601, 0x0201
+ ]
+ - type: signed_certificate_timestamp
+ length: 0
+ - type: keyshare
+ length: 43
+ key_shares:
+ - group: 'GREASE'
+ length: 1
+ - group: 29
+ length: 32
+ - type: psk_key_exchange_modes
+ length: 2
+ psk_ke_mode: 1
+ - type: supported_versions
+ length: 11
+ supported_versions: [
+ 'GREASE',
+ 'TLS_VERSION_1_3', 'TLS_VERSION_1_2',
+ 'TLS_VERSION_1_1', 'TLS_VERSION_1_0'
+ ]
+ - type: compress_certificate
+ length: 3
+ algorithms: [0x01]
+ - type: GREASE
+ length: 1
+ data: !!binary AA==
+ - type: padding
+ http2:
+ pseudo_headers:
+ - ':method'
+ - ':scheme'
+ - ':path'
+ - ':authority'
+ headers:
+ - 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.5 Safari/605.1.15'
+ - 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
+ - 'accept-language: en-GB,en-US;q=0.9,en;q=0.8'
+ - 'accept-encoding: gzip, deflate, br'
diff --git a/tests/test_impersonate.py b/tests/test_impersonate.py
index 21e4626..4624d2c 100644
--- a/tests/test_impersonate.py
+++ b/tests/test_impersonate.py
@@ -150,6 +150,7 @@ class TestImpersonation:
("curl_edge99", None, None, "edge_99.0.1150.30_win10"),
("curl_edge101", None, None, "edge_101.0.1210.47_win10"),
("curl_safari15_3", None, None, "safari_15.3_macos11.6.4"),
+ ("curl_safari15_5", None, None, "safari_15.5_macos12.4"),
("curl_ff91esr", None, None, "firefox_91.6.0esr_win10"),
("curl_ff95", None, None, "firefox_95.0.2_win10"),
("curl_ff98", None, None, "firefox_98.0_win10"),
@@ -215,6 +216,14 @@ class TestImpersonation:
"libcurl-impersonate-chrome",
"safari_15.3_macos11.6.4"
),
+ (
+ "minicurl",
+ {
+ "CURL_IMPERSONATE": "safari15_5"
+ },
+ "libcurl-impersonate-chrome",
+ "safari_15.5_macos12.4"
+ ),
(
"minicurl",
{