Read all TLS records that contain the initial ClientHello. Returns the raw handshake packet bytes, without TLS record headers.
(data: bytes)
| 55 | |
| 56 | |
| 57 | def 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 | |
| 72 | def parse_client_hello(data: bytes) -> ClientHello | None: |
no test coverage detected
searching dependent graphs…