From 51b2482dec4de5135b562d44bd9ae18ef5d283a7 Mon Sep 17 00:00:00 2001 From: Alexander Bersenev Date: Mon, 27 Feb 2023 00:40:25 +0500 Subject: [PATCH] support domains which send several tls records, but print warning --- mtprotoproxy.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mtprotoproxy.py b/mtprotoproxy.py index 1ed3728..3d4ca02 100755 --- a/mtprotoproxy.py +++ b/mtprotoproxy.py @@ -1925,6 +1925,16 @@ async def get_encrypted_cert(host, port, server_name): if record3_type != 23: return b"" + if len(record3) < MIN_CERT_LEN: + record4_type, record4 = await get_tls_record(reader) + if record4_type != 23: + return b"" + msg = ("The MASK_HOST %s sent some TLS record before certificate record, this makes the " + + "proxy more detectable") % config.MASK_HOST + print_err(msg) + + return record4 + return record3