0

I'm trying to get as much info from my iPhone using iMobileDevice and I can't find a list of supported keys to search for in libimobiledevice API or elsewhere. I know such places like here exist and are helpful but they aren't all supported when using the lockdownd_get_value(LockdownClientHandle ld, string domain, string KEY, out PListHandle value). This is how I'm using it.

ReadOnlyCollection<string> udids;
int count = 0;

var idevice = LibiMobileDevice.Instance.iDevice;
var lockdown = LibiMobileDevice.Instance.Lockdown;

var ret = idevice.idevice_get_device_list(out udids, ref count);

if (ret == iDeviceError.NoDevice)
{
    // Not actually an error in our case
    return;
}

ret.ThrowOnError();

// Get the device name
foreach (var udid in udids)
{
    string t1;

    PlistHandle tested1;

    //Find serial number in plist
    lockdown.lockdownd_get_value(lockdownHandle, null, "SerialNumber", out 
    tested1);

    //Get string values from plist
    tested1.Api.Plist.plist_get_string_val(tested1, out t1);

    Console.WriteLine(t1);
}

Also, Is there a reference list for all keys supported?

Frederik Carlier
  • 4,606
  • 1
  • 25
  • 36

2 Answers2

1

I also found you can access disk_usage info via afc:

LockdownServiceDescriptorHandle ldsHandle;
AfcClientHandle afcClient;

idevice.idevice_new(out deviceHandle, udid).ThrowOnError();

lockdown.lockdownd_client_new_with_handshake(deviceHandle, out lockdownHandle, 
   "Quamotion").ThrowOnError();

lockdown.lockdownd_start_service(lockdownHandle, "com.apple.afc", out ldsHandle);

ldsHandle.Api.Afc.afc_client_new(deviceHandle, ldsHandle, out afcClient);

ldsHandle.Api.Afc.afc_get_device_info_key(afcClient, "FSTotalBytes", out totalSize);
0

You can explore the keys which lockdown exposes using the ideviceinfo command line utility. ideviceinfo --help lists known domains, which includes com.apple.disk_usage and sounds interesting. Usually, specifying a domain but omitting a key will get you a list of all keys in that domain, and their value:

Let's see what what gets us:

> ideviceinfo -q com.apple.disk_usage

AmountDataAvailable: 24795447296
AmountDataReserved: 209715200
AmountRestoreAvailable: 30147182592
CalculateDiskUsage: OkilyDokily
NANDInfo: AQAA...
TotalDataAvailable: 25086046208
TotalDataCapacity: 26836963328
TotalDiskCapacity: 32000000000
TotalSystemAvailable: 0
TotalSystemCapacity: 5142020096

In you case, it looks like the TotalDiskCapacity key in the com.apple.disk_usage domain is what you're looking for. You can use lockdown.lockdown_get_value(lockdownHandle, "com.apple.disk_usage", "TotalDiskCapacity", out tests1) to get a property list handle which should contain the requested value.

Frederik Carlier
  • 4,606
  • 1
  • 25
  • 36