def _inject_ccs(self, record, hello_message_index):
        version = record.version

        ccs = TlsRecord(
            TlsRecord.CONTENT_TYPE.CHANGE_CIPHER_SPEC,
            version,
            [tls.types.ChangeCipherSpec(1)])

        rec = TlsRecord(
            TlsRecord.CONTENT_TYPE.HANDSHAKE,
            version,
            record.messages[:hello_message_index + 1])

        # Split the record if there are more messages after the ServerHello.
        remaining = record.messages[hello_message_index + 1:]
        if remaining:
            rest = TlsRecord(
                TlsRecord.CONTENT_TYPE.HANDSHAKE,
                version,
                remaining).to_bytes()
        else:
            rest = ""

        return rec.to_bytes() + ccs.to_bytes() + rest
Inject an early CCS while preserving the rest of the data.
dataset/ETHPy150Open google/nogotofail/nogotofail/mitm/connection/handlers/connection/ccs.py/EarlyCCS._inject_ccs