libimobiledevice-win32 / imobiledevice-net

.NET (C#, VB.NET,...) bindings for libimobiledevice
GNU Lesser General Public License v2.1
307 stars 76 forks source link

[QUESTION] Example of performing a "Factory data reset" ? or flashing a IPSW file?? #159

Open WHots opened 4 years ago

WHots commented 4 years ago

var idevice = LibiMobileDevice.Instance.iDevice;

iDeviceHandle devicehandle = null;

idevice.idevice_new(out devicehandle,null);

/* Restore setup */

var restoredevice = LibiMobileDevice.Instance.Restore;

RestoreClientHandle restoreClientHandle;

restoredevice.restored_client_new((iDeviceHandle)idevice, out restoreClientHandle, "MYAPP"); restoredevice.restored_start_restore(restoreClientHandle, null, 1);

I assume something like this? but im getting a casting error at (iDeviceHandle)idevice

Hunnah commented 4 years ago

restoredevice.restored_start_restore(restoreClientHandle, null, 1) RestoreError restored_start_restore(RestoreClientHandle client, PlistHandle options, ulong version) options参数不能为NULL

WHots commented 4 years ago

They options needs to be NULL? Or have a value, if so idk how to get that variable

fsinnes commented 3 years ago

@Adderally did you figure this out? If so I would love some assistance

WHots commented 3 years ago

@fsinnes i have not. From what I've gathered through time is it isn't possible without a firmware file ...

Also through some brief tinkering I was able to reverse a binary which did this, it only made calls to "idevicebackup.exe"

My guess is that they are doing a backup / restore trick, maybe creating a backup and modify that file too basically be "fresh" and just restore it.

fsinnes commented 3 years ago

@Adderally I am very surprised I received a response on this repo, seems near dead. Ok I see what you are saying. I assume you, like myself, are trying to develop an app that can grab all information from a device including wiping it and such. I cant seem to find enough info on this repo to use it well. You happen to figure out how I can tell if a device is iCloud locked? Did you also find out what you needed in the options variable? The above comment mentioned it couldnt be null.

WHots commented 3 years ago

@fsinnes Correct. This library as far as documentation goes is a bit dated & broken...

Only things I have not been able to figure out is how to factory reset without a firmware & skipping setup wizard... which my guess is to just edit all the PurpleBuddy key values

-q com.apple.mobile.chaperone -k DeviceIsChaperoned will return true if MDM is active

-q com.apple.fmip -k IsAssociated will return if their is an Apple ID essentially.... but if the device was previously associated with an ID and factory reset, the result will be false.. even though it's still there during the setup.

fsinnes commented 3 years ago

@Adderally thanks for all the info

oddly I get WARNING: Sending query with unknown domain "com.apple.fmip". when I try the second one, but yes I do get False on a locked device.