appium-ios-remotexpc 0.10.2 → 0.12.0
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.
- package/CHANGELOG.md +12 -0
- package/README.md +28 -0
- package/build/src/index.d.ts +1 -1
- package/build/src/index.d.ts.map +1 -1
- package/build/src/lib/apple-tv/encryption/chacha20-poly1305.js +2 -2
- package/build/src/lib/apple-tv/encryption/ed25519.js +2 -2
- package/build/src/lib/apple-tv/encryption/hkdf.js +2 -2
- package/build/src/lib/apple-tv/srp/srp-client.js +2 -2
- package/build/src/lib/bonjour/bonjour-discovery.d.ts.map +1 -1
- package/build/src/lib/bonjour/bonjour-discovery.js +2 -2
- package/build/src/lib/lockdown/index.d.ts.map +1 -1
- package/build/src/lib/lockdown/index.js +4 -4
- package/build/src/lib/logger.d.ts +2 -0
- package/build/src/lib/logger.d.ts.map +1 -0
- package/build/src/lib/logger.js +7 -0
- package/build/src/lib/pair-record/pair-record.d.ts.map +1 -1
- package/build/src/lib/pair-record/pair-record.js +2 -2
- package/build/src/lib/plist/binary-plist-parser.d.ts.map +1 -1
- package/build/src/lib/plist/binary-plist-parser.js +2 -2
- package/build/src/lib/plist/length-based-splitter.d.ts.map +1 -1
- package/build/src/lib/plist/length-based-splitter.js +2 -2
- package/build/src/lib/plist/plist-decoder.d.ts.map +1 -1
- package/build/src/lib/plist/plist-decoder.js +2 -2
- package/build/src/lib/plist/plist-parser.js +2 -2
- package/build/src/lib/plist/plist-service.d.ts.map +1 -1
- package/build/src/lib/plist/plist-service.js +3 -3
- package/build/src/lib/remote-xpc/remote-xpc-connection.js +2 -2
- package/build/src/lib/tss/index.js +2 -2
- package/build/src/lib/tunnel/index.d.ts.map +1 -1
- package/build/src/lib/tunnel/index.js +2 -2
- package/build/src/lib/tunnel/packet-stream-client.d.ts.map +1 -1
- package/build/src/lib/tunnel/packet-stream-client.js +2 -2
- package/build/src/lib/tunnel/packet-stream-server.d.ts.map +1 -1
- package/build/src/lib/tunnel/packet-stream-server.js +2 -2
- package/build/src/lib/tunnel/tunnel-api-client.d.ts.map +1 -1
- package/build/src/lib/tunnel/tunnel-api-client.js +2 -2
- package/build/src/lib/tunnel/tunnel-registry-server.js +2 -2
- package/build/src/lib/types.d.ts +69 -0
- package/build/src/lib/types.d.ts.map +1 -1
- package/build/src/lib/types.js +1 -0
- package/build/src/lib/usbmux/index.d.ts.map +1 -1
- package/build/src/lib/usbmux/index.js +2 -2
- package/build/src/services/ios/afc/index.d.ts.map +1 -1
- package/build/src/services/ios/afc/index.js +2 -2
- package/build/src/services/ios/base-service.d.ts.map +1 -1
- package/build/src/services/ios/base-service.js +2 -2
- package/build/src/services/ios/diagnostic-service/index.d.ts.map +1 -1
- package/build/src/services/ios/diagnostic-service/index.js +2 -2
- package/build/src/services/ios/misagent/index.d.ts +17 -0
- package/build/src/services/ios/misagent/index.d.ts.map +1 -0
- package/build/src/services/ios/misagent/index.js +79 -0
- package/build/src/services/ios/misagent/provisioning-profile.d.ts +10 -0
- package/build/src/services/ios/misagent/provisioning-profile.d.ts.map +1 -0
- package/build/src/services/ios/misagent/provisioning-profile.js +33 -0
- package/build/src/services/ios/mobile-config/index.d.ts.map +1 -1
- package/build/src/services/ios/mobile-config/index.js +3 -2
- package/build/src/services/ios/mobile-image-mounter/index.js +2 -2
- package/build/src/services/ios/notification-proxy/index.d.ts.map +1 -1
- package/build/src/services/ios/notification-proxy/index.js +2 -2
- package/build/src/services/ios/power-assertion/index.d.ts.map +1 -1
- package/build/src/services/ios/power-assertion/index.js +2 -2
- package/build/src/services/ios/syslog-service/index.d.ts.map +1 -1
- package/build/src/services/ios/syslog-service/index.js +3 -3
- package/build/src/services/ios/tunnel-service/index.d.ts.map +1 -1
- package/build/src/services/ios/tunnel-service/index.js +2 -2
- package/build/src/services/ios/webinspector/index.js +2 -2
- package/build/src/services.d.ts +2 -1
- package/build/src/services.d.ts.map +1 -1
- package/build/src/services.js +12 -0
- package/package.json +2 -1
- package/src/index.ts +2 -0
- package/src/lib/apple-tv/encryption/chacha20-poly1305.ts +2 -2
- package/src/lib/apple-tv/encryption/ed25519.ts +2 -2
- package/src/lib/apple-tv/encryption/hkdf.ts +2 -2
- package/src/lib/apple-tv/srp/srp-client.ts +2 -2
- package/src/lib/bonjour/bonjour-discovery.ts +2 -2
- package/src/lib/lockdown/index.ts +4 -4
- package/src/lib/logger.ts +9 -0
- package/src/lib/pair-record/pair-record.ts +3 -2
- package/src/lib/plist/binary-plist-parser.ts +2 -3
- package/src/lib/plist/length-based-splitter.ts +2 -2
- package/src/lib/plist/plist-decoder.ts +2 -2
- package/src/lib/plist/plist-parser.ts +2 -2
- package/src/lib/plist/plist-service.ts +3 -3
- package/src/lib/remote-xpc/remote-xpc-connection.ts +2 -2
- package/src/lib/tss/index.ts +2 -2
- package/src/lib/tunnel/index.ts +2 -2
- package/src/lib/tunnel/packet-stream-client.ts +3 -2
- package/src/lib/tunnel/packet-stream-server.ts +3 -2
- package/src/lib/tunnel/tunnel-api-client.ts +2 -3
- package/src/lib/tunnel/tunnel-registry-server.ts +2 -2
- package/src/lib/types.ts +72 -0
- package/src/lib/usbmux/index.ts +2 -2
- package/src/services/ios/afc/index.ts +2 -2
- package/src/services/ios/base-service.ts +2 -3
- package/src/services/ios/diagnostic-service/index.ts +2 -3
- package/src/services/ios/misagent/index.ts +110 -0
- package/src/services/ios/misagent/provisioning-profile.ts +44 -0
- package/src/services/ios/mobile-config/index.ts +3 -2
- package/src/services/ios/mobile-image-mounter/index.ts +2 -2
- package/src/services/ios/notification-proxy/index.ts +2 -3
- package/src/services/ios/power-assertion/index.ts +2 -3
- package/src/services/ios/syslog-service/index.ts +3 -3
- package/src/services/ios/tunnel-service/index.ts +2 -2
- package/src/services/ios/webinspector/index.ts +2 -2
- package/src/services.ts +18 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { logger } from '@appium/support';
|
|
2
1
|
import { Transform, type TransformCallback } from 'stream';
|
|
3
2
|
|
|
3
|
+
import { getLogger } from '../logger.js';
|
|
4
4
|
import { UTF8_ENCODING } from './constants.js';
|
|
5
5
|
import { parsePlist } from './unified-plist-parser.js';
|
|
6
6
|
import {
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
hasUnicodeReplacementCharacter,
|
|
11
11
|
} from './utils.js';
|
|
12
12
|
|
|
13
|
-
const log =
|
|
13
|
+
const log = getLogger('Plist');
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Decodes plist format data with length prefix to JavaScript objects
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { logger } from '@appium/support';
|
|
2
1
|
import { DOMParser, Element, Node } from '@xmldom/xmldom';
|
|
3
2
|
|
|
3
|
+
import { getLogger } from '../logger.js';
|
|
4
4
|
import type { PlistArray, PlistDictionary, PlistValue } from '../types.js';
|
|
5
5
|
import { PlistService } from './plist-service.js';
|
|
6
6
|
import {
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
trimBeforeXmlDeclaration,
|
|
15
15
|
} from './utils.js';
|
|
16
16
|
|
|
17
|
-
const errorLog =
|
|
17
|
+
const errorLog = getLogger('PlistError');
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Parses an XML plist string into a JavaScript object
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { logger } from '@appium/support';
|
|
2
1
|
import { Socket } from 'net';
|
|
3
2
|
import { TLSSocket } from 'tls';
|
|
4
3
|
|
|
4
|
+
import { getLogger } from '../logger.js';
|
|
5
5
|
import type { PlistDictionary } from '../types.js';
|
|
6
6
|
import { LengthBasedSplitter } from './length-based-splitter.js';
|
|
7
7
|
import { PlistServiceDecoder } from './plist-decoder.js';
|
|
8
8
|
import { PlistServiceEncoder } from './plist-encoder.js';
|
|
9
9
|
|
|
10
|
-
const log =
|
|
11
|
-
const errorLog =
|
|
10
|
+
const log = getLogger('Plist');
|
|
11
|
+
const errorLog = getLogger('PlistError');
|
|
12
12
|
|
|
13
13
|
const config = {
|
|
14
14
|
verboseErrorLogging: false,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { logger } from '@appium/support';
|
|
2
1
|
import net from 'node:net';
|
|
3
2
|
|
|
3
|
+
import { getLogger } from '../logger.js';
|
|
4
4
|
import Handshake from './handshake.js';
|
|
5
5
|
|
|
6
|
-
const log =
|
|
6
|
+
const log = getLogger('RemoteXpcConnection');
|
|
7
7
|
|
|
8
8
|
// Timeout constants
|
|
9
9
|
const CONNECTION_TIMEOUT_MS = 30000; // 30 seconds
|
package/src/lib/tss/index.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { logger } from '@appium/support';
|
|
2
1
|
import axios from 'axios';
|
|
3
2
|
import { randomUUID } from 'node:crypto';
|
|
4
3
|
|
|
4
|
+
import { getLogger } from '../logger.js';
|
|
5
5
|
import { createPlist, parsePlist } from '../plist/index.js';
|
|
6
6
|
import type { PlistDictionary } from '../types.js';
|
|
7
7
|
|
|
8
|
-
const log =
|
|
8
|
+
const log = getLogger('TSSRequestor');
|
|
9
9
|
|
|
10
10
|
// TSS Constants
|
|
11
11
|
const TSS_CONTROLLER_ACTION_URL = 'http://gs.apple.com/TSS/controller?action=2';
|
package/src/lib/tunnel/index.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { logger } from '@appium/support';
|
|
2
1
|
import {
|
|
3
2
|
type TunnelConnection,
|
|
4
3
|
connectToTunnelLockdown,
|
|
5
4
|
} from 'appium-ios-tuntap';
|
|
6
5
|
import type { TLSSocket } from 'tls';
|
|
7
6
|
|
|
7
|
+
import { getLogger } from '../logger.js';
|
|
8
8
|
import { RemoteXpcConnection } from '../remote-xpc/remote-xpc-connection.js';
|
|
9
9
|
|
|
10
|
-
const log =
|
|
10
|
+
const log = getLogger('TunnelManager');
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Interface for tunnel registry entry
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { logger } from '@appium/support';
|
|
2
1
|
import type { PacketConsumer, PacketData } from 'appium-ios-tuntap';
|
|
3
2
|
import { EventEmitter } from 'events';
|
|
4
3
|
import { type Socket, createConnection } from 'net';
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
import { getLogger } from '../logger.js';
|
|
6
|
+
|
|
7
|
+
const log = getLogger('PacketStreamClient');
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Constants for packet stream protocol
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { logger } from '@appium/support';
|
|
2
1
|
import type { PacketConsumer, PacketData } from 'appium-ios-tuntap';
|
|
3
2
|
import { EventEmitter } from 'events';
|
|
4
3
|
import { type Server, type Socket, createServer } from 'net';
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
import { getLogger } from '../logger.js';
|
|
6
|
+
|
|
7
|
+
const log = getLogger('PacketStreamServer');
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Interface for serialized packet message
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { getLogger } from '../logger.js';
|
|
3
2
|
import type { TunnelRegistry, TunnelRegistryEntry } from '../types.js';
|
|
4
3
|
|
|
5
|
-
const log =
|
|
4
|
+
const log = getLogger('TunnelApiClient');
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* API client for tunnel registry operations
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { logger } from '@appium/support';
|
|
2
1
|
import * as http from 'node:http';
|
|
3
2
|
import { URL } from 'node:url';
|
|
4
3
|
|
|
4
|
+
import { getLogger } from '../logger.js';
|
|
5
5
|
import type { TunnelRegistry, TunnelRegistryEntry } from '../types.js';
|
|
6
6
|
|
|
7
7
|
// Constants
|
|
@@ -9,7 +9,7 @@ const DEFAULT_TUNNEL_REGISTRY_PORT = 42314;
|
|
|
9
9
|
const API_BASE_PATH = '/remotexpc/tunnels';
|
|
10
10
|
|
|
11
11
|
// Logger instance
|
|
12
|
-
const log =
|
|
12
|
+
const log = getLogger('TunnelRegistryServer');
|
|
13
13
|
|
|
14
14
|
// Helper functions
|
|
15
15
|
/**
|
package/src/lib/types.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { EventEmitter } from 'events';
|
|
|
6
6
|
|
|
7
7
|
import type { ServiceConnection } from '../service-connection.js';
|
|
8
8
|
import type { BaseService, Service } from '../services/ios/base-service.js';
|
|
9
|
+
import { ProvisioningProfile } from '../services/ios/misagent/provisioning-profile.js';
|
|
9
10
|
import type { PowerAssertionOptions } from '../services/ios/power-assertion/index.js';
|
|
10
11
|
import { PowerAssertionType } from '../services/ios/power-assertion/index.js';
|
|
11
12
|
import type { InterfaceOrientation } from '../services/ios/springboard-service/index.js';
|
|
@@ -768,3 +769,74 @@ export interface SpringboardServiceWithConnection {
|
|
|
768
769
|
/** The RemoteXPC connection for service management */
|
|
769
770
|
remoteXPC: RemoteXpcConnection;
|
|
770
771
|
}
|
|
772
|
+
|
|
773
|
+
/**
|
|
774
|
+
* Represents the instance side of MisagentService where provisioning profiles can be managed
|
|
775
|
+
* @remarks
|
|
776
|
+
* Provisioning profiles are Apple configuration files (.mobileprovision) that contain:
|
|
777
|
+
* - Certificates, identifiers, and device information
|
|
778
|
+
* - App entitlements and permissions
|
|
779
|
+
* - Expiration dates and platform restrictions
|
|
780
|
+
*/
|
|
781
|
+
export interface MisagentService extends BaseService {
|
|
782
|
+
/**
|
|
783
|
+
* Installs a provisioning profile from a file path
|
|
784
|
+
* @param path The file path of the provisioning profile (.mobileprovision file)
|
|
785
|
+
*/
|
|
786
|
+
installProfileFromPath(path: string): Promise<void>;
|
|
787
|
+
/**
|
|
788
|
+
* Installs a provisioning profile from a buffer
|
|
789
|
+
* @param payload The buffer containing the provisioning profile data
|
|
790
|
+
*/
|
|
791
|
+
installProfile(payload: Buffer): Promise<void>;
|
|
792
|
+
/**
|
|
793
|
+
* Removes a provisioning profile by its UUID
|
|
794
|
+
* @param uuid The uuid of the provisioning profile to remove
|
|
795
|
+
*/
|
|
796
|
+
removeProfile(uuid: string): Promise<void>;
|
|
797
|
+
|
|
798
|
+
/**
|
|
799
|
+
* Fetching all provisioning profiles from the device
|
|
800
|
+
* This can be used for listing installed provisioning profiles and backing them up
|
|
801
|
+
* @returns {Promise<ProvisioningProfile[]>}
|
|
802
|
+
* e.g.
|
|
803
|
+
* [
|
|
804
|
+
* {
|
|
805
|
+
* "AppIDName": "Apple Development: John Doe (ABCDE12345)",
|
|
806
|
+
* "ApplicationIdentifierPrefix": [
|
|
807
|
+
* "ABCDE12345"
|
|
808
|
+
* ],
|
|
809
|
+
* "CreationDate": "2023-10-01T12:34:56Z",
|
|
810
|
+
* "Platform": [
|
|
811
|
+
* "iOS",
|
|
812
|
+
* "xrOS",
|
|
813
|
+
* ],
|
|
814
|
+
* IsXcodeManaged": false,
|
|
815
|
+
* "DeveloperCertificates": [ <Buffer ...> ],
|
|
816
|
+
* "Entitlements": {
|
|
817
|
+
* "application-identifier": "ABCDE12345.com.example.app",
|
|
818
|
+
* "get-task-allow": true,
|
|
819
|
+
* ...
|
|
820
|
+
* },
|
|
821
|
+
* "ExpirationDate": "2024-10-01T12:34:56Z",
|
|
822
|
+
* "Name": "Apple Development: John Doe (ABCDE12345)",
|
|
823
|
+
* "UUID": "12345678-90AB-CDEF-1234-567890ABCDEF",
|
|
824
|
+
* "Version": 1,
|
|
825
|
+
* ...
|
|
826
|
+
* },
|
|
827
|
+
* ]
|
|
828
|
+
* @example
|
|
829
|
+
* const profiles = await misagentService.fetchAll();
|
|
830
|
+
* profiles.forEach(profile => {
|
|
831
|
+
* console.log(`Profile: ${profile.plist.Name}`);
|
|
832
|
+
* console.log(`UUID: ${profile.plist.UUID}`);
|
|
833
|
+
* console.log(`Expires: ${profile.plist.ExpirationDate}`);
|
|
834
|
+
* });
|
|
835
|
+
*/
|
|
836
|
+
fetchAll(): Promise<ProvisioningProfile[]>;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
export interface MisagentServiceWithConnection {
|
|
840
|
+
misagentService: MisagentService;
|
|
841
|
+
remoteXPC: RemoteXpcConnection;
|
|
842
|
+
}
|
package/src/lib/usbmux/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { logger } from '@appium/support';
|
|
2
1
|
import { Server, Socket, createConnection, createServer } from 'node:net';
|
|
3
2
|
import { release } from 'node:os';
|
|
4
3
|
|
|
5
4
|
import { BaseSocketService } from '../../base-socket-service.js';
|
|
5
|
+
import { getLogger } from '../logger.js';
|
|
6
6
|
import { type PairRecord, processPlistResponse } from '../pair-record/index.js';
|
|
7
7
|
import { type RawPairRecordResponse } from '../pair-record/pair-record.js';
|
|
8
8
|
import { LengthBasedSplitter, parsePlist } from '../plist/index.js';
|
|
@@ -32,7 +32,7 @@ export interface Device {
|
|
|
32
32
|
Properties: DeviceProperties;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
const log =
|
|
35
|
+
const log = getLogger('Usbmux');
|
|
36
36
|
|
|
37
37
|
export const USBMUXD_PORT = 27015;
|
|
38
38
|
export const DEFAULT_USBMUXD_SOCKET = '/var/run/usbmuxd';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { logger } from '@appium/support';
|
|
2
1
|
import fs from 'node:fs';
|
|
3
2
|
import net from 'node:net';
|
|
4
3
|
import path from 'node:path';
|
|
5
4
|
import { Readable, Writable } from 'node:stream';
|
|
6
5
|
import { pipeline } from 'node:stream/promises';
|
|
7
6
|
|
|
7
|
+
import { getLogger } from '../../../lib/logger.js';
|
|
8
8
|
import {
|
|
9
9
|
buildClosePayload,
|
|
10
10
|
buildFopenPayload,
|
|
@@ -25,7 +25,7 @@ import { AFC_FOPEN_TEXTUAL_MODES, AFC_WRITE_THIS_LENGTH } from './constants.js';
|
|
|
25
25
|
import { AfcError, AfcFileMode, AfcOpcode } from './enums.js';
|
|
26
26
|
import { createAfcReadStream, createAfcWriteStream } from './stream-utils.js';
|
|
27
27
|
|
|
28
|
-
const log =
|
|
28
|
+
const log = getLogger('AfcService');
|
|
29
29
|
|
|
30
30
|
const NON_LISTABLE_ENTRIES = ['', '.', '..'];
|
|
31
31
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { getLogger } from '../../lib/logger.js';
|
|
3
2
|
import { ServiceConnection } from '../../service-connection.js';
|
|
4
3
|
|
|
5
|
-
const log =
|
|
4
|
+
const log = getLogger('BaseService');
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Interface for service information
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { getLogger } from '../../../lib/logger.js';
|
|
3
2
|
import { PlistServiceDecoder } from '../../../lib/plist/plist-decoder.js';
|
|
4
3
|
import type {
|
|
5
4
|
DiagnosticsService as DiagnosticsServiceInterface,
|
|
@@ -7,7 +6,7 @@ import type {
|
|
|
7
6
|
} from '../../../lib/types.js';
|
|
8
7
|
import { BaseService } from '../base-service.js';
|
|
9
8
|
|
|
10
|
-
const log =
|
|
9
|
+
const log = getLogger('DiagnosticService');
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* DiagnosticsService provides an API to:
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { fs } from '@appium/support';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
type MisagentService as MisagentServiceInterface,
|
|
6
|
+
type PlistDictionary,
|
|
7
|
+
} from '../../../lib/types.js';
|
|
8
|
+
import { ServiceConnection } from '../../../service-connection.js';
|
|
9
|
+
import { BaseService } from '../base-service.js';
|
|
10
|
+
import { ProvisioningProfile } from './provisioning-profile.js';
|
|
11
|
+
|
|
12
|
+
class MisagentService extends BaseService implements MisagentServiceInterface {
|
|
13
|
+
static readonly RSD_SERVICE_NAME = 'com.apple.misagent.shim.remote';
|
|
14
|
+
private _conn: ServiceConnection | null = null;
|
|
15
|
+
|
|
16
|
+
async connectToMisagentService(): Promise<ServiceConnection> {
|
|
17
|
+
if (this._conn) {
|
|
18
|
+
return this._conn;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const service = this.getServiceConfig();
|
|
22
|
+
this._conn = await this.startLockdownService(service);
|
|
23
|
+
return this._conn;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async installProfileFromPath(filePath: string): Promise<void> {
|
|
27
|
+
// Check if file exists
|
|
28
|
+
if (!(await fs.exists(filePath))) {
|
|
29
|
+
throw new Error(`Profile filepath does not exist: ${filePath}`);
|
|
30
|
+
}
|
|
31
|
+
const fileExtension = path.extname(filePath).toLowerCase();
|
|
32
|
+
if (fileExtension !== '.mobileprovision') {
|
|
33
|
+
throw new Error(
|
|
34
|
+
`Invalid file extension: ${fileExtension}. Only .mobileprovision files are supported.`,
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
const payload = await fs.readFile(filePath);
|
|
38
|
+
await this.installProfile(payload);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async installProfile(payload: Buffer): Promise<void> {
|
|
42
|
+
await this.sendRequest(
|
|
43
|
+
{
|
|
44
|
+
MessageType: 'Install',
|
|
45
|
+
Profile: payload,
|
|
46
|
+
ProfileType: 'Provisioning',
|
|
47
|
+
},
|
|
48
|
+
'Failed to install profile',
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async removeProfile(uuid: string): Promise<void> {
|
|
53
|
+
await this.sendRequest(
|
|
54
|
+
{
|
|
55
|
+
MessageType: 'Remove',
|
|
56
|
+
ProfileID: uuid,
|
|
57
|
+
ProfileType: 'Provisioning',
|
|
58
|
+
},
|
|
59
|
+
'Failed to remove profile',
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async fetchAll(): Promise<ProvisioningProfile[]> {
|
|
64
|
+
const response = await this.sendRequest(
|
|
65
|
+
{
|
|
66
|
+
MessageType: 'CopyAll',
|
|
67
|
+
ProfileType: 'Provisioning',
|
|
68
|
+
},
|
|
69
|
+
'Failed to copy all profiles',
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
if (!response.Payload || !Array.isArray(response.Payload)) {
|
|
73
|
+
return [];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return response.Payload.filter((profileData): profileData is Buffer =>
|
|
77
|
+
Buffer.isBuffer(profileData),
|
|
78
|
+
).map((profileData) => new ProvisioningProfile(profileData));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
private async sendRequest(
|
|
82
|
+
request: any,
|
|
83
|
+
errorMessage: string,
|
|
84
|
+
): Promise<PlistDictionary> {
|
|
85
|
+
const conn = await this.connectToMisagentService();
|
|
86
|
+
try {
|
|
87
|
+
// Skip StartService response
|
|
88
|
+
await conn.sendPlistRequest(request);
|
|
89
|
+
const res = await conn.sendPlistRequest(request);
|
|
90
|
+
if (res.Status) {
|
|
91
|
+
throw new Error(`Invalid response: ${JSON.stringify(res)}`);
|
|
92
|
+
}
|
|
93
|
+
return res;
|
|
94
|
+
} catch (error) {
|
|
95
|
+
if (error instanceof Error) {
|
|
96
|
+
throw new Error(`${errorMessage}: ${error.message}`);
|
|
97
|
+
}
|
|
98
|
+
throw error;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
private getServiceConfig(): { serviceName: string; port: string } {
|
|
103
|
+
return {
|
|
104
|
+
serviceName: MisagentService.RSD_SERVICE_NAME,
|
|
105
|
+
port: this.address[1].toString(),
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export { MisagentService };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { parsePlist } from '../../../lib/plist/index.js';
|
|
2
|
+
import { type PlistDictionary } from '../../../lib/types.js';
|
|
3
|
+
|
|
4
|
+
class ProvisioningProfile {
|
|
5
|
+
buf: Buffer;
|
|
6
|
+
public plist: PlistDictionary;
|
|
7
|
+
|
|
8
|
+
constructor(buf: Buffer) {
|
|
9
|
+
this.buf = buf;
|
|
10
|
+
|
|
11
|
+
// Find '<?xml' marker and extract everything after it
|
|
12
|
+
const xmlMarker = Buffer.from('<?xml');
|
|
13
|
+
const xmlIndex = buf.indexOf(xmlMarker);
|
|
14
|
+
|
|
15
|
+
if (xmlIndex === -1) {
|
|
16
|
+
throw new Error('No XML content found in provisioning profile');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Get XML content starting from '<?xml'
|
|
20
|
+
let xml = buf.subarray(buf.indexOf(xmlMarker));
|
|
21
|
+
|
|
22
|
+
// Find '</plist>' and extract up to and including it
|
|
23
|
+
const plistEnd = Buffer.from('</plist>');
|
|
24
|
+
const plistIndex = xml.indexOf(plistEnd);
|
|
25
|
+
|
|
26
|
+
if (plistIndex === -1) {
|
|
27
|
+
throw new Error('No closing </plist> tag found');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
xml = xml.subarray(0, plistIndex + plistEnd.length);
|
|
31
|
+
this.plist = parsePlist(xml) as PlistDictionary;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
toString(): string {
|
|
35
|
+
return JSON.stringify(this.plist);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
toJSON(): PlistDictionary {
|
|
39
|
+
// Only display the plist content
|
|
40
|
+
return this.plist;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { ProvisioningProfile };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { fs
|
|
1
|
+
import { fs } from '@appium/support';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
|
|
4
|
+
import { getLogger } from '../../../lib/logger.js';
|
|
4
5
|
import { SUPPORTED_EXTENSIONS } from '../../../lib/plist/constants.js';
|
|
5
6
|
import { createPlist, parsePlist } from '../../../lib/plist/index.js';
|
|
6
7
|
import {
|
|
@@ -11,7 +12,7 @@ import { ServiceConnection } from '../../../service-connection.js';
|
|
|
11
12
|
import { BaseService } from '../base-service.js';
|
|
12
13
|
|
|
13
14
|
const ERROR_CLOUD_CONFIGURATION_ALREADY_PRESENT = 14002;
|
|
14
|
-
const log =
|
|
15
|
+
const log = getLogger('MobileConfigService');
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* MobileConfigService provides an API to:
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { logger } from '@appium/support';
|
|
2
1
|
import { createHash } from 'crypto';
|
|
3
2
|
import { Stats, promises as fs } from 'fs';
|
|
4
3
|
import { performance } from 'perf_hooks';
|
|
5
4
|
import { Readable } from 'stream';
|
|
6
5
|
|
|
6
|
+
import { getLogger } from '../../../lib/logger.js';
|
|
7
7
|
import { parseXmlPlist } from '../../../lib/plist/index.js';
|
|
8
8
|
import { getManifestFromTSS } from '../../../lib/tss/index.js';
|
|
9
9
|
import type {
|
|
@@ -13,7 +13,7 @@ import type {
|
|
|
13
13
|
import { ServiceConnection } from '../../../service-connection.js';
|
|
14
14
|
import { BaseService } from '../base-service.js';
|
|
15
15
|
|
|
16
|
-
const log =
|
|
16
|
+
const log = getLogger('MobileImageMounterService');
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Base interface for service responses
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { getLogger } from '../../../lib/logger.js';
|
|
3
2
|
import type {
|
|
4
3
|
NotificationProxyService as NotificationProxyServiceInterface,
|
|
5
4
|
PlistDictionary,
|
|
@@ -8,7 +7,7 @@ import type {
|
|
|
8
7
|
import { ServiceConnection } from '../../../service-connection.js';
|
|
9
8
|
import { BaseService } from '../base-service.js';
|
|
10
9
|
|
|
11
|
-
const log =
|
|
10
|
+
const log = getLogger('NotificationProxyService');
|
|
12
11
|
|
|
13
12
|
export interface ObserveNotificationRequest extends PlistDictionary {
|
|
14
13
|
Command: 'ObserveNotification';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { getLogger } from '../../../lib/logger.js';
|
|
3
2
|
import type {
|
|
4
3
|
PlistDictionary,
|
|
5
4
|
PowerAssertionService as PowerAssertionServiceInterface,
|
|
@@ -7,7 +6,7 @@ import type {
|
|
|
7
6
|
import { ServiceConnection } from '../../../service-connection.js';
|
|
8
7
|
import { BaseService } from '../base-service.js';
|
|
9
8
|
|
|
10
|
-
const log =
|
|
9
|
+
const log = getLogger('PowerAssertionService');
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* Power assertion types that can be used to prevent system sleep
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { logger } from '@appium/support';
|
|
2
1
|
import type { PacketConsumer, PacketData } from 'appium-ios-tuntap';
|
|
3
2
|
import { EventEmitter } from 'events';
|
|
4
3
|
|
|
4
|
+
import { getLogger } from '../../../lib/logger.js';
|
|
5
5
|
import { isBinaryPlist } from '../../../lib/plist/binary-plist-parser.js';
|
|
6
6
|
import { parsePlist } from '../../../lib/plist/unified-plist-parser.js';
|
|
7
7
|
import type {
|
|
@@ -12,8 +12,8 @@ import type {
|
|
|
12
12
|
import { ServiceConnection } from '../../../service-connection.js';
|
|
13
13
|
import { BaseService, type Service } from '../base-service.js';
|
|
14
14
|
|
|
15
|
-
const syslogLog =
|
|
16
|
-
const log =
|
|
15
|
+
const syslogLog = getLogger('SyslogMessages');
|
|
16
|
+
const log = getLogger('Syslog');
|
|
17
17
|
|
|
18
18
|
const MIN_PRINTABLE_RATIO = 0.5;
|
|
19
19
|
const ASCII_PRINTABLE_MIN = 32;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { logger } from '@appium/support';
|
|
2
1
|
import { TLSSocket } from 'tls';
|
|
3
2
|
|
|
4
3
|
import {
|
|
5
4
|
LockdownService,
|
|
6
5
|
upgradeSocketToTLS,
|
|
7
6
|
} from '../../../lib/lockdown/index.js';
|
|
7
|
+
import { getLogger } from '../../../lib/logger.js';
|
|
8
8
|
import { PlistService } from '../../../lib/plist/plist-service.js';
|
|
9
9
|
import { createUsbmux } from '../../../lib/usbmux/index.js';
|
|
10
10
|
|
|
11
|
-
const log =
|
|
11
|
+
const log = getLogger('TunnelService');
|
|
12
12
|
const LABEL = 'appium-internal';
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { logger } from '@appium/support';
|
|
2
1
|
import { randomUUID } from 'crypto';
|
|
3
2
|
import { EventEmitter } from 'events';
|
|
4
3
|
|
|
4
|
+
import { getLogger } from '../../../lib/logger.js';
|
|
5
5
|
import type { PlistDictionary, PlistMessage } from '../../../lib/types.js';
|
|
6
6
|
import { ServiceConnection } from '../../../service-connection.js';
|
|
7
7
|
import { BaseService } from '../base-service.js';
|
|
8
8
|
|
|
9
|
-
const log =
|
|
9
|
+
const log = getLogger('WebInspectorService');
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Interface for WebInspector message structure
|
package/src/services.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { TunnelManager } from './lib/tunnel/index.js';
|
|
|
5
5
|
import { TunnelApiClient } from './lib/tunnel/tunnel-api-client.js';
|
|
6
6
|
import type {
|
|
7
7
|
DiagnosticsServiceWithConnection,
|
|
8
|
+
MisagentServiceWithConnection,
|
|
8
9
|
MobileConfigServiceWithConnection,
|
|
9
10
|
MobileImageMounterServiceWithConnection,
|
|
10
11
|
NotificationProxyServiceWithConnection,
|
|
@@ -15,6 +16,7 @@ import type {
|
|
|
15
16
|
} from './lib/types.js';
|
|
16
17
|
import AfcService from './services/ios/afc/index.js';
|
|
17
18
|
import DiagnosticsService from './services/ios/diagnostic-service/index.js';
|
|
19
|
+
import { MisagentService } from './services/ios/misagent/index.js';
|
|
18
20
|
import { MobileConfigService } from './services/ios/mobile-config/index.js';
|
|
19
21
|
import MobileImageMounterService from './services/ios/mobile-image-mounter/index.js';
|
|
20
22
|
import { NotificationProxyService } from './services/ios/notification-proxy/index.js';
|
|
@@ -106,6 +108,22 @@ export async function startSpringboardService(
|
|
|
106
108
|
};
|
|
107
109
|
}
|
|
108
110
|
|
|
111
|
+
export async function startMisagentService(
|
|
112
|
+
udid: string,
|
|
113
|
+
): Promise<MisagentServiceWithConnection> {
|
|
114
|
+
const { remoteXPC, tunnelConnection } = await createRemoteXPCConnection(udid);
|
|
115
|
+
const misagentService = remoteXPC.findService(
|
|
116
|
+
MisagentService.RSD_SERVICE_NAME,
|
|
117
|
+
);
|
|
118
|
+
return {
|
|
119
|
+
remoteXPC: remoteXPC as RemoteXpcConnection,
|
|
120
|
+
misagentService: new MisagentService([
|
|
121
|
+
tunnelConnection.host,
|
|
122
|
+
parseInt(misagentService.port, 10),
|
|
123
|
+
]),
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
109
127
|
export async function startPowerAssertionService(
|
|
110
128
|
udid: string,
|
|
111
129
|
): Promise<PowerAssertionServiceWithConnection> {
|