Open yintian710 opened 5 months ago
使用同一个 tls 配置
request('get', 'https://www.baidu.com', tls_config=tls_config) 不报错
request('get', 'https://www.baidu.com', tls_config=to_tls_config(tls_config)) 报错: requests.exceptions.ConnectionError: [Errno requests_go error:] {"err": "Get "https://www.baidu.com/": unsupported Curve in KeyShareExtension: CurveID(0).To mimic it, fill the Data(key) field manually"}
更低版本未测试
tls_config 格式: {"ip":"","http_version":"h2","method":"GET","user_agent":"","tls":{"ciphers":["TLS_GREASE (0x2A2A)","TLS_AES_128_GCM_SHA256","TLS_AES_256_GCM_SHA384","TLS_CHACHA20_POLY1305_SHA256","TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256","TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256","TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384","TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384","TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256","TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256","TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA","TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA","TLS_RSA_WITH_AES_128_GCM_SHA256","TLS_RSA_WITH_AES_256_GCM_SHA384","TLS_RSA_WITH_AES_128_CBC_SHA","TLS_RSA_WITH_AES_256_CBC_SHA"],"extensions":[{"name":"TLS_GREASE (0x3a3a)"},{"name":"extensionRenegotiationInfo (boringssl) (65281)","data":"00"},{"name":"session_ticket (35)","data":""},{"name":"key_share (51)","shared_keys":[{"TLS_GREASE (0x5a5a)":"00"},{"X25519Kyber768 (25497)":""},{"X25519 (29)":""}]},{"name":"application_settings (17513)","protocols":["h2"]},{"name":"extensionEncryptedClientHello (boringssl) (65037)","data":""},{"name":"signature_algorithms (13)","signature_algorithms":["ecdsa_secp256r1_sha256","rsa_pss_rsae_sha256","rsa_pkcs1_sha256","ecdsa_secp384r1_sha384","rsa_pss_rsae_sha384","rsa_pkcs1_sha384","rsa_pss_rsae_sha512","rsa_pkcs1_sha512"]},{"name":"psk_key_exchange_modes (45)","PSK_Key_Exchange_Mode":"PSK with (EC)DHE key establishment (psk_dhe_ke) (1)"},{"name":"signed_certificate_timestamp (18)"},{"name":"server_name (0)","server_name":"tls.peet.ws"},{"name":"supported_groups (10)","supported_groups":["TLS_GREASE (0x5a5a)","X25519Kyber768 (25497)","X25519 (29)","P-256 (23)","P-384 (24)"]},{"name":"compress_certificate (27)","algorithms":["brotli (2)"]},{"name":"extended_master_secret (23)","master_secret_data":"","extended_master_secret_data":""},{"name":"application_layer_protocol_negotiation (16)","protocols":["h2","http/1.1"]},{"name":"ec_point_formats (11)","elliptic_curves_point_formats":["0x00"]},{"name":"supported_versions (43)","versions":["TLS_GREASE (0xaaaa)","TLS 1.3","TLS 1.2"]},{"name":"status_request (5)","status_request":{"certificate_status_type":"OSCP (1)","responder_id_list_length":0,"request_extensions_length":0}},{"name":"TLS_GREASE (0x8a8a)"}],"tls_version_record":"771","tls_version_negotiated":"772","ja3":"","ja3_hash":"","ja4":"","peetprint":"","peetprint_hash":"","client_random":"","session_id":""},"http2":{"akamai_fingerprint":"","akamai_fingerprint_hash":"","sent_frames":[{"frame_type":"SETTINGS","length":24,"settings":["HEADER_TABLE_SIZE = 65536","ENABLE_PUSH = 0","INITIAL_WINDOW_SIZE = 6291456","MAX_HEADER_LIST_SIZE = 262144"]},{"frame_type":"WINDOW_UPDATE","length":4,"increment":15663105},{"frame_type":"HEADERS","stream_id":1,"length":473,"headers":[":method: GET",":authority: tls.peet.ws",":scheme: https",":path: /api/all","sec-ch-ua: \\"Not/A)Brand\\";v=\\"8\\", \\"Chromium\\";v=\\"126\\", \\"Google Chrome\\";v=\\"126\", "sec-ch-ua-mobile:?0", "sec-ch-ua-platform:\\"Windows\","upgrade-insecure-requests: 1","user-agent: ","accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.7","sec-fetch-site: none","sec-fetch-mode: navigate","sec-fetch-user: ?1","sec-fetch-dest: document","accept-encoding: gzip, deflate, br, zstd","accept-language: zh-CN,zh;q=0.9,en;q=0.8,km;q=0.7","priority: u=0, i"],"flags":["EndStream (0x1)","EndHeaders (0x4)","Priority (0x20)"],"priority":{"weight":256,"depends_on":0,"exclusive":1}}]},"tcpip":{"cap_length":999,"dst_port":999,"src_port":999,"ip":{"id":999,"ttl":999,"ip_version":4,"dst_ip":"","src_ip":""},"tcp":{"ack":999,"checksum":999,"seq":999,"window":999}}}
使用同一个 tls 配置
request('get', 'https://www.baidu.com', tls_config=tls_config) 不报错
request('get', 'https://www.baidu.com', tls_config=to_tls_config(tls_config)) 报错: requests.exceptions.ConnectionError: [Errno requests_go error:] {"err": "Get "https://www.baidu.com/": unsupported Curve in KeyShareExtension: CurveID(0).To mimic it, fill the Data(key) field manually"}
更低版本未测试
tls_config 格式: {"ip":"","http_version":"h2","method":"GET","user_agent":"","tls":{"ciphers":["TLS_GREASE (0x2A2A)","TLS_AES_128_GCM_SHA256","TLS_AES_256_GCM_SHA384","TLS_CHACHA20_POLY1305_SHA256","TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256","TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256","TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384","TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384","TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256","TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256","TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA","TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA","TLS_RSA_WITH_AES_128_GCM_SHA256","TLS_RSA_WITH_AES_256_GCM_SHA384","TLS_RSA_WITH_AES_128_CBC_SHA","TLS_RSA_WITH_AES_256_CBC_SHA"],"extensions":[{"name":"TLS_GREASE (0x3a3a)"},{"name":"extensionRenegotiationInfo (boringssl) (65281)","data":"00"},{"name":"session_ticket (35)","data":""},{"name":"key_share (51)","shared_keys":[{"TLS_GREASE (0x5a5a)":"00"},{"X25519Kyber768 (25497)":""},{"X25519 (29)":""}]},{"name":"application_settings (17513)","protocols":["h2"]},{"name":"extensionEncryptedClientHello (boringssl) (65037)","data":""},{"name":"signature_algorithms (13)","signature_algorithms":["ecdsa_secp256r1_sha256","rsa_pss_rsae_sha256","rsa_pkcs1_sha256","ecdsa_secp384r1_sha384","rsa_pss_rsae_sha384","rsa_pkcs1_sha384","rsa_pss_rsae_sha512","rsa_pkcs1_sha512"]},{"name":"psk_key_exchange_modes (45)","PSK_Key_Exchange_Mode":"PSK with (EC)DHE key establishment (psk_dhe_ke) (1)"},{"name":"signed_certificate_timestamp (18)"},{"name":"server_name (0)","server_name":"tls.peet.ws"},{"name":"supported_groups (10)","supported_groups":["TLS_GREASE (0x5a5a)","X25519Kyber768 (25497)","X25519 (29)","P-256 (23)","P-384 (24)"]},{"name":"compress_certificate (27)","algorithms":["brotli (2)"]},{"name":"extended_master_secret (23)","master_secret_data":"","extended_master_secret_data":""},{"name":"application_layer_protocol_negotiation (16)","protocols":["h2","http/1.1"]},{"name":"ec_point_formats (11)","elliptic_curves_point_formats":["0x00"]},{"name":"supported_versions (43)","versions":["TLS_GREASE (0xaaaa)","TLS 1.3","TLS 1.2"]},{"name":"status_request (5)","status_request":{"certificate_status_type":"OSCP (1)","responder_id_list_length":0,"request_extensions_length":0}},{"name":"TLS_GREASE (0x8a8a)"}],"tls_version_record":"771","tls_version_negotiated":"772","ja3":"","ja3_hash":"","ja4":"","peetprint":"","peetprint_hash":"","client_random":"","session_id":""},"http2":{"akamai_fingerprint":"","akamai_fingerprint_hash":"","sent_frames":[{"frame_type":"SETTINGS","length":24,"settings":["HEADER_TABLE_SIZE = 65536","ENABLE_PUSH = 0","INITIAL_WINDOW_SIZE = 6291456","MAX_HEADER_LIST_SIZE = 262144"]},{"frame_type":"WINDOW_UPDATE","length":4,"increment":15663105},{"frame_type":"HEADERS","stream_id":1,"length":473,"headers":[":method: GET",":authority: tls.peet.ws",":scheme: https",":path: /api/all","sec-ch-ua: \\"Not/A)Brand\\";v=\\"8\\", \\"Chromium\\";v=\\"126\\", \\"Google Chrome\\";v=\\"126\", "sec-ch-ua-mobile:?0", "sec-ch-ua-platform:\\"Windows\","upgrade-insecure-requests: 1","user-agent: ","accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.7","sec-fetch-site: none","sec-fetch-mode: navigate","sec-fetch-user: ?1","sec-fetch-dest: document","accept-encoding: gzip, deflate, br, zstd","accept-language: zh-CN,zh;q=0.9,en;q=0.8,km;q=0.7","priority: u=0, i"],"flags":["EndStream (0x1)","EndHeaders (0x4)","Priority (0x20)"],"priority":{"weight":256,"depends_on":0,"exclusive":1}}]},"tcpip":{"cap_length":999,"dst_port":999,"src_port":999,"ip":{"id":999,"ttl":999,"ip_version":4,"dst_ip":"","src_ip":""},"tcp":{"ack":999,"checksum":999,"seq":999,"window":999}}}