From 9303ce340f212ba92c00bdfd2f7c1380f1d069d7 Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Mon, 17 Jul 2023 03:37:06 -0400 Subject: [PATCH 1/4] Cross-compile armv7l binaries for 32-bit Raspberry Pi's (#167) Build arm binaries for 32-bit architecture. Use patch based on https://github.com/curl/curl/pull/9054. --- .github/workflows/build-and-test-make.yml | 15 ++++++++++----- Makefile.in | 1 + chrome/patches/curl-impersonate.patch | 14 ++++++++++++++ firefox/patches/curl-impersonate.patch | 17 ++++++++++++++++- 4 files changed, 41 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-and-test-make.yml b/.github/workflows/build-and-test-make.yml index 7bda8eb..80dc1a1 100644 --- a/.github/workflows/build-and-test-make.yml +++ b/.github/workflows/build-and-test-make.yml @@ -33,6 +33,11 @@ jobs: host: aarch64-linux-gnu capture_interface: eth0 make: make + - os: ubuntu-20.04 + arch: arm + host: arm-linux-gnueabihf + capture_interface: eth0 + make: make - os: macos-11 arch: x86_64 host: x86_64-macos @@ -55,10 +60,10 @@ jobs: # More dependencies for the tests sudo apt-get install tcpdump nghttp2-server libnss3 - - name: Install Ubuntu dependencies (aarch64) - if: matrix.arch == 'aarch64' + - name: Install Ubuntu cross-compile dependencies (${{ matrix.arch }}) + if: matrix.os == 'ubuntu-20.04' && matrix.arch != 'x86_64' run: | - sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu + sudo apt-get install gcc-${{ matrix.host }} g++-${{ matrix.host }} - name: Install macOS dependencies if: matrix.os == 'macos-11' @@ -177,7 +182,7 @@ jobs: ${{ matrix.make }} firefox-build ${{ matrix.make }} firefox-checkbuild ${{ matrix.make }} firefox-install - + - name: Prepare the tests if: matrix.arch == 'x86_64' run: | @@ -250,4 +255,4 @@ jobs: with: files: | ${{ env.release_file_lib }} - ${{ env.release_file_bin }} + ${{ env.release_file_bin }} \ No newline at end of file diff --git a/Makefile.in b/Makefile.in index 203b281..d54f34f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -225,6 +225,7 @@ else ;; \ *) \ use_64="0"; \ + nspr_configure_flags=""; \ ;; \ esac diff --git a/chrome/patches/curl-impersonate.patch b/chrome/patches/curl-impersonate.patch index fd3bbf1..1c5bdb5 100644 --- a/chrome/patches/curl-impersonate.patch +++ b/chrome/patches/curl-impersonate.patch @@ -2485,3 +2485,17 @@ index 5ff86c7f5..be26f91ea 100644 NV1(CURLOPT_TCP_NODELAY, 1), NV1(CURLOPT_PROXY_SSL_VERIFYPEER, 1), NV1(CURLOPT_PROXY_SSL_VERIFYHOST, 1), +diff --git a/lib/easy_lock.h b/lib/easy_lock.h +index 819f50ce8..1f54289ce 100644 +--- a/lib/easy_lock.h ++++ b/lib/easy_lock.h +@@ -36,6 +36,9 @@ + + #elif defined (HAVE_ATOMIC) + #include ++#if defined(HAVE_SCHED_YIELD) ++#include ++#endif + + #define curl_simple_lock atomic_bool + #define CURL_SIMPLE_LOCK_INIT false diff --git a/firefox/patches/curl-impersonate.patch b/firefox/patches/curl-impersonate.patch index e382475..444f1e0 100644 --- a/firefox/patches/curl-impersonate.patch +++ b/firefox/patches/curl-impersonate.patch @@ -1354,7 +1354,7 @@ index cb162755d..13ee571aa 100644 + + case $host_cpu in + arm) -+ addlib="$addlib -larmv8_c_lib" ++ addlib="$addlib -larmv8_c_lib -l:libgcm-aes-arm32-neon_c_lib.a" + ;; + aarch64) + addlib="$addlib -larmv8_c_lib -lgcm-aes-aarch64_c_lib" @@ -1498,3 +1498,18 @@ index 706f0aac3..0ad94622e 100644 endif # if unit tests are enabled, build a static library to link them with +diff --git a/lib/easy_lock.h b/lib/easy_lock.h +index 819f50ce8..1f54289ce 100644 +--- a/lib/easy_lock.h ++++ b/lib/easy_lock.h +@@ -36,6 +36,9 @@ + + #elif defined (HAVE_ATOMIC) + #include ++#if defined(HAVE_SCHED_YIELD) ++#include ++#endif + + #define curl_simple_lock atomic_bool + #define CURL_SIMPLE_LOCK_INIT false + From d1d9264f55702010080ce44fe1a4c8dee641c54a Mon Sep 17 00:00:00 2001 From: Nico Kokonas Date: Thu, 10 Aug 2023 05:08:36 -0600 Subject: [PATCH 2/4] Fix typos in usage docs (#152) --- docs/02_USAGE.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/02_USAGE.md b/docs/02_USAGE.md index e93fb98..45f8c75 100644 --- a/docs/02_USAGE.md +++ b/docs/02_USAGE.md @@ -5,12 +5,12 @@ Since it is just a modified curl build, all the original flags and command line For example, the Firefox version can be run as follows: ```bash -curl-impersonate-ff -v -L httsp://wikipedia.org +curl-impersonate-ff -v -L https://wikipedia.org ``` and the Chrome version: ```bash -curl-impersonate-chrome -v -L httsp://wikipedia.org +curl-impersonate-chrome -v -L https://wikipedia.org ``` However, by default, running the binaries as above will not prdouce the same TLS and HTTP/2 signatures as the impersonated browsers. Rather, this project provides additional *wrapper scripts* that launch these binaries with the correct set of command line flags to produce the desired signatures. For example: @@ -62,11 +62,11 @@ The important flags are as follows: * `--tlsv1.2` sets the minimal TLS version, which is part of the TLS client hello message, to TLS1.2. * `--no-npn` disables to NPN TLS extension. * `--alps` enables the ALPS TLS extension. This flag was added for this project. -* `--cert-compression` enables TLS certificate compression used by Chrome. This flag was added for this project. +* `--cert-compression` enables TLS certificate compression used by Chrome. This flag was added for this project. ## Flags that modify the TLS signature The following flags are known to affect the TLS signature of curl. Using them in addition to the flags in the wrapper scripts may produce a signature that does not match the browser. -`--ciphers`, `--curves`, `--no-npn`, `--no-alpn`, `--tls-max`, `--tls13-ciphers`, `--tlsv1.0`, `--tlsv1.1`, `--tlsv1.2`, `--tlsv1.3`, `--tlsv1` +`--ciphers`, `--curves`, `--no-npn`, `--no-alpn`, `--tls-max`, `--tls13-ciphers`, `--tlsv1.0`, `--tlsv1.1`, `--tlsv1.2`, `--tlsv1.3`, `--tlsv1` From c12ac8b1256fd8067848ebd2bfc55642f97bf4c5 Mon Sep 17 00:00:00 2001 From: Rasselio Diack Date: Tue, 29 Aug 2023 10:49:19 +0200 Subject: [PATCH 3/4] Update INSTALL.md for macOS steps (#172) --- INSTALL.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/INSTALL.md b/INSTALL.md index 285fcea..c8f7592 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -98,6 +98,12 @@ pip3 install gyp-next brew install go ``` +Clone this repository: +``` +git clone https://github.com/lwthiker/curl-impersonate.git +cd curl-impersonate +``` + Configure and compile: ``` mkdir build && cd build From b4c4a7374c76eb9fce30fd3952a4572bdd4b6f08 Mon Sep 17 00:00:00 2001 From: djoldman Date: Tue, 29 Aug 2023 03:49:43 -0500 Subject: [PATCH 4/4] Fix typos in 02_USAGE.md (#171)