pymobiledevice3 5.0.1__py3-none-any.whl → 5.0.2__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.
Potentially problematic release.
This version of pymobiledevice3 might be problematic. Click here for more details.
- misc/plist_sniffer.py +15 -15
- misc/remotexpc_sniffer.py +29 -28
- pymobiledevice3/__main__.py +128 -102
- pymobiledevice3/_version.py +2 -2
- pymobiledevice3/bonjour.py +26 -49
- pymobiledevice3/ca.py +32 -24
- pymobiledevice3/cli/activation.py +7 -7
- pymobiledevice3/cli/afc.py +19 -19
- pymobiledevice3/cli/amfi.py +4 -4
- pymobiledevice3/cli/apps.py +51 -39
- pymobiledevice3/cli/backup.py +58 -32
- pymobiledevice3/cli/bonjour.py +25 -18
- pymobiledevice3/cli/cli_common.py +112 -81
- pymobiledevice3/cli/companion_proxy.py +4 -4
- pymobiledevice3/cli/completions.py +10 -10
- pymobiledevice3/cli/crash.py +37 -31
- pymobiledevice3/cli/developer.py +602 -520
- pymobiledevice3/cli/diagnostics.py +38 -33
- pymobiledevice3/cli/lockdown.py +79 -74
- pymobiledevice3/cli/mounter.py +85 -68
- pymobiledevice3/cli/notification.py +10 -10
- pymobiledevice3/cli/pcap.py +19 -14
- pymobiledevice3/cli/power_assertion.py +12 -10
- pymobiledevice3/cli/processes.py +10 -10
- pymobiledevice3/cli/profile.py +88 -77
- pymobiledevice3/cli/provision.py +17 -17
- pymobiledevice3/cli/remote.py +186 -110
- pymobiledevice3/cli/restore.py +43 -40
- pymobiledevice3/cli/springboard.py +30 -28
- pymobiledevice3/cli/syslog.py +85 -58
- pymobiledevice3/cli/usbmux.py +21 -20
- pymobiledevice3/cli/version.py +3 -2
- pymobiledevice3/cli/webinspector.py +157 -79
- pymobiledevice3/common.py +1 -1
- pymobiledevice3/exceptions.py +154 -60
- pymobiledevice3/irecv.py +49 -53
- pymobiledevice3/irecv_devices.py +1489 -492
- pymobiledevice3/lockdown.py +394 -241
- pymobiledevice3/lockdown_service_provider.py +5 -7
- pymobiledevice3/osu/os_utils.py +18 -9
- pymobiledevice3/osu/posix_util.py +28 -15
- pymobiledevice3/osu/win_util.py +14 -8
- pymobiledevice3/pair_records.py +19 -19
- pymobiledevice3/remote/common.py +4 -4
- pymobiledevice3/remote/core_device/app_service.py +94 -67
- pymobiledevice3/remote/core_device/core_device_service.py +17 -14
- pymobiledevice3/remote/core_device/device_info.py +5 -5
- pymobiledevice3/remote/core_device/diagnostics_service.py +10 -8
- pymobiledevice3/remote/core_device/file_service.py +47 -33
- pymobiledevice3/remote/remote_service_discovery.py +53 -35
- pymobiledevice3/remote/remotexpc.py +62 -41
- pymobiledevice3/remote/tunnel_service.py +371 -293
- pymobiledevice3/remote/utils.py +12 -11
- pymobiledevice3/remote/xpc_message.py +145 -125
- pymobiledevice3/resources/dsc_uuid_map.py +19 -19
- pymobiledevice3/resources/firmware_notifications.py +16 -16
- pymobiledevice3/restore/asr.py +27 -27
- pymobiledevice3/restore/base_restore.py +90 -47
- pymobiledevice3/restore/consts.py +87 -66
- pymobiledevice3/restore/device.py +11 -11
- pymobiledevice3/restore/fdr.py +46 -46
- pymobiledevice3/restore/ftab.py +19 -19
- pymobiledevice3/restore/img4.py +130 -133
- pymobiledevice3/restore/mbn.py +35 -54
- pymobiledevice3/restore/recovery.py +125 -135
- pymobiledevice3/restore/restore.py +524 -523
- pymobiledevice3/restore/restore_options.py +122 -115
- pymobiledevice3/restore/restored_client.py +25 -22
- pymobiledevice3/restore/tss.py +378 -270
- pymobiledevice3/service_connection.py +50 -46
- pymobiledevice3/services/accessibilityaudit.py +136 -126
- pymobiledevice3/services/afc.py +350 -291
- pymobiledevice3/services/amfi.py +21 -18
- pymobiledevice3/services/companion.py +23 -19
- pymobiledevice3/services/crash_reports.py +60 -46
- pymobiledevice3/services/debugserver_applist.py +3 -3
- pymobiledevice3/services/device_arbitration.py +8 -8
- pymobiledevice3/services/device_link.py +55 -47
- pymobiledevice3/services/diagnostics.py +971 -968
- pymobiledevice3/services/dtfetchsymbols.py +8 -8
- pymobiledevice3/services/dvt/dvt_secure_socket_proxy.py +4 -4
- pymobiledevice3/services/dvt/dvt_testmanaged_proxy.py +4 -4
- pymobiledevice3/services/dvt/instruments/activity_trace_tap.py +85 -74
- pymobiledevice3/services/dvt/instruments/application_listing.py +2 -3
- pymobiledevice3/services/dvt/instruments/condition_inducer.py +7 -6
- pymobiledevice3/services/dvt/instruments/core_profile_session_tap.py +442 -421
- pymobiledevice3/services/dvt/instruments/device_info.py +11 -11
- pymobiledevice3/services/dvt/instruments/energy_monitor.py +1 -1
- pymobiledevice3/services/dvt/instruments/graphics.py +1 -1
- pymobiledevice3/services/dvt/instruments/location_simulation.py +1 -1
- pymobiledevice3/services/dvt/instruments/location_simulation_base.py +10 -10
- pymobiledevice3/services/dvt/instruments/network_monitor.py +17 -17
- pymobiledevice3/services/dvt/instruments/notifications.py +1 -1
- pymobiledevice3/services/dvt/instruments/process_control.py +25 -10
- pymobiledevice3/services/dvt/instruments/screenshot.py +2 -2
- pymobiledevice3/services/dvt/instruments/sysmontap.py +15 -15
- pymobiledevice3/services/dvt/testmanaged/xcuitest.py +40 -50
- pymobiledevice3/services/file_relay.py +10 -10
- pymobiledevice3/services/heartbeat.py +8 -7
- pymobiledevice3/services/house_arrest.py +12 -15
- pymobiledevice3/services/installation_proxy.py +119 -100
- pymobiledevice3/services/lockdown_service.py +12 -5
- pymobiledevice3/services/misagent.py +22 -19
- pymobiledevice3/services/mobile_activation.py +84 -72
- pymobiledevice3/services/mobile_config.py +330 -301
- pymobiledevice3/services/mobile_image_mounter.py +137 -116
- pymobiledevice3/services/mobilebackup2.py +188 -150
- pymobiledevice3/services/notification_proxy.py +11 -11
- pymobiledevice3/services/os_trace.py +69 -51
- pymobiledevice3/services/pcapd.py +306 -306
- pymobiledevice3/services/power_assertion.py +10 -9
- pymobiledevice3/services/preboard.py +4 -4
- pymobiledevice3/services/remote_fetch_symbols.py +16 -14
- pymobiledevice3/services/remote_server.py +176 -146
- pymobiledevice3/services/restore_service.py +16 -16
- pymobiledevice3/services/screenshot.py +13 -10
- pymobiledevice3/services/simulate_location.py +7 -7
- pymobiledevice3/services/springboard.py +15 -15
- pymobiledevice3/services/syslog.py +5 -5
- pymobiledevice3/services/web_protocol/alert.py +3 -3
- pymobiledevice3/services/web_protocol/automation_session.py +180 -176
- pymobiledevice3/services/web_protocol/cdp_screencast.py +44 -36
- pymobiledevice3/services/web_protocol/cdp_server.py +19 -19
- pymobiledevice3/services/web_protocol/cdp_target.py +411 -373
- pymobiledevice3/services/web_protocol/driver.py +47 -45
- pymobiledevice3/services/web_protocol/element.py +74 -63
- pymobiledevice3/services/web_protocol/inspector_session.py +106 -102
- pymobiledevice3/services/web_protocol/selenium_api.py +2 -2
- pymobiledevice3/services/web_protocol/session_protocol.py +15 -10
- pymobiledevice3/services/web_protocol/switch_to.py +11 -12
- pymobiledevice3/services/webinspector.py +127 -116
- pymobiledevice3/tcp_forwarder.py +35 -22
- pymobiledevice3/tunneld/api.py +20 -15
- pymobiledevice3/tunneld/server.py +212 -133
- pymobiledevice3/usbmux.py +183 -138
- pymobiledevice3/utils.py +14 -11
- {pymobiledevice3-5.0.1.dist-info → pymobiledevice3-5.0.2.dist-info}/METADATA +1 -1
- pymobiledevice3-5.0.2.dist-info/RECORD +173 -0
- pymobiledevice3-5.0.1.dist-info/RECORD +0 -173
- {pymobiledevice3-5.0.1.dist-info → pymobiledevice3-5.0.2.dist-info}/WHEEL +0 -0
- {pymobiledevice3-5.0.1.dist-info → pymobiledevice3-5.0.2.dist-info}/entry_points.txt +0 -0
- {pymobiledevice3-5.0.1.dist-info → pymobiledevice3-5.0.2.dist-info}/licenses/LICENSE +0 -0
- {pymobiledevice3-5.0.1.dist-info → pymobiledevice3-5.0.2.dist-info}/top_level.txt +0 -0
|
@@ -18,8 +18,8 @@ from pymobiledevice3.services.lockdown_service import LockdownService
|
|
|
18
18
|
from pymobiledevice3.utils import try_decode
|
|
19
19
|
|
|
20
20
|
CHUNK_SIZE = 4096
|
|
21
|
-
TIME_FORMAT =
|
|
22
|
-
SYSLOG_LINE_SPLITTER =
|
|
21
|
+
TIME_FORMAT = "%H:%M:%S"
|
|
22
|
+
SYSLOG_LINE_SPLITTER = "\n\x00"
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
class SyslogLogLevel(IntEnum):
|
|
@@ -58,38 +58,37 @@ class TimestampAdapter(Adapter):
|
|
|
58
58
|
return list(map(int, obj.split(".")))
|
|
59
59
|
|
|
60
60
|
|
|
61
|
-
timestamp_t = Struct(
|
|
62
|
-
'seconds' / Int32ul,
|
|
63
|
-
Bytes(4),
|
|
64
|
-
'microseconds' / Int32ul
|
|
65
|
-
)
|
|
61
|
+
timestamp_t = Struct("seconds" / Int32ul, Bytes(4), "microseconds" / Int32ul)
|
|
66
62
|
|
|
67
63
|
syslog_t = Struct(
|
|
68
64
|
Bytes(9),
|
|
69
|
-
|
|
65
|
+
"pid" / Int32ul,
|
|
70
66
|
Bytes(42),
|
|
71
|
-
|
|
67
|
+
"timestamp" / TimestampAdapter(timestamp_t),
|
|
72
68
|
Bytes(1),
|
|
73
|
-
|
|
69
|
+
"level" / Enum(Byte, Notice=0, Info=0x01, Debug=0x02, Error=0x10, Fault=0x11),
|
|
74
70
|
Bytes(38),
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
"image_name_size" / Int16ul,
|
|
72
|
+
"message_size" / Int16ul,
|
|
77
73
|
Bytes(6),
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
"_subsystem_size" / Int32ul,
|
|
75
|
+
"_category_size" / Int32ul,
|
|
80
76
|
Bytes(4),
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
77
|
+
"_filename" / RepeatUntil(lambda x, lst, ctx: lst[-1] == 0, Byte),
|
|
78
|
+
"filename" / Computed(lambda ctx: try_decode(bytearray(ctx._filename[:-1]))),
|
|
79
|
+
"_image_name" / Bytes(this.image_name_size),
|
|
80
|
+
"image_name" / Computed(lambda ctx: try_decode(ctx._image_name[:-1])),
|
|
81
|
+
"_message" / Bytes(this.message_size),
|
|
82
|
+
"message" / Computed(lambda ctx: try_decode(ctx._message[:-1])),
|
|
83
|
+
"label"
|
|
84
|
+
/ Optional(
|
|
85
|
+
Struct(
|
|
86
|
+
"_subsystem" / Bytes(this._._subsystem_size),
|
|
87
|
+
"subsystem" / Computed(lambda ctx: try_decode(ctx._subsystem[:-1])),
|
|
88
|
+
"_category" / Bytes(this._._category_size),
|
|
89
|
+
"category" / Computed(lambda ctx: try_decode(ctx._category[:-1])),
|
|
90
|
+
)
|
|
91
|
+
),
|
|
93
92
|
)
|
|
94
93
|
|
|
95
94
|
|
|
@@ -101,8 +100,9 @@ class OsTraceService(LockdownService):
|
|
|
101
100
|
* Get old stored syslog archive in PAX format (can be extracted using `pax -r < filename`).
|
|
102
101
|
* Archive contain the contents are the `/var/db/diagnostics` directory
|
|
103
102
|
"""
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
|
|
104
|
+
SERVICE_NAME = "com.apple.os_trace_relay"
|
|
105
|
+
RSD_SERVICE_NAME = "com.apple.os_trace_relay.shim.remote"
|
|
106
106
|
|
|
107
107
|
def __init__(self, lockdown: LockdownServiceProvider):
|
|
108
108
|
if isinstance(lockdown, LockdownClient):
|
|
@@ -111,7 +111,7 @@ class OsTraceService(LockdownService):
|
|
|
111
111
|
super().__init__(lockdown, self.RSD_SERVICE_NAME)
|
|
112
112
|
|
|
113
113
|
def get_pid_list(self):
|
|
114
|
-
self.service.send_plist({
|
|
114
|
+
self.service.send_plist({"Request": "PidList"})
|
|
115
115
|
|
|
116
116
|
# ignore first received unknown byte
|
|
117
117
|
self.service.recvall(1)
|
|
@@ -119,33 +119,44 @@ class OsTraceService(LockdownService):
|
|
|
119
119
|
response = self.service.recv_prefixed()
|
|
120
120
|
return plistlib.loads(response)
|
|
121
121
|
|
|
122
|
-
def create_archive(
|
|
123
|
-
|
|
122
|
+
def create_archive(
|
|
123
|
+
self,
|
|
124
|
+
out: typing.IO,
|
|
125
|
+
size_limit: typing.Optional[int] = None,
|
|
126
|
+
age_limit: typing.Optional[int] = None,
|
|
127
|
+
start_time: typing.Optional[int] = None,
|
|
128
|
+
):
|
|
129
|
+
request = {"Request": "CreateArchive"}
|
|
124
130
|
|
|
125
131
|
if size_limit is not None:
|
|
126
|
-
request.update({
|
|
132
|
+
request.update({"SizeLimit": size_limit})
|
|
127
133
|
|
|
128
134
|
if age_limit is not None:
|
|
129
|
-
request.update({
|
|
135
|
+
request.update({"AgeLimit": age_limit})
|
|
130
136
|
|
|
131
137
|
if start_time is not None:
|
|
132
|
-
request.update({
|
|
138
|
+
request.update({"StartTime": start_time})
|
|
133
139
|
|
|
134
140
|
self.service.send_plist(request)
|
|
135
141
|
|
|
136
|
-
assert
|
|
142
|
+
assert self.service.recvall(1)[0] == 1
|
|
137
143
|
|
|
138
|
-
assert plistlib.loads(self.service.recv_prefixed()).get(
|
|
144
|
+
assert plistlib.loads(self.service.recv_prefixed()).get("Status") == "RequestSuccessful", "Invalid status"
|
|
139
145
|
|
|
140
146
|
while True:
|
|
141
147
|
try:
|
|
142
|
-
assert
|
|
148
|
+
assert self.service.recvall(1)[0] == 3, "invalid magic"
|
|
143
149
|
except ConnectionAbortedError:
|
|
144
150
|
break
|
|
145
|
-
out.write(self.service.recv_prefixed(endianity=
|
|
146
|
-
|
|
147
|
-
def collect(
|
|
148
|
-
|
|
151
|
+
out.write(self.service.recv_prefixed(endianity="<"))
|
|
152
|
+
|
|
153
|
+
def collect(
|
|
154
|
+
self,
|
|
155
|
+
out: str,
|
|
156
|
+
size_limit: typing.Optional[int] = None,
|
|
157
|
+
age_limit: typing.Optional[int] = None,
|
|
158
|
+
start_time: typing.Optional[int] = None,
|
|
159
|
+
) -> None:
|
|
149
160
|
"""
|
|
150
161
|
Collect the system logs into a .logarchive that can be viewed later with tools such as log or Console.
|
|
151
162
|
|
|
@@ -155,28 +166,35 @@ class OsTraceService(LockdownService):
|
|
|
155
166
|
:param start_time: start time of logarchive in unix timestamp
|
|
156
167
|
"""
|
|
157
168
|
with tempfile.TemporaryDirectory() as temp_dir:
|
|
158
|
-
file = Path(temp_dir) /
|
|
159
|
-
with open(file,
|
|
169
|
+
file = Path(temp_dir) / "foo.tar"
|
|
170
|
+
with open(file, "wb") as f:
|
|
160
171
|
self.create_archive(f, size_limit=size_limit, age_limit=age_limit, start_time=start_time)
|
|
161
172
|
TarFile(file).extractall(out)
|
|
162
173
|
|
|
163
174
|
def syslog(self, pid=-1) -> typing.Generator[SyslogEntry, None, None]:
|
|
164
|
-
self.service.send_plist({
|
|
175
|
+
self.service.send_plist({"Request": "StartActivity", "MessageFilter": 65535, "Pid": pid, "StreamFlags": 60})
|
|
165
176
|
|
|
166
|
-
length_length, = struct.unpack(
|
|
177
|
+
(length_length,) = struct.unpack("<I", self.service.recvall(4))
|
|
167
178
|
length = int(self.service.recvall(length_length)[::-1].hex(), 16)
|
|
168
179
|
response = plistlib.loads(self.service.recvall(length))
|
|
169
180
|
|
|
170
|
-
if response.get(
|
|
171
|
-
raise PyMobileDevice3Exception(f
|
|
181
|
+
if response.get("Status") != "RequestSuccessful":
|
|
182
|
+
raise PyMobileDevice3Exception(f"got invalid response: {response}")
|
|
172
183
|
|
|
173
184
|
while True:
|
|
174
|
-
assert
|
|
175
|
-
length, = struct.unpack(
|
|
185
|
+
assert self.service.recvall(1) == b"\x02"
|
|
186
|
+
(length,) = struct.unpack("<I", self.service.recvall(4))
|
|
176
187
|
line = self.service.recvall(length)
|
|
177
188
|
entry = syslog_t.parse(line)
|
|
178
189
|
label = None
|
|
179
190
|
if entry.label is not None:
|
|
180
191
|
label = SyslogLabel(subsystem=entry.label.subsystem, category=entry.label.category)
|
|
181
|
-
yield SyslogEntry(
|
|
182
|
-
|
|
192
|
+
yield SyslogEntry(
|
|
193
|
+
pid=entry.pid,
|
|
194
|
+
timestamp=entry.timestamp,
|
|
195
|
+
level=SyslogLogLevel(int(entry.level)),
|
|
196
|
+
image_name=entry.image_name,
|
|
197
|
+
filename=entry.filename,
|
|
198
|
+
message=entry.message,
|
|
199
|
+
label=label,
|
|
200
|
+
)
|