Skip to content

Commit 2a37990

Browse files
committed
Fix iOS Frida bug for devices with - in UDID
I had assumed that wasn't valid, and I'm definitely wrong, so we need to catch that case. We now use a much less likely separator, and join again anyway just in case it comes up somehow.
1 parent c7154c6 commit 2a37990

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/interceptors/frida/frida-ios-integration.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ export async function getIosFridaHosts(usbmuxClient: UsbmuxClient): Promise<Reco
5959
));
6060
}
6161

62+
const HOST_ID_SEPARATOR = '---';
63+
6264
const getHostDetails = async (usbmuxClient: UsbmuxClient, deviceId: number) => {
6365
const deviceMetadataPromise = usbmuxClient.queryAllDeviceValues(deviceId);
6466

@@ -81,17 +83,17 @@ const getHostDetails = async (usbmuxClient: UsbmuxClient, deviceId: number) => {
8183
'Unknown iOS Device';
8284

8385
return {
84-
id: `${deviceId}-${deviceMetadata.UniqueDeviceID}`, // Host id = both (to avoid deviceid change races)
86+
id: `${deviceId}${HOST_ID_SEPARATOR}${deviceMetadata.UniqueDeviceID}`, // Host id = both (to avoid deviceid change races)
8587
name: deviceName,
8688
type: 'ios',
8789
state
8890
} as const;
8991
};
9092

9193
async function getDeviceId(usbmuxClient: UsbmuxClient, hostId: string) {
92-
const parts = hostId.split('-');
94+
const parts = hostId.split(HOST_ID_SEPARATOR);
9395
const deviceId = parseInt(parts[0]);
94-
const udid = parts[1];
96+
const udid = parts.slice(1).join(HOST_ID_SEPARATOR);
9597

9698
const realUdid = await usbmuxClient.queryDeviceValue(deviceId, 'UniqueDeviceID');
9799

0 commit comments

Comments
 (0)