MCPcopy Create free account
hub / github.com/mitmproxy/mitmproxy / get_client_hello

Function get_client_hello

mitmproxy/proxy/layers/tls.py:57–69  ·  view source on GitHub ↗

Read all TLS records that contain the initial ClientHello. Returns the raw handshake packet bytes, without TLS record headers.

(data: bytes)

Source from the content-addressed store, hash-verified

55
56
57def get_client_hello(data: bytes) -> bytes | None:
58 """
59 Read all TLS records that contain the initial ClientHello.
60 Returns the raw handshake packet bytes, without TLS record headers.
61 """
62 client_hello = b""
63 for d in handshake_record_contents(data):
64 client_hello += d
65 if len(client_hello) >= 4:
66 client_hello_size = struct.unpack("!I", b"\x00" + client_hello[1:4])[0] + 4
67 if len(client_hello) >= client_hello_size:
68 return client_hello[:client_hello_size]
69 return None
70
71
72def parse_client_hello(data: bytes) -> ClientHello | None:

Callers 1

parse_client_helloFunction · 0.85

Calls 2

unpackMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…