doronz88 / pymobiledevice3

Pure python3 implementation for working with iDevices (iPhone, etc...).
https://discord.gg/52mZGC3JXJ
GNU General Public License v3.0
1.34k stars 185 forks source link

Missing lockdown errors #708

Open vToMy opened 9 months ago

vToMy commented 9 months ago

There are some common lockdown errors that would be nice to have a dedicated exception class: https://github.com/doronz88/pymobiledevice3/blob/3a6113091c59c65f4db5d318e126c09f197a994c/pymobiledevice3/lockdown.py#L532

The list is here: https://github.com/libimobiledevice/libimobiledevice/blob/04c023317f616b4b9588cce8c2da3174a7d2086b/src/lockdown.c#L57

Specificly I've encountered the following that would be helpful, if you don't want to add all of them: PasscodeRequired - device doesn't have passcode, and the command requires to set it first (this one is actually missing from libimobiledevice) MCProtected - mdm blocking the command SessionActive - usually when trying to verify pairing twice

doronz88 commented 9 months ago

Just making sure, currently we already handle the PasscodeRequire error explicitly using PasscodeRequiredError. What you are suggesting is adding to the following map, correct?

https://github.com/doronz88/pymobiledevice3/blob/3a6113091c59c65f4db5d318e126c09f197a994c/pymobiledevice3/lockdown.py#L532-L539

vToMy commented 9 months ago

It seems this exception is unused though? I don't see any handling

vToMy commented 9 months ago

Ah, you have the DeviceHasPasscodeSetError I recommend removing it and just catching the proper exception instead of testing for message error.