mirror of
https://github.com/lwthiker/curl-impersonate.git
synced 2026-09-08 18:01:53 +00:00
Add impersonation support for Firefox 102
This commit is contained in:
@@ -215,183 +215,35 @@ index 769363941..6e2f1b829 100644
|
||||
libcurlu_la_SOURCES = $(CSOURCES) $(HHEADERS)
|
||||
|
||||
CHECKSRC = $(CS_$(V))
|
||||
diff --git a/lib/Makefile.inc b/lib/Makefile.inc
|
||||
index 3e9ddec12..fb883832d 100644
|
||||
--- a/lib/Makefile.inc
|
||||
+++ b/lib/Makefile.inc
|
||||
@@ -157,6 +157,7 @@ LIB_CFILES = \
|
||||
idn_win32.c \
|
||||
if2ip.c \
|
||||
imap.c \
|
||||
+ impersonate.c \
|
||||
inet_ntop.c \
|
||||
inet_pton.c \
|
||||
krb5.c \
|
||||
diff --git a/lib/easy.c b/lib/easy.c
|
||||
index 20293a710..66730b5fc 100644
|
||||
index 20293a710..88484d5af 100644
|
||||
--- a/lib/easy.c
|
||||
+++ b/lib/easy.c
|
||||
@@ -80,6 +80,7 @@
|
||||
@@ -80,6 +80,8 @@
|
||||
#include "dynbuf.h"
|
||||
#include "altsvc.h"
|
||||
#include "hsts.h"
|
||||
+#include "strcase.h"
|
||||
+#include "impersonate.h"
|
||||
|
||||
/* The last 3 #include files should be in this order */
|
||||
#include "curl_printf.h"
|
||||
@@ -282,6 +283,237 @@ void curl_global_cleanup(void)
|
||||
@@ -282,6 +284,73 @@ void curl_global_cleanup(void)
|
||||
init_flags = 0;
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * curl-impersonate: Options to be set for each supported target browser.
|
||||
+ * Note: this does not include the HTTP headers, which are handled separately
|
||||
+ * in Curl_http().
|
||||
+ */
|
||||
+#define IMPERSONATE_MAX_HEADERS 32
|
||||
+static const struct impersonate_opts {
|
||||
+ const char *target;
|
||||
+ int httpversion;
|
||||
+ int ssl_version;
|
||||
+ const char *ciphers;
|
||||
+ const char *http_headers[IMPERSONATE_MAX_HEADERS];
|
||||
+ /* Other TLS options will come here in the future once they are
|
||||
+ * configurable through curl_easy_setopt() */
|
||||
+} impersonations[] = {
|
||||
+ {
|
||||
+ .target = "ff91esr",
|
||||
+ .httpversion = CURL_HTTP_VERSION_2_0,
|
||||
+ .ssl_version = CURL_SSLVERSION_TLSv1_2 | CURL_SSLVERSION_MAX_DEFAULT,
|
||||
+ .ciphers =
|
||||
+ "aes_128_gcm_sha_256,"
|
||||
+ "chacha20_poly1305_sha_256,"
|
||||
+ "aes_256_gcm_sha_384,"
|
||||
+ "ecdhe_ecdsa_aes_128_gcm_sha_256,"
|
||||
+ "ecdhe_rsa_aes_128_gcm_sha_256,"
|
||||
+ "ecdhe_ecdsa_chacha20_poly1305_sha_256,"
|
||||
+ "ecdhe_rsa_chacha20_poly1305_sha_256,"
|
||||
+ "ecdhe_ecdsa_aes_256_gcm_sha_384,"
|
||||
+ "ecdhe_rsa_aes_256_gcm_sha_384,"
|
||||
+ "ecdhe_ecdsa_aes_256_sha,"
|
||||
+ "ecdhe_ecdsa_aes_128_sha,"
|
||||
+ "ecdhe_rsa_aes_128_sha,"
|
||||
+ "ecdhe_rsa_aes_256_sha,"
|
||||
+ "rsa_aes_128_gcm_sha_256,"
|
||||
+ "rsa_aes_256_gcm_sha_384,"
|
||||
+ "rsa_aes_128_sha,"
|
||||
+ "rsa_aes_256_sha,"
|
||||
+ "rsa_3des_ede_cbc_sha",
|
||||
+ .http_headers = {
|
||||
+ "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0",
|
||||
+ "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
|
||||
+ "Accept-Language: en-US,en;q=0.5",
|
||||
+ "Accept-Encoding: gzip, deflate, br",
|
||||
+ "Upgrade-Insecure-Requests: 1",
|
||||
+ "Sec-Fetch-Dest: document",
|
||||
+ "Sec-Fetch-Mode: navigate",
|
||||
+ "Sec-Fetch-Site: none",
|
||||
+ "Sec-Fetch-User: ?1",
|
||||
+ "TE: Trailers"
|
||||
+ }
|
||||
+ },
|
||||
+ {
|
||||
+ .target = "ff95",
|
||||
+ .httpversion = CURL_HTTP_VERSION_2_0,
|
||||
+ .ssl_version = CURL_SSLVERSION_TLSv1_2 | CURL_SSLVERSION_MAX_DEFAULT,
|
||||
+ .ciphers =
|
||||
+ "aes_128_gcm_sha_256,"
|
||||
+ "chacha20_poly1305_sha_256,"
|
||||
+ "aes_256_gcm_sha_384,"
|
||||
+ "ecdhe_ecdsa_aes_128_gcm_sha_256,"
|
||||
+ "ecdhe_rsa_aes_128_gcm_sha_256,"
|
||||
+ "ecdhe_ecdsa_chacha20_poly1305_sha_256,"
|
||||
+ "ecdhe_rsa_chacha20_poly1305_sha_256,"
|
||||
+ "ecdhe_ecdsa_aes_256_gcm_sha_384,"
|
||||
+ "ecdhe_rsa_aes_256_gcm_sha_384,"
|
||||
+ "ecdhe_ecdsa_aes_256_sha,"
|
||||
+ "ecdhe_ecdsa_aes_128_sha,"
|
||||
+ "ecdhe_rsa_aes_128_sha,"
|
||||
+ "ecdhe_rsa_aes_256_sha,"
|
||||
+ "rsa_aes_128_gcm_sha_256,"
|
||||
+ "rsa_aes_256_gcm_sha_384,"
|
||||
+ "rsa_aes_128_sha,"
|
||||
+ "rsa_aes_256_sha",
|
||||
+ .http_headers = {
|
||||
+ "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:95.0) Gecko/20100101 Firefox/95.0",
|
||||
+ "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
|
||||
+ "Accept-Language: en-US,en;q=0.5",
|
||||
+ "Accept-Encoding: gzip, deflate, br",
|
||||
+ "Upgrade-Insecure-Requests: 1",
|
||||
+ "Sec-Fetch-Dest: document",
|
||||
+ "Sec-Fetch-Mode: navigate",
|
||||
+ "Sec-Fetch-Site: none",
|
||||
+ "Sec-Fetch-User: ?1",
|
||||
+ "TE: Trailers"
|
||||
+ }
|
||||
+ },
|
||||
+ {
|
||||
+ .target = "ff98",
|
||||
+ .httpversion = CURL_HTTP_VERSION_2_0,
|
||||
+ .ssl_version = CURL_SSLVERSION_TLSv1_2 | CURL_SSLVERSION_MAX_DEFAULT,
|
||||
+ .ciphers =
|
||||
+ "aes_128_gcm_sha_256,"
|
||||
+ "chacha20_poly1305_sha_256,"
|
||||
+ "aes_256_gcm_sha_384,"
|
||||
+ "ecdhe_ecdsa_aes_128_gcm_sha_256,"
|
||||
+ "ecdhe_rsa_aes_128_gcm_sha_256,"
|
||||
+ "ecdhe_ecdsa_chacha20_poly1305_sha_256,"
|
||||
+ "ecdhe_rsa_chacha20_poly1305_sha_256,"
|
||||
+ "ecdhe_ecdsa_aes_256_gcm_sha_384,"
|
||||
+ "ecdhe_rsa_aes_256_gcm_sha_384,"
|
||||
+ "ecdhe_ecdsa_aes_256_sha,"
|
||||
+ "ecdhe_ecdsa_aes_128_sha,"
|
||||
+ "ecdhe_rsa_aes_128_sha,"
|
||||
+ "ecdhe_rsa_aes_256_sha,"
|
||||
+ "rsa_aes_128_gcm_sha_256,"
|
||||
+ "rsa_aes_256_gcm_sha_384,"
|
||||
+ "rsa_aes_128_sha,"
|
||||
+ "rsa_aes_256_sha",
|
||||
+ .http_headers = {
|
||||
+ "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:98.0) Gecko/20100101 Firefox/98.0",
|
||||
+ "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
|
||||
+ "Accept-Language: en-US,en;q=0.5",
|
||||
+ "Accept-Encoding: gzip, deflate, br",
|
||||
+ "Upgrade-Insecure-Requests: 1",
|
||||
+ "Sec-Fetch-Dest: document",
|
||||
+ "Sec-Fetch-Mode: navigate",
|
||||
+ "Sec-Fetch-Site: none",
|
||||
+ "Sec-Fetch-User: ?1",
|
||||
+ "TE: Trailers"
|
||||
+ }
|
||||
+ },
|
||||
+ {
|
||||
+ .target = "ff100",
|
||||
+ .httpversion = CURL_HTTP_VERSION_2_0,
|
||||
+ .ssl_version = CURL_SSLVERSION_TLSv1_2 | CURL_SSLVERSION_MAX_DEFAULT,
|
||||
+ .ciphers =
|
||||
+ "aes_128_gcm_sha_256,"
|
||||
+ "chacha20_poly1305_sha_256,"
|
||||
+ "aes_256_gcm_sha_384,"
|
||||
+ "ecdhe_ecdsa_aes_128_gcm_sha_256,"
|
||||
+ "ecdhe_rsa_aes_128_gcm_sha_256,"
|
||||
+ "ecdhe_ecdsa_chacha20_poly1305_sha_256,"
|
||||
+ "ecdhe_rsa_chacha20_poly1305_sha_256,"
|
||||
+ "ecdhe_ecdsa_aes_256_gcm_sha_384,"
|
||||
+ "ecdhe_rsa_aes_256_gcm_sha_384,"
|
||||
+ "ecdhe_ecdsa_aes_256_sha,"
|
||||
+ "ecdhe_ecdsa_aes_128_sha,"
|
||||
+ "ecdhe_rsa_aes_128_sha,"
|
||||
+ "ecdhe_rsa_aes_256_sha,"
|
||||
+ "rsa_aes_128_gcm_sha_256,"
|
||||
+ "rsa_aes_256_gcm_sha_384,"
|
||||
+ "rsa_aes_128_sha,"
|
||||
+ "rsa_aes_256_sha",
|
||||
+ .http_headers = {
|
||||
+ "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0",
|
||||
+ "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
|
||||
+ "Accept-Language: en-US,en;q=0.5",
|
||||
+ "Accept-Encoding: gzip, deflate, br",
|
||||
+ "Upgrade-Insecure-Requests: 1",
|
||||
+ "Sec-Fetch-Dest: document",
|
||||
+ "Sec-Fetch-Mode: navigate",
|
||||
+ "Sec-Fetch-Site: none",
|
||||
+ "Sec-Fetch-User: ?1",
|
||||
+ "TE: Trailers"
|
||||
+ }
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+#define NUM_IMPERSONATIONS \
|
||||
+ sizeof(impersonations) / sizeof(impersonations[0])
|
||||
+
|
||||
+/*
|
||||
+ * curl-impersonate:
|
||||
+ * Call curl_easy_setopt() with all the needed options as defined in the
|
||||
@@ -401,19 +253,16 @@ index 20293a710..66730b5fc 100644
|
||||
+{
|
||||
+ int i;
|
||||
+ int ret;
|
||||
+ const struct impersonate_opts *opts = NULL;
|
||||
+ const struct impersonate_opts *opts;
|
||||
+ struct curl_slist *headers = NULL;
|
||||
+
|
||||
+ for(i = 0; i < NUM_IMPERSONATIONS; i++) {
|
||||
+ if (Curl_strncasecompare(target,
|
||||
+ impersonations[i].target,
|
||||
+ strlen(impersonations[i].target))) {
|
||||
+ opts = &impersonations[i];
|
||||
+ for (opts = impersonations; opts->target != NULL; opts++) {
|
||||
+ if (Curl_strncasecompare(target, opts->target, strlen(opts->target))) {
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if(!opts) {
|
||||
+ if(opts->target == NULL) {
|
||||
+ DEBUGF(fprintf(stderr, "Error: unknown impersonation target '%s'\n",
|
||||
+ target));
|
||||
+ return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
@@ -465,7 +314,7 @@ index 20293a710..66730b5fc 100644
|
||||
/*
|
||||
* curl_easy_init() is the external interface to alloc, setup and init an
|
||||
* easy handle that is returned. If anything goes wrong, NULL is returned.
|
||||
@@ -290,6 +522,7 @@ struct Curl_easy *curl_easy_init(void)
|
||||
@@ -290,6 +359,7 @@ struct Curl_easy *curl_easy_init(void)
|
||||
{
|
||||
CURLcode result;
|
||||
struct Curl_easy *data;
|
||||
@@ -473,7 +322,7 @@ index 20293a710..66730b5fc 100644
|
||||
|
||||
/* Make sure we inited the global SSL stuff */
|
||||
if(!initialized) {
|
||||
@@ -308,6 +541,22 @@ struct Curl_easy *curl_easy_init(void)
|
||||
@@ -308,6 +378,22 @@ struct Curl_easy *curl_easy_init(void)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -496,7 +345,7 @@ index 20293a710..66730b5fc 100644
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -878,6 +1127,13 @@ struct Curl_easy *curl_easy_duphandle(struct Curl_easy *data)
|
||||
@@ -878,6 +964,13 @@ struct Curl_easy *curl_easy_duphandle(struct Curl_easy *data)
|
||||
outcurl->state.referer_alloc = TRUE;
|
||||
}
|
||||
|
||||
@@ -510,7 +359,7 @@ index 20293a710..66730b5fc 100644
|
||||
/* Reinitialize an SSL engine for the new handle
|
||||
* note: the engine name has already been copied by dupset */
|
||||
if(outcurl->set.str[STRING_SSL_ENGINE]) {
|
||||
@@ -967,6 +1223,8 @@ struct Curl_easy *curl_easy_duphandle(struct Curl_easy *data)
|
||||
@@ -967,6 +1060,8 @@ struct Curl_easy *curl_easy_duphandle(struct Curl_easy *data)
|
||||
*/
|
||||
void curl_easy_reset(struct Curl_easy *data)
|
||||
{
|
||||
@@ -519,7 +368,7 @@ index 20293a710..66730b5fc 100644
|
||||
Curl_free_request_state(data);
|
||||
|
||||
/* zero out UserDefined data: */
|
||||
@@ -991,6 +1249,12 @@ void curl_easy_reset(struct Curl_easy *data)
|
||||
@@ -991,6 +1086,12 @@ void curl_easy_reset(struct Curl_easy *data)
|
||||
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_CRYPTO_AUTH)
|
||||
Curl_http_auth_cleanup_digest(data);
|
||||
#endif
|
||||
@@ -899,6 +748,229 @@ index e74400a4c..1dd2593a5 100644
|
||||
/* we are going to copy mem to httpc->inbuf. This is required since
|
||||
mem is part of buffer pointed by stream->mem, and callbacks
|
||||
called by nghttp2_session_mem_recv() will write stream specific
|
||||
diff --git a/lib/impersonate.c b/lib/impersonate.c
|
||||
new file mode 100644
|
||||
index 000000000..086fb383a
|
||||
--- /dev/null
|
||||
+++ b/lib/impersonate.c
|
||||
@@ -0,0 +1,186 @@
|
||||
+#include "curl_setup.h"
|
||||
+
|
||||
+#include "impersonate.h"
|
||||
+
|
||||
+const struct impersonate_opts impersonations[] = {
|
||||
+ {
|
||||
+ .target = "ff91esr",
|
||||
+ .httpversion = CURL_HTTP_VERSION_2_0,
|
||||
+ .ssl_version = CURL_SSLVERSION_TLSv1_2 | CURL_SSLVERSION_MAX_DEFAULT,
|
||||
+ .ciphers =
|
||||
+ "aes_128_gcm_sha_256,"
|
||||
+ "chacha20_poly1305_sha_256,"
|
||||
+ "aes_256_gcm_sha_384,"
|
||||
+ "ecdhe_ecdsa_aes_128_gcm_sha_256,"
|
||||
+ "ecdhe_rsa_aes_128_gcm_sha_256,"
|
||||
+ "ecdhe_ecdsa_chacha20_poly1305_sha_256,"
|
||||
+ "ecdhe_rsa_chacha20_poly1305_sha_256,"
|
||||
+ "ecdhe_ecdsa_aes_256_gcm_sha_384,"
|
||||
+ "ecdhe_rsa_aes_256_gcm_sha_384,"
|
||||
+ "ecdhe_ecdsa_aes_256_sha,"
|
||||
+ "ecdhe_ecdsa_aes_128_sha,"
|
||||
+ "ecdhe_rsa_aes_128_sha,"
|
||||
+ "ecdhe_rsa_aes_256_sha,"
|
||||
+ "rsa_aes_128_gcm_sha_256,"
|
||||
+ "rsa_aes_256_gcm_sha_384,"
|
||||
+ "rsa_aes_128_sha,"
|
||||
+ "rsa_aes_256_sha,"
|
||||
+ "rsa_3des_ede_cbc_sha",
|
||||
+ .http_headers = {
|
||||
+ "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0",
|
||||
+ "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
|
||||
+ "Accept-Language: en-US,en;q=0.5",
|
||||
+ "Accept-Encoding: gzip, deflate, br",
|
||||
+ "Upgrade-Insecure-Requests: 1",
|
||||
+ "Sec-Fetch-Dest: document",
|
||||
+ "Sec-Fetch-Mode: navigate",
|
||||
+ "Sec-Fetch-Site: none",
|
||||
+ "Sec-Fetch-User: ?1",
|
||||
+ "TE: Trailers"
|
||||
+ }
|
||||
+ },
|
||||
+ {
|
||||
+ .target = "ff95",
|
||||
+ .httpversion = CURL_HTTP_VERSION_2_0,
|
||||
+ .ssl_version = CURL_SSLVERSION_TLSv1_2 | CURL_SSLVERSION_MAX_DEFAULT,
|
||||
+ .ciphers =
|
||||
+ "aes_128_gcm_sha_256,"
|
||||
+ "chacha20_poly1305_sha_256,"
|
||||
+ "aes_256_gcm_sha_384,"
|
||||
+ "ecdhe_ecdsa_aes_128_gcm_sha_256,"
|
||||
+ "ecdhe_rsa_aes_128_gcm_sha_256,"
|
||||
+ "ecdhe_ecdsa_chacha20_poly1305_sha_256,"
|
||||
+ "ecdhe_rsa_chacha20_poly1305_sha_256,"
|
||||
+ "ecdhe_ecdsa_aes_256_gcm_sha_384,"
|
||||
+ "ecdhe_rsa_aes_256_gcm_sha_384,"
|
||||
+ "ecdhe_ecdsa_aes_256_sha,"
|
||||
+ "ecdhe_ecdsa_aes_128_sha,"
|
||||
+ "ecdhe_rsa_aes_128_sha,"
|
||||
+ "ecdhe_rsa_aes_256_sha,"
|
||||
+ "rsa_aes_128_gcm_sha_256,"
|
||||
+ "rsa_aes_256_gcm_sha_384,"
|
||||
+ "rsa_aes_128_sha,"
|
||||
+ "rsa_aes_256_sha",
|
||||
+ .http_headers = {
|
||||
+ "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:95.0) Gecko/20100101 Firefox/95.0",
|
||||
+ "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
|
||||
+ "Accept-Language: en-US,en;q=0.5",
|
||||
+ "Accept-Encoding: gzip, deflate, br",
|
||||
+ "Upgrade-Insecure-Requests: 1",
|
||||
+ "Sec-Fetch-Dest: document",
|
||||
+ "Sec-Fetch-Mode: navigate",
|
||||
+ "Sec-Fetch-Site: none",
|
||||
+ "Sec-Fetch-User: ?1",
|
||||
+ "TE: Trailers"
|
||||
+ }
|
||||
+ },
|
||||
+ {
|
||||
+ .target = "ff98",
|
||||
+ .httpversion = CURL_HTTP_VERSION_2_0,
|
||||
+ .ssl_version = CURL_SSLVERSION_TLSv1_2 | CURL_SSLVERSION_MAX_DEFAULT,
|
||||
+ .ciphers =
|
||||
+ "aes_128_gcm_sha_256,"
|
||||
+ "chacha20_poly1305_sha_256,"
|
||||
+ "aes_256_gcm_sha_384,"
|
||||
+ "ecdhe_ecdsa_aes_128_gcm_sha_256,"
|
||||
+ "ecdhe_rsa_aes_128_gcm_sha_256,"
|
||||
+ "ecdhe_ecdsa_chacha20_poly1305_sha_256,"
|
||||
+ "ecdhe_rsa_chacha20_poly1305_sha_256,"
|
||||
+ "ecdhe_ecdsa_aes_256_gcm_sha_384,"
|
||||
+ "ecdhe_rsa_aes_256_gcm_sha_384,"
|
||||
+ "ecdhe_ecdsa_aes_256_sha,"
|
||||
+ "ecdhe_ecdsa_aes_128_sha,"
|
||||
+ "ecdhe_rsa_aes_128_sha,"
|
||||
+ "ecdhe_rsa_aes_256_sha,"
|
||||
+ "rsa_aes_128_gcm_sha_256,"
|
||||
+ "rsa_aes_256_gcm_sha_384,"
|
||||
+ "rsa_aes_128_sha,"
|
||||
+ "rsa_aes_256_sha",
|
||||
+ .http_headers = {
|
||||
+ "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:98.0) Gecko/20100101 Firefox/98.0",
|
||||
+ "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
|
||||
+ "Accept-Language: en-US,en;q=0.5",
|
||||
+ "Accept-Encoding: gzip, deflate, br",
|
||||
+ "Upgrade-Insecure-Requests: 1",
|
||||
+ "Sec-Fetch-Dest: document",
|
||||
+ "Sec-Fetch-Mode: navigate",
|
||||
+ "Sec-Fetch-Site: none",
|
||||
+ "Sec-Fetch-User: ?1",
|
||||
+ "TE: Trailers"
|
||||
+ }
|
||||
+ },
|
||||
+ {
|
||||
+ .target = "ff100",
|
||||
+ .httpversion = CURL_HTTP_VERSION_2_0,
|
||||
+ .ssl_version = CURL_SSLVERSION_TLSv1_2 | CURL_SSLVERSION_MAX_DEFAULT,
|
||||
+ .ciphers =
|
||||
+ "aes_128_gcm_sha_256,"
|
||||
+ "chacha20_poly1305_sha_256,"
|
||||
+ "aes_256_gcm_sha_384,"
|
||||
+ "ecdhe_ecdsa_aes_128_gcm_sha_256,"
|
||||
+ "ecdhe_rsa_aes_128_gcm_sha_256,"
|
||||
+ "ecdhe_ecdsa_chacha20_poly1305_sha_256,"
|
||||
+ "ecdhe_rsa_chacha20_poly1305_sha_256,"
|
||||
+ "ecdhe_ecdsa_aes_256_gcm_sha_384,"
|
||||
+ "ecdhe_rsa_aes_256_gcm_sha_384,"
|
||||
+ "ecdhe_ecdsa_aes_256_sha,"
|
||||
+ "ecdhe_ecdsa_aes_128_sha,"
|
||||
+ "ecdhe_rsa_aes_128_sha,"
|
||||
+ "ecdhe_rsa_aes_256_sha,"
|
||||
+ "rsa_aes_128_gcm_sha_256,"
|
||||
+ "rsa_aes_256_gcm_sha_384,"
|
||||
+ "rsa_aes_128_sha,"
|
||||
+ "rsa_aes_256_sha",
|
||||
+ .http_headers = {
|
||||
+ "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0",
|
||||
+ "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
|
||||
+ "Accept-Language: en-US,en;q=0.5",
|
||||
+ "Accept-Encoding: gzip, deflate, br",
|
||||
+ "Upgrade-Insecure-Requests: 1",
|
||||
+ "Sec-Fetch-Dest: document",
|
||||
+ "Sec-Fetch-Mode: navigate",
|
||||
+ "Sec-Fetch-Site: none",
|
||||
+ "Sec-Fetch-User: ?1",
|
||||
+ "TE: Trailers"
|
||||
+ }
|
||||
+ },
|
||||
+ {
|
||||
+ .target = "ff102",
|
||||
+ .httpversion = CURL_HTTP_VERSION_2_0,
|
||||
+ .ssl_version = CURL_SSLVERSION_TLSv1_2 | CURL_SSLVERSION_MAX_DEFAULT,
|
||||
+ .ciphers =
|
||||
+ "aes_128_gcm_sha_256,"
|
||||
+ "chacha20_poly1305_sha_256,"
|
||||
+ "aes_256_gcm_sha_384,"
|
||||
+ "ecdhe_ecdsa_aes_128_gcm_sha_256,"
|
||||
+ "ecdhe_rsa_aes_128_gcm_sha_256,"
|
||||
+ "ecdhe_ecdsa_chacha20_poly1305_sha_256,"
|
||||
+ "ecdhe_rsa_chacha20_poly1305_sha_256,"
|
||||
+ "ecdhe_ecdsa_aes_256_gcm_sha_384,"
|
||||
+ "ecdhe_rsa_aes_256_gcm_sha_384,"
|
||||
+ "ecdhe_ecdsa_aes_256_sha,"
|
||||
+ "ecdhe_ecdsa_aes_128_sha,"
|
||||
+ "ecdhe_rsa_aes_128_sha,"
|
||||
+ "ecdhe_rsa_aes_256_sha,"
|
||||
+ "rsa_aes_128_gcm_sha_256,"
|
||||
+ "rsa_aes_256_gcm_sha_384,"
|
||||
+ "rsa_aes_128_sha,"
|
||||
+ "rsa_aes_256_sha",
|
||||
+ .http_headers = {
|
||||
+ "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0",
|
||||
+ "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
|
||||
+ "Accept-Language: en-US,en;q=0.5",
|
||||
+ "Accept-Encoding: gzip, deflate, br",
|
||||
+ "Upgrade-Insecure-Requests: 1",
|
||||
+ "Sec-Fetch-Dest: document",
|
||||
+ "Sec-Fetch-Mode: navigate",
|
||||
+ "Sec-Fetch-Site: none",
|
||||
+ "Sec-Fetch-User: ?1",
|
||||
+ "TE: Trailers"
|
||||
+ }
|
||||
+ },
|
||||
+ {
|
||||
+ /* Last one must be NULL. */
|
||||
+ .target = NULL
|
||||
+ }
|
||||
+};
|
||||
diff --git a/lib/impersonate.h b/lib/impersonate.h
|
||||
new file mode 100644
|
||||
index 000000000..964b81f2e
|
||||
--- /dev/null
|
||||
+++ b/lib/impersonate.h
|
||||
@@ -0,0 +1,25 @@
|
||||
+#ifndef HEADER_CURL_IMPERSONATE_H
|
||||
+#define HEADER_CURL_IMPERSONATE_H
|
||||
+
|
||||
+#define IMPERSONATE_MAX_HEADERS 32
|
||||
+
|
||||
+/*
|
||||
+ * curl-impersonate: Options to be set for each supported target browser.
|
||||
+ */
|
||||
+struct impersonate_opts {
|
||||
+ const char *target;
|
||||
+ int httpversion;
|
||||
+ int ssl_version;
|
||||
+ const char *ciphers;
|
||||
+ const char *http_headers[IMPERSONATE_MAX_HEADERS];
|
||||
+ /* Other TLS options will come here in the future once they are
|
||||
+ * configurable through curl_easy_setopt() */
|
||||
+};
|
||||
+
|
||||
+/*
|
||||
+ * curl-impersonate: Global array of supported browsers and their
|
||||
+ * impersonation options.
|
||||
+ */
|
||||
+extern const struct impersonate_opts impersonations[];
|
||||
+
|
||||
+#endif /* HEADER_CURL_IMPERSONATE_H */
|
||||
diff --git a/lib/setopt.c b/lib/setopt.c
|
||||
index 599ed5d99..1baa48e70 100644
|
||||
--- a/lib/setopt.c
|
||||
|
||||
Reference in New Issue
Block a user