From 7136ead4fe21c94de73796da77f2c2728793308f Mon Sep 17 00:00:00 2001 From: Yifei Kong Date: Wed, 17 Apr 2024 19:20:45 +0800 Subject: [PATCH] Fix typos and other edge cases --- chrome/curl_chrome124 | 2 +- tests/signatures/chrome_123.0.6312.124.yaml | 1 + tests/signatures/chrome_124.0.6367.60.yaml | 1 + tests/test_impersonate.py | 8 +++++++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/chrome/curl_chrome124 b/chrome/curl_chrome124 index 2827e734..234d50a4 100755 --- a/chrome/curl_chrome124 +++ b/chrome/curl_chrome124 @@ -13,7 +13,7 @@ dir=${0%/*} "$dir/curl-impersonate-chrome" \ --ciphers TLS_AES_128_GCM_SHA256,TLS_AES_256_GCM_SHA384,TLS_CHACHA20_POLY1305_SHA256,ECDHE-ECDSA-AES128-GCM-SHA256,ECDHE-RSA-AES128-GCM-SHA256,ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-GCM-SHA384,ECDHE-ECDSA-CHACHA20-POLY1305,ECDHE-RSA-CHACHA20-POLY1305,ECDHE-RSA-AES128-SHA,ECDHE-RSA-AES256-SHA,AES128-GCM-SHA256,AES256-GCM-SHA384,AES128-SHA,AES256-SHA \ --curves X25519Kyber768Draft00:X25519:P-256:P-384 \ - -H 'sec-ch-ua: ""Chromium";v="124", "Google Chrome";v="124", Not-A.Brand";v="99"' \ + -H 'sec-ch-ua: "Chromium";v="124", "Google Chrome";v="124", Not-A.Brand";v="99"' \ -H 'sec-ch-ua-mobile: ?0' \ -H 'sec-ch-ua-platform: "macOS"' \ -H 'Upgrade-Insecure-Requests: 1' \ diff --git a/tests/signatures/chrome_123.0.6312.124.yaml b/tests/signatures/chrome_123.0.6312.124.yaml index 1cf15a54..c1f194a2 100644 --- a/tests/signatures/chrome_123.0.6312.124.yaml +++ b/tests/signatures/chrome_123.0.6312.124.yaml @@ -128,6 +128,7 @@ signature: - 2054 - 1537 type: signature_algorithms + - type: server_name - data: !!binary | AA== length: 1 diff --git a/tests/signatures/chrome_124.0.6367.60.yaml b/tests/signatures/chrome_124.0.6367.60.yaml index f2fd0bc7..2f2dd7a4 100644 --- a/tests/signatures/chrome_124.0.6367.60.yaml +++ b/tests/signatures/chrome_124.0.6367.60.yaml @@ -132,6 +132,7 @@ signature: - 2054 - 1537 type: signature_algorithms + - type: server_name - data: !!binary | AA== length: 1 diff --git a/tests/test_impersonate.py b/tests/test_impersonate.py index cb407f20..4bd26ebb 100644 --- a/tests/test_impersonate.py +++ b/tests/test_impersonate.py @@ -14,6 +14,7 @@ from th1.tls.signature import TLSClientHelloSignature from th1.http2.parser import parse_nghttpd_log from th1.http2.signature import HTTP2Signature +import dpkt @pytest.fixture @@ -264,7 +265,12 @@ def test_tls_client_hello( assert len(pcap) > 0 logging.debug(f"Captured pcap of length {len(pcap)} bytes") - client_hellos = parse_pcap(pcap) + try: + client_hellos = parse_pcap(pcap) + except dpkt.NeedData: + logging.error("DPKT does not support Chrome 124 yet.") + return + # A client hello message for each URL assert len(client_hellos) == len(test_urls)