pymobiledevice3 4.14.6__py3-none-any.whl → 7.0.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. misc/plist_sniffer.py +15 -15
  2. misc/remotexpc_sniffer.py +29 -28
  3. misc/understanding_idevice_protocol_layers.md +15 -10
  4. pymobiledevice3/__main__.py +317 -127
  5. pymobiledevice3/_version.py +22 -4
  6. pymobiledevice3/bonjour.py +358 -113
  7. pymobiledevice3/ca.py +253 -16
  8. pymobiledevice3/cli/activation.py +31 -23
  9. pymobiledevice3/cli/afc.py +49 -40
  10. pymobiledevice3/cli/amfi.py +16 -21
  11. pymobiledevice3/cli/apps.py +87 -42
  12. pymobiledevice3/cli/backup.py +160 -90
  13. pymobiledevice3/cli/bonjour.py +44 -40
  14. pymobiledevice3/cli/cli_common.py +204 -198
  15. pymobiledevice3/cli/companion_proxy.py +14 -14
  16. pymobiledevice3/cli/crash.py +105 -56
  17. pymobiledevice3/cli/developer/__init__.py +62 -0
  18. pymobiledevice3/cli/developer/accessibility/__init__.py +65 -0
  19. pymobiledevice3/cli/developer/accessibility/settings.py +43 -0
  20. pymobiledevice3/cli/developer/arbitration.py +50 -0
  21. pymobiledevice3/cli/developer/condition.py +33 -0
  22. pymobiledevice3/cli/developer/core_device.py +294 -0
  23. pymobiledevice3/cli/developer/debugserver.py +244 -0
  24. pymobiledevice3/cli/developer/dvt/__init__.py +438 -0
  25. pymobiledevice3/cli/developer/dvt/core_profile_session.py +295 -0
  26. pymobiledevice3/cli/developer/dvt/simulate_location.py +56 -0
  27. pymobiledevice3/cli/developer/dvt/sysmon/__init__.py +69 -0
  28. pymobiledevice3/cli/developer/dvt/sysmon/process.py +188 -0
  29. pymobiledevice3/cli/developer/fetch_symbols.py +108 -0
  30. pymobiledevice3/cli/developer/simulate_location.py +51 -0
  31. pymobiledevice3/cli/diagnostics/__init__.py +75 -0
  32. pymobiledevice3/cli/diagnostics/battery.py +47 -0
  33. pymobiledevice3/cli/idam.py +42 -0
  34. pymobiledevice3/cli/lockdown.py +108 -103
  35. pymobiledevice3/cli/mounter.py +158 -99
  36. pymobiledevice3/cli/notification.py +38 -26
  37. pymobiledevice3/cli/pcap.py +45 -24
  38. pymobiledevice3/cli/power_assertion.py +18 -17
  39. pymobiledevice3/cli/processes.py +17 -23
  40. pymobiledevice3/cli/profile.py +165 -109
  41. pymobiledevice3/cli/provision.py +35 -34
  42. pymobiledevice3/cli/remote.py +217 -129
  43. pymobiledevice3/cli/restore.py +159 -143
  44. pymobiledevice3/cli/springboard.py +63 -53
  45. pymobiledevice3/cli/syslog.py +193 -86
  46. pymobiledevice3/cli/usbmux.py +73 -33
  47. pymobiledevice3/cli/version.py +5 -7
  48. pymobiledevice3/cli/webinspector.py +376 -214
  49. pymobiledevice3/common.py +3 -1
  50. pymobiledevice3/exceptions.py +182 -58
  51. pymobiledevice3/irecv.py +52 -53
  52. pymobiledevice3/irecv_devices.py +1489 -464
  53. pymobiledevice3/lockdown.py +473 -275
  54. pymobiledevice3/lockdown_service_provider.py +15 -8
  55. pymobiledevice3/osu/os_utils.py +27 -9
  56. pymobiledevice3/osu/posix_util.py +34 -15
  57. pymobiledevice3/osu/win_util.py +14 -8
  58. pymobiledevice3/pair_records.py +102 -21
  59. pymobiledevice3/remote/common.py +8 -4
  60. pymobiledevice3/remote/core_device/app_service.py +94 -67
  61. pymobiledevice3/remote/core_device/core_device_service.py +17 -14
  62. pymobiledevice3/remote/core_device/device_info.py +5 -5
  63. pymobiledevice3/remote/core_device/diagnostics_service.py +19 -4
  64. pymobiledevice3/remote/core_device/file_service.py +53 -23
  65. pymobiledevice3/remote/remote_service_discovery.py +79 -45
  66. pymobiledevice3/remote/remotexpc.py +73 -44
  67. pymobiledevice3/remote/tunnel_service.py +442 -317
  68. pymobiledevice3/remote/utils.py +14 -13
  69. pymobiledevice3/remote/xpc_message.py +145 -125
  70. pymobiledevice3/resources/dsc_uuid_map.py +19 -19
  71. pymobiledevice3/resources/firmware_notifications.py +20 -16
  72. pymobiledevice3/resources/notifications.txt +144 -0
  73. pymobiledevice3/restore/asr.py +27 -27
  74. pymobiledevice3/restore/base_restore.py +110 -21
  75. pymobiledevice3/restore/consts.py +87 -66
  76. pymobiledevice3/restore/device.py +59 -12
  77. pymobiledevice3/restore/fdr.py +46 -48
  78. pymobiledevice3/restore/ftab.py +19 -19
  79. pymobiledevice3/restore/img4.py +163 -0
  80. pymobiledevice3/restore/mbn.py +587 -0
  81. pymobiledevice3/restore/recovery.py +151 -151
  82. pymobiledevice3/restore/restore.py +562 -544
  83. pymobiledevice3/restore/restore_options.py +131 -110
  84. pymobiledevice3/restore/restored_client.py +51 -31
  85. pymobiledevice3/restore/tss.py +385 -267
  86. pymobiledevice3/service_connection.py +252 -59
  87. pymobiledevice3/services/accessibilityaudit.py +202 -120
  88. pymobiledevice3/services/afc.py +962 -365
  89. pymobiledevice3/services/amfi.py +24 -30
  90. pymobiledevice3/services/companion.py +23 -19
  91. pymobiledevice3/services/crash_reports.py +71 -47
  92. pymobiledevice3/services/debugserver_applist.py +3 -3
  93. pymobiledevice3/services/device_arbitration.py +8 -8
  94. pymobiledevice3/services/device_link.py +101 -79
  95. pymobiledevice3/services/diagnostics.py +973 -967
  96. pymobiledevice3/services/dtfetchsymbols.py +8 -8
  97. pymobiledevice3/services/dvt/dvt_secure_socket_proxy.py +4 -4
  98. pymobiledevice3/services/dvt/dvt_testmanaged_proxy.py +4 -4
  99. pymobiledevice3/services/dvt/instruments/activity_trace_tap.py +85 -74
  100. pymobiledevice3/services/dvt/instruments/application_listing.py +2 -3
  101. pymobiledevice3/services/dvt/instruments/condition_inducer.py +7 -6
  102. pymobiledevice3/services/dvt/instruments/core_profile_session_tap.py +466 -384
  103. pymobiledevice3/services/dvt/instruments/device_info.py +20 -11
  104. pymobiledevice3/services/dvt/instruments/energy_monitor.py +1 -1
  105. pymobiledevice3/services/dvt/instruments/graphics.py +1 -1
  106. pymobiledevice3/services/dvt/instruments/location_simulation.py +1 -1
  107. pymobiledevice3/services/dvt/instruments/location_simulation_base.py +10 -10
  108. pymobiledevice3/services/dvt/instruments/network_monitor.py +17 -17
  109. pymobiledevice3/services/dvt/instruments/notifications.py +1 -1
  110. pymobiledevice3/services/dvt/instruments/process_control.py +35 -10
  111. pymobiledevice3/services/dvt/instruments/screenshot.py +2 -2
  112. pymobiledevice3/services/dvt/instruments/sysmontap.py +15 -15
  113. pymobiledevice3/services/dvt/testmanaged/xcuitest.py +42 -52
  114. pymobiledevice3/services/file_relay.py +10 -10
  115. pymobiledevice3/services/heartbeat.py +9 -8
  116. pymobiledevice3/services/house_arrest.py +16 -15
  117. pymobiledevice3/services/idam.py +20 -0
  118. pymobiledevice3/services/installation_proxy.py +173 -81
  119. pymobiledevice3/services/lockdown_service.py +20 -10
  120. pymobiledevice3/services/misagent.py +22 -19
  121. pymobiledevice3/services/mobile_activation.py +147 -64
  122. pymobiledevice3/services/mobile_config.py +331 -294
  123. pymobiledevice3/services/mobile_image_mounter.py +141 -113
  124. pymobiledevice3/services/mobilebackup2.py +203 -145
  125. pymobiledevice3/services/notification_proxy.py +11 -11
  126. pymobiledevice3/services/os_trace.py +134 -74
  127. pymobiledevice3/services/pcapd.py +314 -302
  128. pymobiledevice3/services/power_assertion.py +10 -9
  129. pymobiledevice3/services/preboard.py +4 -4
  130. pymobiledevice3/services/remote_fetch_symbols.py +21 -14
  131. pymobiledevice3/services/remote_server.py +176 -146
  132. pymobiledevice3/services/restore_service.py +16 -16
  133. pymobiledevice3/services/screenshot.py +15 -12
  134. pymobiledevice3/services/simulate_location.py +7 -7
  135. pymobiledevice3/services/springboard.py +15 -15
  136. pymobiledevice3/services/syslog.py +5 -5
  137. pymobiledevice3/services/web_protocol/alert.py +11 -11
  138. pymobiledevice3/services/web_protocol/automation_session.py +251 -239
  139. pymobiledevice3/services/web_protocol/cdp_screencast.py +46 -37
  140. pymobiledevice3/services/web_protocol/cdp_server.py +19 -19
  141. pymobiledevice3/services/web_protocol/cdp_target.py +411 -373
  142. pymobiledevice3/services/web_protocol/driver.py +114 -111
  143. pymobiledevice3/services/web_protocol/element.py +124 -111
  144. pymobiledevice3/services/web_protocol/inspector_session.py +106 -102
  145. pymobiledevice3/services/web_protocol/selenium_api.py +49 -49
  146. pymobiledevice3/services/web_protocol/session_protocol.py +18 -12
  147. pymobiledevice3/services/web_protocol/switch_to.py +30 -27
  148. pymobiledevice3/services/webinspector.py +189 -155
  149. pymobiledevice3/tcp_forwarder.py +87 -69
  150. pymobiledevice3/tunneld/__init__.py +0 -0
  151. pymobiledevice3/tunneld/api.py +63 -0
  152. pymobiledevice3/tunneld/server.py +603 -0
  153. pymobiledevice3/usbmux.py +198 -147
  154. pymobiledevice3/utils.py +14 -11
  155. {pymobiledevice3-4.14.6.dist-info → pymobiledevice3-7.0.6.dist-info}/METADATA +55 -28
  156. pymobiledevice3-7.0.6.dist-info/RECORD +188 -0
  157. {pymobiledevice3-4.14.6.dist-info → pymobiledevice3-7.0.6.dist-info}/WHEEL +1 -1
  158. pymobiledevice3/cli/developer.py +0 -1215
  159. pymobiledevice3/cli/diagnostics.py +0 -99
  160. pymobiledevice3/tunneld.py +0 -524
  161. pymobiledevice3-4.14.6.dist-info/RECORD +0 -168
  162. {pymobiledevice3-4.14.6.dist-info → pymobiledevice3-7.0.6.dist-info}/entry_points.txt +0 -0
  163. {pymobiledevice3-4.14.6.dist-info → pymobiledevice3-7.0.6.dist-info/licenses}/LICENSE +0 -0
  164. {pymobiledevice3-4.14.6.dist-info → pymobiledevice3-7.0.6.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
3
  import enum
4
+ import time
4
5
  from collections.abc import Generator
5
6
  from typing import Optional
6
7
 
@@ -12,267 +13,270 @@ from pymobiledevice3.lockdown import LockdownClient
12
13
  from pymobiledevice3.lockdown_service_provider import LockdownServiceProvider
13
14
  from pymobiledevice3.services.lockdown_service import LockdownService
14
15
 
15
- INTERFACE_NAMES = enum.Enum('InterfaceNames', names={
16
- 'other': 1,
17
- 'regular1822': 2,
18
- 'hdh1822': 3,
19
- 'ddnX25': 4,
20
- 'rfc877x25': 5,
21
- 'ethernetCsmacd': 6,
22
- 'iso88023Csmacd': 7,
23
- 'iso88024TokenBus': 8,
24
- 'iso88025TokenRing': 9,
25
- 'iso88026Man': 10,
26
- 'starLan': 11,
27
- 'proteon10Mbit': 12,
28
- 'proteon80Mbit': 13,
29
- 'hyperchannel': 14,
30
- 'fddi': 15,
31
- 'lapb': 16,
32
- 'sdlc': 17,
33
- 'ds1': 18,
34
- 'e1': 19,
35
- 'basicISDN': 20,
36
- 'primaryISDN': 21,
37
- 'propPointToPointSerial': 22,
38
- 'ppp': 23,
39
- 'softwareLoopback': 24,
40
- 'eon': 25,
41
- 'ethernet3Mbit': 26,
42
- 'nsip': 27,
43
- 'slip': 28,
44
- 'ultra': 29,
45
- 'ds3': 30,
46
- 'sip': 31,
47
- 'frameRelay': 32,
48
- 'rs232': 33,
49
- 'para': 34,
50
- 'arcnet': 35,
51
- 'arcnetPlus': 36,
52
- 'atm': 37,
53
- 'miox25': 38,
54
- 'sonet': 39,
55
- 'x25ple': 40,
56
- 'iso88022llc': 41,
57
- 'localTalk': 42,
58
- 'smdsDxi': 43,
59
- 'frameRelayService': 44,
60
- 'v35': 45,
61
- 'hssi': 46,
62
- 'hippi': 47,
63
- 'modem': 48,
64
- 'aal5': 49,
65
- 'sonetPath': 50,
66
- 'sonetVT': 51,
67
- 'smdsIcip': 52,
68
- 'propVirtual': 53,
69
- 'propMultiplexor': 54,
70
- 'ieee80212': 55,
71
- 'fibreChannel': 56,
72
- 'hippiInterface': 57,
73
- 'frameRelayInterconnect': 58,
74
- 'aflane8023': 59,
75
- 'aflane8025': 60,
76
- 'cctEmul': 61,
77
- 'fastEther': 62,
78
- 'isdn': 63,
79
- 'v11': 64,
80
- 'v36': 65,
81
- 'g703at64k': 66,
82
- 'g703at2mb': 67,
83
- 'qllc': 68,
84
- 'fastEtherFX': 69,
85
- 'channel': 70,
86
- 'ieee80211': 71,
87
- 'ibm370parChan': 72,
88
- 'escon': 73,
89
- 'dlsw': 74,
90
- 'isdns': 75,
91
- 'isdnu': 76,
92
- 'lapd': 77,
93
- 'ipSwitch': 78,
94
- 'rsrb': 79,
95
- 'atmLogical': 80,
96
- 'ds0': 81,
97
- 'ds0Bundle': 82,
98
- 'bsc': 83,
99
- 'async': 84,
100
- 'cnr': 85,
101
- 'iso88025Dtr': 86,
102
- 'eplrs': 87,
103
- 'arap': 88,
104
- 'propCnls': 89,
105
- 'hostPad': 90,
106
- 'termPad': 91,
107
- 'frameRelayMPI': 92,
108
- 'x213': 93,
109
- 'adsl': 94,
110
- 'radsl': 95,
111
- 'sdsl': 96,
112
- 'vdsl': 97,
113
- 'iso88025CRFPInt': 98,
114
- 'myrinet': 99,
115
- 'voiceEM': 100,
116
- 'voiceFXO': 101,
117
- 'voiceFXS': 102,
118
- 'voiceEncap': 103,
119
- 'voiceOverIp': 104,
120
- 'atmDxi': 105,
121
- 'atmFuni': 106,
122
- 'atmIma': 107,
123
- 'pppMultilinkBundle': 108,
124
- 'ipOverCdlc': 109,
125
- 'ipOverClaw': 110,
126
- 'stackToStack': 111,
127
- 'virtualIpAddress': 112,
128
- 'mpc': 113,
129
- 'ipOverAtm': 114,
130
- 'iso88025Fiber': 115,
131
- 'tdlc': 116,
132
- 'gigabitEthernet': 117,
133
- 'hdlc': 118,
134
- 'lapf': 119,
135
- 'v37': 120,
136
- 'x25mlp': 121,
137
- 'x25huntGroup': 122,
138
- 'transpHdlc': 123,
139
- 'interleave': 124,
140
- 'fast': 125,
141
- 'ip': 126,
142
- 'docsCableMaclayer': 127,
143
- 'docsCableDownstream': 128,
144
- 'docsCableUpstream': 129,
145
- 'a12MppSwitch': 130,
146
- 'tunnel': 131,
147
- 'coffee': 132,
148
- 'ces': 133,
149
- 'atmSubInterface': 134,
150
- 'l2vlan': 135,
151
- 'l3ipvlan': 136,
152
- 'l3ipxvlan': 137,
153
- 'digitalPowerline': 138,
154
- 'mediaMailOverIp': 139,
155
- 'dtm': 140,
156
- 'dcn': 141,
157
- 'ipForward': 142,
158
- 'msdsl': 143,
159
- 'ieee1394': 144,
160
- 'if-gsn': 145,
161
- 'dvbRccMacLayer': 146,
162
- 'dvbRccDownstream': 147,
163
- 'dvbRccUpstream': 148,
164
- 'atmVirtual': 149,
165
- 'mplsTunnel': 150,
166
- 'srp': 151,
167
- 'voiceOverAtm': 152,
168
- 'voiceOverFrameRelay': 153,
169
- 'idsl': 154,
170
- 'compositeLink': 155,
171
- 'ss7SigLink': 156,
172
- 'propWirelessP2P': 157,
173
- 'frForward': 158,
174
- 'rfc1483': 159,
175
- 'usb': 160,
176
- 'ieee8023adLag': 161,
177
- 'bgppolicyaccounting': 162,
178
- 'frf16MfrBundle': 163,
179
- 'h323Gatekeeper': 164,
180
- 'h323Proxy': 165,
181
- 'mpls': 166,
182
- 'mfSigLink': 167,
183
- 'hdsl2': 168,
184
- 'shdsl': 169,
185
- 'ds1FDL': 170,
186
- 'pos': 171,
187
- 'dvbAsiIn': 172,
188
- 'dvbAsiOut': 173,
189
- 'plc': 174,
190
- 'nfas': 175,
191
- 'tr008': 176,
192
- 'gr303RDT': 177,
193
- 'gr303IDT': 178,
194
- 'isup': 179,
195
- 'propDocsWirelessMaclayer': 180,
196
- 'propDocsWirelessDownstream': 181,
197
- 'propDocsWirelessUpstream': 182,
198
- 'hiperlan2': 183,
199
- 'propBWAp2Mp': 184,
200
- 'sonetOverheadChannel': 185,
201
- 'digitalWrapperOverheadChannel': 186,
202
- 'aal2': 187,
203
- 'radioMAC': 188,
204
- 'atmRadio': 189,
205
- 'imt': 190,
206
- 'mvl': 191,
207
- 'reachDSL': 192,
208
- 'frDlciEndPt': 193,
209
- 'atmVciEndPt': 194,
210
- 'opticalChannel': 195,
211
- 'opticalTransport': 196,
212
- 'propAtm': 197,
213
- 'voiceOverCable': 198,
214
- 'infiniband': 199,
215
- 'teLink': 200,
216
- 'q2931': 201,
217
- 'virtualTg': 202,
218
- 'sipTg': 203,
219
- 'sipSig': 204,
220
- 'docsCableUpstreamChannel': 205,
221
- 'econet': 206,
222
- 'pon155': 207,
223
- 'pon622': 208,
224
- 'bridge': 209,
225
- 'linegroup': 210,
226
- 'voiceEMFGD': 211,
227
- 'voiceFGDEANA': 212,
228
- 'voiceDID': 213,
229
- 'mpegTransport': 214,
230
- 'sixToFour': 215,
231
- 'gtp': 216,
232
- 'pdnEtherLoop1': 217,
233
- 'pdnEtherLoop2': 218,
234
- 'opticalChannelGroup': 219,
235
- 'homepna': 220,
236
- 'gfp': 221,
237
- 'ciscoISLvlan': 222,
238
- 'actelisMetaLOOP': 223,
239
- 'fcipLink': 224,
240
- 'rpr': 225,
241
- 'qam': 226,
242
- 'lmp': 227,
243
- 'cblVectaStar': 228,
244
- 'docsCableMCmtsDownstream': 229,
245
- 'adsl2': 230,
246
- 'macSecControlledIF': 231,
247
- 'macSecUncontrolledIF': 232,
248
- 'aviciOpticalEther': 233,
249
- 'atmbond': 234,
250
- 'voiceFGDOS': 235,
251
- 'mocaVersion1': 236,
252
- 'ieee80216WMAN': 237,
253
- 'adsl2plus': 238,
254
- 'dvbRcsMacLayer': 239,
255
- 'dvbTdm': 240,
256
- 'dvbRcsTdma': 241,
257
- 'x86Laps': 242,
258
- 'wwanPP': 243,
259
- 'wwanPP2': 244,
260
- 'voiceEBS': 245,
261
- 'ifPwType': 246,
262
- 'ilan': 247,
263
- 'pip': 248,
264
- 'aluELP': 249,
265
- 'gpon': 250,
266
- 'vdsl2': 251,
267
- 'capwapDot11Profile': 252,
268
- 'capwapDot11Bss': 253,
269
- 'capwapWtpVirtualRadio': 254,
270
- 'bits': 255,
271
- 'docsCableUpstreamRfPort': 256,
272
- 'cableDownstreamRfPort': 257,
273
- 'vmwareVirtualNic': 258,
274
- 'ieee802154': 259,
275
- })
16
+ INTERFACE_NAMES = enum.Enum(
17
+ "InterfaceNames",
18
+ names={
19
+ "other": 1,
20
+ "regular1822": 2,
21
+ "hdh1822": 3,
22
+ "ddnX25": 4,
23
+ "rfc877x25": 5,
24
+ "ethernetCsmacd": 6,
25
+ "iso88023Csmacd": 7,
26
+ "iso88024TokenBus": 8,
27
+ "iso88025TokenRing": 9,
28
+ "iso88026Man": 10,
29
+ "starLan": 11,
30
+ "proteon10Mbit": 12,
31
+ "proteon80Mbit": 13,
32
+ "hyperchannel": 14,
33
+ "fddi": 15,
34
+ "lapb": 16,
35
+ "sdlc": 17,
36
+ "ds1": 18,
37
+ "e1": 19,
38
+ "basicISDN": 20,
39
+ "primaryISDN": 21,
40
+ "propPointToPointSerial": 22,
41
+ "ppp": 23,
42
+ "softwareLoopback": 24,
43
+ "eon": 25,
44
+ "ethernet3Mbit": 26,
45
+ "nsip": 27,
46
+ "slip": 28,
47
+ "ultra": 29,
48
+ "ds3": 30,
49
+ "sip": 31,
50
+ "frameRelay": 32,
51
+ "rs232": 33,
52
+ "para": 34,
53
+ "arcnet": 35,
54
+ "arcnetPlus": 36,
55
+ "atm": 37,
56
+ "miox25": 38,
57
+ "sonet": 39,
58
+ "x25ple": 40,
59
+ "iso88022llc": 41,
60
+ "localTalk": 42,
61
+ "smdsDxi": 43,
62
+ "frameRelayService": 44,
63
+ "v35": 45,
64
+ "hssi": 46,
65
+ "hippi": 47,
66
+ "modem": 48,
67
+ "aal5": 49,
68
+ "sonetPath": 50,
69
+ "sonetVT": 51,
70
+ "smdsIcip": 52,
71
+ "propVirtual": 53,
72
+ "propMultiplexor": 54,
73
+ "ieee80212": 55,
74
+ "fibreChannel": 56,
75
+ "hippiInterface": 57,
76
+ "frameRelayInterconnect": 58,
77
+ "aflane8023": 59,
78
+ "aflane8025": 60,
79
+ "cctEmul": 61,
80
+ "fastEther": 62,
81
+ "isdn": 63,
82
+ "v11": 64,
83
+ "v36": 65,
84
+ "g703at64k": 66,
85
+ "g703at2mb": 67,
86
+ "qllc": 68,
87
+ "fastEtherFX": 69,
88
+ "channel": 70,
89
+ "ieee80211": 71,
90
+ "ibm370parChan": 72,
91
+ "escon": 73,
92
+ "dlsw": 74,
93
+ "isdns": 75,
94
+ "isdnu": 76,
95
+ "lapd": 77,
96
+ "ipSwitch": 78,
97
+ "rsrb": 79,
98
+ "atmLogical": 80,
99
+ "ds0": 81,
100
+ "ds0Bundle": 82,
101
+ "bsc": 83,
102
+ "async": 84,
103
+ "cnr": 85,
104
+ "iso88025Dtr": 86,
105
+ "eplrs": 87,
106
+ "arap": 88,
107
+ "propCnls": 89,
108
+ "hostPad": 90,
109
+ "termPad": 91,
110
+ "frameRelayMPI": 92,
111
+ "x213": 93,
112
+ "adsl": 94,
113
+ "radsl": 95,
114
+ "sdsl": 96,
115
+ "vdsl": 97,
116
+ "iso88025CRFPInt": 98,
117
+ "myrinet": 99,
118
+ "voiceEM": 100,
119
+ "voiceFXO": 101,
120
+ "voiceFXS": 102,
121
+ "voiceEncap": 103,
122
+ "voiceOverIp": 104,
123
+ "atmDxi": 105,
124
+ "atmFuni": 106,
125
+ "atmIma": 107,
126
+ "pppMultilinkBundle": 108,
127
+ "ipOverCdlc": 109,
128
+ "ipOverClaw": 110,
129
+ "stackToStack": 111,
130
+ "virtualIpAddress": 112,
131
+ "mpc": 113,
132
+ "ipOverAtm": 114,
133
+ "iso88025Fiber": 115,
134
+ "tdlc": 116,
135
+ "gigabitEthernet": 117,
136
+ "hdlc": 118,
137
+ "lapf": 119,
138
+ "v37": 120,
139
+ "x25mlp": 121,
140
+ "x25huntGroup": 122,
141
+ "transpHdlc": 123,
142
+ "interleave": 124,
143
+ "fast": 125,
144
+ "ip": 126,
145
+ "docsCableMaclayer": 127,
146
+ "docsCableDownstream": 128,
147
+ "docsCableUpstream": 129,
148
+ "a12MppSwitch": 130,
149
+ "tunnel": 131,
150
+ "coffee": 132,
151
+ "ces": 133,
152
+ "atmSubInterface": 134,
153
+ "l2vlan": 135,
154
+ "l3ipvlan": 136,
155
+ "l3ipxvlan": 137,
156
+ "digitalPowerline": 138,
157
+ "mediaMailOverIp": 139,
158
+ "dtm": 140,
159
+ "dcn": 141,
160
+ "ipForward": 142,
161
+ "msdsl": 143,
162
+ "ieee1394": 144,
163
+ "if-gsn": 145,
164
+ "dvbRccMacLayer": 146,
165
+ "dvbRccDownstream": 147,
166
+ "dvbRccUpstream": 148,
167
+ "atmVirtual": 149,
168
+ "mplsTunnel": 150,
169
+ "srp": 151,
170
+ "voiceOverAtm": 152,
171
+ "voiceOverFrameRelay": 153,
172
+ "idsl": 154,
173
+ "compositeLink": 155,
174
+ "ss7SigLink": 156,
175
+ "propWirelessP2P": 157,
176
+ "frForward": 158,
177
+ "rfc1483": 159,
178
+ "usb": 160,
179
+ "ieee8023adLag": 161,
180
+ "bgppolicyaccounting": 162,
181
+ "frf16MfrBundle": 163,
182
+ "h323Gatekeeper": 164,
183
+ "h323Proxy": 165,
184
+ "mpls": 166,
185
+ "mfSigLink": 167,
186
+ "hdsl2": 168,
187
+ "shdsl": 169,
188
+ "ds1FDL": 170,
189
+ "pos": 171,
190
+ "dvbAsiIn": 172,
191
+ "dvbAsiOut": 173,
192
+ "plc": 174,
193
+ "nfas": 175,
194
+ "tr008": 176,
195
+ "gr303RDT": 177,
196
+ "gr303IDT": 178,
197
+ "isup": 179,
198
+ "propDocsWirelessMaclayer": 180,
199
+ "propDocsWirelessDownstream": 181,
200
+ "propDocsWirelessUpstream": 182,
201
+ "hiperlan2": 183,
202
+ "propBWAp2Mp": 184,
203
+ "sonetOverheadChannel": 185,
204
+ "digitalWrapperOverheadChannel": 186,
205
+ "aal2": 187,
206
+ "radioMAC": 188,
207
+ "atmRadio": 189,
208
+ "imt": 190,
209
+ "mvl": 191,
210
+ "reachDSL": 192,
211
+ "frDlciEndPt": 193,
212
+ "atmVciEndPt": 194,
213
+ "opticalChannel": 195,
214
+ "opticalTransport": 196,
215
+ "propAtm": 197,
216
+ "voiceOverCable": 198,
217
+ "infiniband": 199,
218
+ "teLink": 200,
219
+ "q2931": 201,
220
+ "virtualTg": 202,
221
+ "sipTg": 203,
222
+ "sipSig": 204,
223
+ "docsCableUpstreamChannel": 205,
224
+ "econet": 206,
225
+ "pon155": 207,
226
+ "pon622": 208,
227
+ "bridge": 209,
228
+ "linegroup": 210,
229
+ "voiceEMFGD": 211,
230
+ "voiceFGDEANA": 212,
231
+ "voiceDID": 213,
232
+ "mpegTransport": 214,
233
+ "sixToFour": 215,
234
+ "gtp": 216,
235
+ "pdnEtherLoop1": 217,
236
+ "pdnEtherLoop2": 218,
237
+ "opticalChannelGroup": 219,
238
+ "homepna": 220,
239
+ "gfp": 221,
240
+ "ciscoISLvlan": 222,
241
+ "actelisMetaLOOP": 223,
242
+ "fcipLink": 224,
243
+ "rpr": 225,
244
+ "qam": 226,
245
+ "lmp": 227,
246
+ "cblVectaStar": 228,
247
+ "docsCableMCmtsDownstream": 229,
248
+ "adsl2": 230,
249
+ "macSecControlledIF": 231,
250
+ "macSecUncontrolledIF": 232,
251
+ "aviciOpticalEther": 233,
252
+ "atmbond": 234,
253
+ "voiceFGDOS": 235,
254
+ "mocaVersion1": 236,
255
+ "ieee80216WMAN": 237,
256
+ "adsl2plus": 238,
257
+ "dvbRcsMacLayer": 239,
258
+ "dvbTdm": 240,
259
+ "dvbRcsTdma": 241,
260
+ "x86Laps": 242,
261
+ "wwanPP": 243,
262
+ "wwanPP2": 244,
263
+ "voiceEBS": 245,
264
+ "ifPwType": 246,
265
+ "ilan": 247,
266
+ "pip": 248,
267
+ "aluELP": 249,
268
+ "gpon": 250,
269
+ "vdsl2": 251,
270
+ "capwapDot11Profile": 252,
271
+ "capwapDot11Bss": 253,
272
+ "capwapWtpVirtualRadio": 254,
273
+ "bits": 255,
274
+ "docsCableUpstreamRfPort": 256,
275
+ "cableDownstreamRfPort": 257,
276
+ "vmwareVirtualNic": 258,
277
+ "ieee802154": 259,
278
+ },
279
+ )
276
280
 
277
281
  """
278
282
  struct pcap_hdr_s {
@@ -295,28 +299,28 @@ typedef struct pcaprec_hdr_s {
295
299
  LINKTYPE_ETHERNET = 1
296
300
  LINKTYPE_RAW = 101
297
301
 
298
- ETHERNET_HEADER = b'\xBE\xEF' * 6 + b'\x08\x00'
302
+ ETHERNET_HEADER = b"\xbe\xef" * 6 + b"\x08\x00"
299
303
 
300
304
  device_packet_struct = Struct(
301
- 'header_length' / Int32ub,
302
- 'header_version' / Byte,
303
- 'packet_length' / Int32ub,
304
- 'interface_type' / Byte,
305
- 'unit' / Int16ub,
306
- 'io' / Byte,
307
- 'protocol_family' / Int32ub,
308
- 'frame_pre_length' / Int32ub,
309
- 'frame_post_length' / Int32ub,
310
- 'interface_name' / Padded(16, CString('utf8')),
311
- 'pid' / Int32ul,
312
- 'comm' / Padded(17, CString('utf8')),
313
- 'svc' / Int32ub,
314
- 'epid' / Int32ul,
315
- 'ecomm' / Padded(17, CString('utf8')),
316
- 'seconds' / Int32ub,
317
- 'microseconds' / Int32ub,
305
+ "header_length" / Int32ub,
306
+ "header_version" / Byte,
307
+ "packet_length" / Int32ub,
308
+ "interface_type" / Byte,
309
+ "unit" / Int16ub,
310
+ "io" / Byte,
311
+ "protocol_family" / Int32ub,
312
+ "frame_pre_length" / Int32ub,
313
+ "frame_post_length" / Int32ub,
314
+ "interface_name" / Padded(16, CString("utf8")),
315
+ "pid" / Int32ul,
316
+ "comm" / Padded(17, CString("utf8")),
317
+ "svc" / Int32ub,
318
+ "epid" / Int32ul,
319
+ "ecomm" / Padded(17, CString("utf8")),
320
+ "seconds" / Int32ub,
321
+ "microseconds" / Int32ub,
318
322
  Seek(this.header_length),
319
- 'data' / Bytes(this.packet_length),
323
+ "data" / Bytes(this.packet_length),
320
324
  )
321
325
 
322
326
 
@@ -332,8 +336,9 @@ class PcapdService(LockdownService):
332
336
  an iOS device. On macOS, the virtual interface can be enabled with the rvictl command. This script allows to use
333
337
  this service on other systems.
334
338
  """
335
- RSD_SERVICE_NAME = 'com.apple.pcapd.shim.remote'
336
- SERVICE_NAME = 'com.apple.pcapd'
339
+
340
+ RSD_SERVICE_NAME = "com.apple.pcapd.shim.remote"
341
+ SERVICE_NAME = "com.apple.pcapd"
337
342
 
338
343
  def __init__(self, lockdown: LockdownServiceProvider):
339
344
  if isinstance(lockdown, LockdownClient):
@@ -341,8 +346,9 @@ class PcapdService(LockdownService):
341
346
  else:
342
347
  super().__init__(lockdown, self.RSD_SERVICE_NAME)
343
348
 
344
- def watch(self, packets_count: int = -1, process: Optional[str] = None, interface_name: Optional[str] = None) \
345
- -> Generator[Container, None, None]:
349
+ def watch(
350
+ self, packets_count: int = -1, process: Optional[str] = None, interface_name: Optional[str] = None
351
+ ) -> Generator[Container, None, None]:
346
352
  packet_index = 0
347
353
  while packet_index != packets_count:
348
354
  d = self.service.recv_plist()
@@ -351,13 +357,11 @@ class PcapdService(LockdownService):
351
357
 
352
358
  packet = device_packet_struct.parse(d)
353
359
 
354
- if process is not None:
355
- if process != str(packet.pid) and process != packet.comm:
356
- continue
360
+ if process is not None and process != str(packet.pid) and process != packet.comm:
361
+ continue
357
362
 
358
- if interface_name is not None:
359
- if interface_name != packet.interface_name:
360
- continue
363
+ if interface_name is not None and interface_name != packet.interface_name:
364
+ continue
361
365
 
362
366
  packet.interface_type = INTERFACE_NAMES(packet.interface_type)
363
367
  packet.protocol_family = CrossPlatformAddressFamily(packet.protocol_family)
@@ -365,7 +369,7 @@ class PcapdService(LockdownService):
365
369
  if not packet.frame_pre_length:
366
370
  # Add fake ethernet header for pdp packets.
367
371
  packet.data = ETHERNET_HEADER + packet.data
368
- elif packet.interface_name == 'pdp_ip':
372
+ elif packet.interface_name == "pdp_ip":
369
373
  packet.data = ETHERNET_HEADER + packet.data[4:]
370
374
 
371
375
  yield packet
@@ -375,26 +379,34 @@ class PcapdService(LockdownService):
375
379
  def write_to_pcap(self, out, packet_generator) -> None:
376
380
  shb = blocks.SectionHeader(
377
381
  options={
378
- 'shb_hardware': 'artificial',
379
- 'shb_os': 'iOS',
380
- 'shb_userappl': 'pymobiledevice3',
382
+ "shb_hardware": "artificial",
383
+ "shb_os": "iOS",
384
+ "shb_userappl": "pymobiledevice3",
381
385
  }
382
386
  )
383
387
  shb.new_member(
384
388
  blocks.InterfaceDescription,
385
389
  link_type=1,
386
- options={
387
- 'if_description': 'iOS Packet Capture',
388
- 'if_os': f'iOS {self.lockdown.product_version}'
389
- },
390
+ options={"if_description": "iOS Packet Capture", "if_os": f"iOS {self.lockdown.product_version}"},
390
391
  )
391
392
  writer = FileWriter(out, shb)
392
393
 
393
394
  for packet in packet_generator:
394
- enhanced_packet = shb.new_member(blocks.EnhancedPacket, options={
395
- 'opt_comment': f'PID: {packet.pid}, ProcName: {packet.comm}, EPID: {packet.epid}, '
396
- f'EProcName: {packet.ecomm}, SVC: {packet.svc}'
397
- })
395
+ packet_time = packet.timestamp if hasattr(packet, "timestamp") else time.time()
396
+
397
+ timestamp_microseconds = int(packet_time * 1_000_000)
398
+ timestamp_high = (timestamp_microseconds >> 32) & 0xFFFFFFFF
399
+ timestamp_low = timestamp_microseconds & 0xFFFFFFFF
400
+
401
+ enhanced_packet = shb.new_member(
402
+ blocks.EnhancedPacket,
403
+ options={
404
+ "opt_comment": f"PID: {packet.pid}, ProcName: {packet.comm}, EPID: {packet.epid}, "
405
+ f"EProcName: {packet.ecomm}, SVC: {packet.svc}"
406
+ },
407
+ )
398
408
 
399
409
  enhanced_packet.packet_data = packet.data
410
+ enhanced_packet.timestamp_high = timestamp_high
411
+ enhanced_packet.timestamp_low = timestamp_low
400
412
  writer.write_block(enhanced_packet)