-
Notifications
You must be signed in to change notification settings - Fork 135
/
list_device_props.m
126 lines (112 loc) · 2.42 KB
/
list_device_props.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#include "cli.h"
static char *expected_udid = NULL;
static const char *keys[] =
{
"ActivationPublicKey",
"ActivationState",
"ActivationStateAcknowledged",
"ActivityURL",
"BasebandBootloaderVersion",
"BasebandSerialNumber",
"BasebandStatus",
"BasebandVersion",
"BluetoothAddress",
"BuildVersion",
"CPUArchitecture",
"DeviceCertificate",
"DeviceClass",
"DeviceColor",
"DeviceName",
"DevicePublicKey",
"DieID",
"FirmwareVersion",
"HardwareModel",
"HardwarePlatform",
"HostAttached",
"IMLockdownEverRegisteredKey",
"IntegratedCircuitCardIdentity",
"InternationalMobileEquipmentIdentity",
"InternationalMobileSubscriberIdentity",
"iTunesHasConnected",
"MLBSerialNumber",
"MobileSubscriberCountryCode",
"MobileSubscriberNetworkCode",
"ModelNumber",
"PartitionType",
"PasswordProtected",
"PhoneNumber",
"ProductionSOC",
"ProductType",
"ProductVersion",
"ProtocolVersion",
"ProximitySensorCalibration",
"RegionInfo",
"SBLockdownEverRegisteredKey",
"SerialNumber",
"SIMStatus",
"SoftwareBehavior",
"SoftwareBundleVersion",
"SupportedDeviceFamilies",
"TelephonyCapability",
"TimeIntervalSince1970",
"TimeZone",
"TimeZoneOffsetFromUTC",
"TrustedHostAttached",
"UniqueChipID",
"UniqueDeviceID",
"UseActivityURL",
"UseRaptorCerts",
"Uses24HourClock",
"WeDelivered",
"WiFiAddress",
NULL
};
static void on_device_connected(struct am_device *device)
{
if (!device_matches(device, expected_udid))
{
return;
}
device_delayed_unregister_aborted = true;
device_connect(device);
for (const char **pkey = keys; *pkey != NULL; ++pkey)
{
CFStringRef key = (__bridge CFStringRef)[NSString stringWithUTF8String:*pkey];
id value = AMDeviceCopyValue(device, 0, key);
if (value != nil)
{
printfNS(@"%@\n", key);
}
}
device_unregister(0);
}
int list_device_props(int argc, char *argv[])
{
int flag;
char *endptr;
int64_t timeout = -1;
while ((flag = getopt(argc, argv, "u:t:")) != -1)
{
switch (flag)
{
case 'u':
expected_udid = optarg;
break;
case 't':
timeout = strtoll(optarg, &endptr, 10);
break;
default:
help(argc, argv);
return 1;
}
}
argc -= optind;
argv += optind;
if (argc != 0)
{
return invalid_usage(argc, argv);
}
device_delayed_unregister_status = 1;
device_register(on_device_connected, timeout);
return 1;
}