mirror of
https://github.com/lwthiker/curl-impersonate.git
synced 2025-08-10 10:49:26 +00:00

As suggested on the Hacker News thread (https://news.ycombinator.com/item?id=30378562), add support for Firefox Extended Support Release. The required changes were adding one more cipher to the ciphers list and changing the user agent. Apart from that the TLS fingerprint is identical to Firefox 95 which was already supported.
39 lines
1.7 KiB
Bash
Executable File
39 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Find the directory of this script
|
|
dir=`echo "$0" | sed 's%/[^/]*$%%'`
|
|
|
|
PIPE=/tmp/curl-pipe
|
|
|
|
rm -f "$PIPE" && mkfifo "$PIPE"
|
|
exec 5<>"$PIPE" 3>"$PIPE" 4<"$PIPE" 5>&-
|
|
|
|
# The list of ciphers can be obtained by looking at the Client Hello message in
|
|
# Wireshark, then converting it using the cipherlist array at
|
|
# https://github.com/curl/curl/blob/master/lib/vtls/nss.c
|
|
"$dir/curl-impersonate" \
|
|
--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 \
|
|
-H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0' \
|
|
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8' \
|
|
-H 'Accept-Language: en-US,en;q=0.5' \
|
|
-H 'Accept-Encoding: gzip, deflate, br' \
|
|
-H 'Connection: keep-alive' \
|
|
-H 'Upgrade-Insecure-Requests: 1' \
|
|
-H 'Sec-Fetch-Dest: document' \
|
|
-H 'Sec-Fetch-Mode: navigate' \
|
|
-H 'Sec-Fetch-Site: none' \
|
|
-H 'Sec-Fetch-User: ?1' \
|
|
--http2 --false-start \
|
|
$@ >&3
|
|
|
|
exec 3>&-
|
|
|
|
IFS= read -d '' -r -n 2 -u 4 header
|
|
|
|
# Due to the "Accept-Encoding: gzip" header, we may receive a gzipped file.
|
|
if [ "$(echo -n $header | xxd -l 2 -p)" == "1f8b" ]; then
|
|
(printf "%s" "$header"; cat <&4) | gzip -cd;
|
|
else
|
|
printf "%s" "$header"; cat <&4;
|
|
fi
|