Dadoum / pyprovision

Python bindings to [Provision](https://github.com/Dadoum/Provision)
Other
13 stars 1 forks source link

This action could not be completed due to possible environment mismatch. #9

Open hkfuertes opened 4 months ago

hkfuertes commented 4 months ago

I'm trying to implement a Provision LocalAnisetteProvider for the Findmy.py project, following a comment you posted on that project.

Based on your example and the stub that they created on their repo I came up with this:

class LocalAnisetteProvider(BaseAnisetteProvider):
    """Anisette provider. Generates headers without a remote server using pyprovision."""

    def __init__(self, libary_path, provisioning_path, device_json_path):
        self.adi = ADI(libary_path)
        self.adi.provisioning_path = provisioning_path
        self.device = Device(device_json_path)
        if not self.device.initialized:
            # Pretend to be a MacBook Pro
            self.device.server_friendly_description = "<MacBookPro13,2> <macOS;13.1;22C65> <com.apple.AuthKit/1 (com.apple.dt.Xcode/3594.4.19)>"
            self.device.unique_device_identifier = str(uuid.uuid4()).upper()
            self.device.adi_identifier = secrets.token_hex(8).lower()
            self.device.local_user_uuid = secrets.token_hex(32).upper()
        self.adi.identifier = self.device.adi_identifier
        self.dsid = c_ulonglong(-2).value
        self.provisioning_session = ProvisioningSession(self.adi, self.device)
        self.provisioning_session.provision(self.dsid)
        self.otpObj = self.adi.request_otp(self.dsid)

    @property
    @override
    def otp(self) -> str:
        return self.otpObj.one_time_password

    @property
    @override
    def machine(self) -> str:
        return self.otpObj.machine_identifier

    @override
    async def close(self) -> None:
        """See `BaseAnisetteProvider.close`_."""

But I'm getting the following error, and I don't know if it is your end, or theirs:

findmy.errors.InvalidCredentialsError: Password authentication failed: This action could not be completed due to possible environment mismatch.

Could you point me in the right direction?

For context, the libs (*.so) that I took from the apk are the ones for my arch (x86_64), and I'm running Linux Mint.