replace urllib3's default cipher list with Firefox's (#342)

Avoids Cloudflare CAPTCHAs on both Linux in Windows without
pyOpenSSL installed.
This commit is contained in:
Mike Fährmann
2019-07-18 19:42:13 +02:00
parent feb98cf196
commit 84f4d3bc0b

View File

@@ -432,23 +432,23 @@ def generate_extractors(extractor_data, symtable, classes):
http.cookiejar.MozillaCookieJar.magic_re = re.compile( http.cookiejar.MozillaCookieJar.magic_re = re.compile(
"#( Netscape)? HTTP Cookie File", re.IGNORECASE) "#( Netscape)? HTTP Cookie File", re.IGNORECASE)
# Update default cipher list of urllib3 to avoid Cloudflare CAPTCHAs # Replace default cipher list of urllib3
# List taken from urllib3 1.25: # with the one used by Firefox to avoid Cloudflare CAPTCHAs
# https://github.com/urllib3/urllib3/blob/1.25/src/urllib3/util/ssl_.py
from requests.packages.urllib3.util import ssl_ # noqa from requests.packages.urllib3.util import ssl_ # noqa
ssl_.DEFAULT_CIPHERS = ( ssl_.DEFAULT_CIPHERS = (
"ECDHE+AESGCM:" "ECDHE-ECDSA-AES128-GCM-SHA256:"
"ECDHE+CHACHA20:" "ECDHE-RSA-AES128-GCM-SHA256:"
"DHE+AESGCM:" "ECDHE-ECDSA-CHACHA20-POLY1305:"
"DHE+CHACHA20:" "ECDHE-RSA-CHACHA20-POLY1305:"
"ECDH+AESGCM:" "ECDHE-ECDSA-AES256-GCM-SHA384:"
"DH+AESGCM:" "ECDHE-RSA-AES256-GCM-SHA384:"
"ECDH+AES:" "ECDHE-ECDSA-AES256-SHA:"
"DH+AES:" "ECDHE-ECDSA-AES128-SHA:"
"RSA+AESGCM:" "ECDHE-RSA-AES128-SHA:"
"RSA+AES:" "ECDHE-RSA-AES256-SHA:"
"!aNULL:" "DHE-RSA-AES128-SHA:"
"!eNULL:" "DHE-RSA-AES256-SHA:"
"!MD5:" "AES128-SHA:"
"!DSS" "AES256-SHA:"
"DES-CBC3-SHA"
) )