def find_active_firmware(sector):
    """Returns a tuple of the active firmware's configuration"""
    for i in range(8):
        app_entry = sector[i * 32 : i * 32 + 32]
        config_flags = int.from_bytes(app_entry[0:4], "big")
        active = config_flags & 0b1 == 0b1
        if not active:
            continue
        app_address = int.from_bytes(app_entry[4 : 4 + 4], "big")
        app_size = int.from_bytes(app_entry[8 : 8 + 4], "big")
        return app_address, app_size, i
    return None, None, None