appium-ios-remotexpc 0.13.1 → 0.14.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/build/src/index.d.ts +1 -1
- package/build/src/index.d.ts.map +1 -1
- package/build/src/lib/plist/binary-plist-creator.d.ts.map +1 -1
- package/build/src/lib/plist/binary-plist-creator.js +30 -0
- package/build/src/lib/plist/index.d.ts +1 -0
- package/build/src/lib/plist/index.d.ts.map +1 -1
- package/build/src/lib/plist/index.js +1 -0
- package/build/src/lib/plist/plist-uid.d.ts +10 -0
- package/build/src/lib/plist/plist-uid.d.ts.map +1 -0
- package/build/src/lib/plist/plist-uid.js +10 -0
- package/build/src/lib/types.d.ts +165 -2
- package/build/src/lib/types.d.ts.map +1 -1
- package/build/src/services/ios/dvt/channel-fragmenter.d.ts +21 -0
- package/build/src/services/ios/dvt/channel-fragmenter.d.ts.map +1 -0
- package/build/src/services/ios/dvt/channel-fragmenter.js +37 -0
- package/build/src/services/ios/dvt/channel.d.ts +32 -0
- package/build/src/services/ios/dvt/channel.d.ts.map +1 -0
- package/build/src/services/ios/dvt/channel.js +44 -0
- package/build/src/services/ios/dvt/dtx-message.d.ts +88 -0
- package/build/src/services/ios/dvt/dtx-message.d.ts.map +1 -0
- package/build/src/services/ios/dvt/dtx-message.js +113 -0
- package/build/src/services/ios/dvt/index.d.ts +119 -0
- package/build/src/services/ios/dvt/index.d.ts.map +1 -0
- package/build/src/services/ios/dvt/index.js +552 -0
- package/build/src/services/ios/dvt/instruments/condition-inducer.d.ts +37 -0
- package/build/src/services/ios/dvt/instruments/condition-inducer.d.ts.map +1 -0
- package/build/src/services/ios/dvt/instruments/condition-inducer.js +99 -0
- package/build/src/services/ios/dvt/instruments/location-simulation.d.ts +43 -0
- package/build/src/services/ios/dvt/instruments/location-simulation.d.ts.map +1 -0
- package/build/src/services/ios/dvt/instruments/location-simulation.js +60 -0
- package/build/src/services/ios/dvt/nskeyedarchiver-decoder.d.ts +41 -0
- package/build/src/services/ios/dvt/nskeyedarchiver-decoder.d.ts.map +1 -0
- package/build/src/services/ios/dvt/nskeyedarchiver-decoder.js +190 -0
- package/build/src/services/ios/dvt/utils.d.ts +19 -0
- package/build/src/services/ios/dvt/utils.d.ts.map +1 -0
- package/build/src/services/ios/dvt/utils.js +67 -0
- package/build/src/services.d.ts +2 -1
- package/build/src/services.d.ts.map +1 -1
- package/build/src/services.js +23 -0
- package/package.json +4 -1
- package/src/index.ts +6 -0
- package/src/lib/plist/binary-plist-creator.ts +30 -0
- package/src/lib/plist/index.ts +2 -0
- package/src/lib/plist/plist-uid.ts +9 -0
- package/src/lib/types.ts +179 -1
- package/src/services/ios/dvt/channel-fragmenter.ts +42 -0
- package/src/services/ios/dvt/channel.ts +58 -0
- package/src/services/ios/dvt/dtx-message.ts +162 -0
- package/src/services/ios/dvt/index.ts +727 -0
- package/src/services/ios/dvt/instruments/condition-inducer.ts +140 -0
- package/src/services/ios/dvt/instruments/location-simulation.ts +83 -0
- package/src/services/ios/dvt/nskeyedarchiver-decoder.ts +219 -0
- package/src/services/ios/dvt/utils.ts +89 -0
- package/src/services.ts +33 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DTX Protocol constants
|
|
3
|
+
*/
|
|
4
|
+
export const DTX_CONSTANTS = {
|
|
5
|
+
MESSAGE_HEADER_MAGIC: 0x1f3d5b79,
|
|
6
|
+
MESSAGE_HEADER_SIZE: 32,
|
|
7
|
+
PAYLOAD_HEADER_SIZE: 16,
|
|
8
|
+
MESSAGE_AUX_MAGIC: 0x1f0,
|
|
9
|
+
EMPTY_DICTIONARY: 0xa,
|
|
10
|
+
// Message types
|
|
11
|
+
INSTRUMENTS_MESSAGE_TYPE: 2,
|
|
12
|
+
EXPECTS_REPLY_MASK: 0x1000,
|
|
13
|
+
// Auxiliary value types
|
|
14
|
+
AUX_TYPE_OBJECT: 2,
|
|
15
|
+
AUX_TYPE_INT32: 3,
|
|
16
|
+
AUX_TYPE_INT64: 6,
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* DTX Message utilities for encoding and decoding protocol messages
|
|
20
|
+
*/
|
|
21
|
+
export class DTXMessage {
|
|
22
|
+
/**
|
|
23
|
+
* Parse DTX message header from buffer
|
|
24
|
+
*/
|
|
25
|
+
static parseMessageHeader(buffer) {
|
|
26
|
+
if (buffer.length < DTX_CONSTANTS.MESSAGE_HEADER_SIZE) {
|
|
27
|
+
throw new Error('Buffer too small for DTX message header');
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
magic: buffer.readUInt32LE(0),
|
|
31
|
+
cb: buffer.readUInt32LE(4),
|
|
32
|
+
fragmentId: buffer.readUInt16LE(8),
|
|
33
|
+
fragmentCount: buffer.readUInt16LE(10),
|
|
34
|
+
length: buffer.readUInt32LE(12),
|
|
35
|
+
identifier: buffer.readUInt32LE(16),
|
|
36
|
+
conversationIndex: buffer.readUInt32LE(20),
|
|
37
|
+
channelCode: buffer.readInt32LE(24),
|
|
38
|
+
expectsReply: buffer.readUInt32LE(28),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Build DTX message header buffer
|
|
43
|
+
*/
|
|
44
|
+
static buildMessageHeader(header) {
|
|
45
|
+
const buffer = Buffer.alloc(DTX_CONSTANTS.MESSAGE_HEADER_SIZE);
|
|
46
|
+
buffer.writeUInt32LE(header.magic, 0);
|
|
47
|
+
buffer.writeUInt32LE(header.cb, 4);
|
|
48
|
+
buffer.writeUInt16LE(header.fragmentId, 8);
|
|
49
|
+
buffer.writeUInt16LE(header.fragmentCount, 10);
|
|
50
|
+
buffer.writeUInt32LE(header.length, 12);
|
|
51
|
+
buffer.writeUInt32LE(header.identifier, 16);
|
|
52
|
+
buffer.writeUInt32LE(header.conversationIndex, 20);
|
|
53
|
+
buffer.writeInt32LE(header.channelCode, 24);
|
|
54
|
+
buffer.writeUInt32LE(header.expectsReply, 28);
|
|
55
|
+
return buffer;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Parse DTX payload header from buffer
|
|
59
|
+
*/
|
|
60
|
+
static parsePayloadHeader(buffer) {
|
|
61
|
+
if (buffer.length < DTX_CONSTANTS.PAYLOAD_HEADER_SIZE) {
|
|
62
|
+
throw new Error('Buffer too small for DTX payload header');
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
flags: buffer.readUInt32LE(0),
|
|
66
|
+
auxiliaryLength: buffer.readUInt32LE(4),
|
|
67
|
+
totalLength: buffer.readBigUInt64LE(8),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Build DTX payload header buffer
|
|
72
|
+
*/
|
|
73
|
+
static buildPayloadHeader(header) {
|
|
74
|
+
const buffer = Buffer.alloc(DTX_CONSTANTS.PAYLOAD_HEADER_SIZE);
|
|
75
|
+
buffer.writeUInt32LE(header.flags, 0);
|
|
76
|
+
buffer.writeUInt32LE(header.auxiliaryLength, 4);
|
|
77
|
+
buffer.writeBigUInt64LE(header.totalLength, 8);
|
|
78
|
+
return buffer;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Message auxiliary builder for DTX protocol parameters
|
|
83
|
+
*/
|
|
84
|
+
export class MessageAux {
|
|
85
|
+
values = [];
|
|
86
|
+
/**
|
|
87
|
+
* Append a 32-bit integer
|
|
88
|
+
*/
|
|
89
|
+
appendInt(value) {
|
|
90
|
+
this.values.push({ type: DTX_CONSTANTS.AUX_TYPE_INT32, value });
|
|
91
|
+
return this;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Append a 64-bit integer (bigint)
|
|
95
|
+
*/
|
|
96
|
+
appendLong(value) {
|
|
97
|
+
this.values.push({ type: DTX_CONSTANTS.AUX_TYPE_INT64, value });
|
|
98
|
+
return this;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Append an object (will be archived as NSKeyedArchiver plist)
|
|
102
|
+
*/
|
|
103
|
+
appendObj(value) {
|
|
104
|
+
this.values.push({ type: DTX_CONSTANTS.AUX_TYPE_OBJECT, value });
|
|
105
|
+
return this;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Get raw values for encoding
|
|
109
|
+
*/
|
|
110
|
+
getValues() {
|
|
111
|
+
return this.values;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { PlistDictionary } from '../../../lib/types.js';
|
|
2
|
+
import { BaseService } from '../base-service.js';
|
|
3
|
+
import { ChannelFragmenter } from './channel-fragmenter.js';
|
|
4
|
+
import { Channel } from './channel.js';
|
|
5
|
+
import { DTXMessage, DTX_CONSTANTS, MessageAux } from './dtx-message.js';
|
|
6
|
+
/**
|
|
7
|
+
* DVTSecureSocketProxyService provides access to Apple's DTServiceHub functionality
|
|
8
|
+
* This service enables various instruments and debugging capabilities through the DTX protocol
|
|
9
|
+
*/
|
|
10
|
+
export declare class DVTSecureSocketProxyService extends BaseService {
|
|
11
|
+
static readonly RSD_SERVICE_NAME = "com.apple.instruments.dtservicehub";
|
|
12
|
+
static readonly BROADCAST_CHANNEL = 0;
|
|
13
|
+
private connection;
|
|
14
|
+
private socket;
|
|
15
|
+
private supportedIdentifiers;
|
|
16
|
+
private lastChannelCode;
|
|
17
|
+
private curMessageId;
|
|
18
|
+
private readonly channelCache;
|
|
19
|
+
private readonly channelMessages;
|
|
20
|
+
private isHandshakeComplete;
|
|
21
|
+
private readBuffer;
|
|
22
|
+
constructor(address: [string, number]);
|
|
23
|
+
/**
|
|
24
|
+
* Connect to the DVT service and perform handshake
|
|
25
|
+
*/
|
|
26
|
+
connect(): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Get supported service identifiers (capabilities)
|
|
29
|
+
*/
|
|
30
|
+
getSupportedIdentifiers(): PlistDictionary;
|
|
31
|
+
/**
|
|
32
|
+
* Create a communication channel for a specific service identifier
|
|
33
|
+
* @param identifier The service identifier (e.g., 'com.apple.instruments.server.services.LocationSimulation')
|
|
34
|
+
* @returns The created channel instance
|
|
35
|
+
*/
|
|
36
|
+
makeChannel(identifier: string): Promise<Channel>;
|
|
37
|
+
/**
|
|
38
|
+
* Send a DTX message on a channel
|
|
39
|
+
* @param channel The channel code
|
|
40
|
+
* @param selector The ObjectiveC method selector
|
|
41
|
+
* @param args Optional message arguments
|
|
42
|
+
* @param expectsReply Whether a reply is expected
|
|
43
|
+
*/
|
|
44
|
+
sendMessage(channel: number, selector?: string | null, args?: MessageAux | null, expectsReply?: boolean): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Receive a plist message from a channel
|
|
47
|
+
* @param channel The channel to receive from
|
|
48
|
+
* @returns Tuple of [decoded data, auxiliary values]
|
|
49
|
+
*/
|
|
50
|
+
recvPlist(channel?: number): Promise<[any, any[]]>;
|
|
51
|
+
/**
|
|
52
|
+
* Receive a raw message from a channel
|
|
53
|
+
* @param channel The channel to receive from
|
|
54
|
+
* @returns Tuple of [raw data, auxiliary values]
|
|
55
|
+
*/
|
|
56
|
+
recvMessage(channel?: number): Promise<[Buffer | null, any[]]>;
|
|
57
|
+
/**
|
|
58
|
+
* Close the DVT service connection
|
|
59
|
+
*/
|
|
60
|
+
close(): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Perform DTX protocol handshake to establish connection and retrieve capabilities
|
|
63
|
+
*/
|
|
64
|
+
private performHandshake;
|
|
65
|
+
private extractSelectorFromResponse;
|
|
66
|
+
private extractCapabilitiesFromAuxData;
|
|
67
|
+
/**
|
|
68
|
+
* Drain any buffered messages that arrived during handshake
|
|
69
|
+
*/
|
|
70
|
+
private drainBufferedMessages;
|
|
71
|
+
/**
|
|
72
|
+
* Receive packet fragments until a complete message is available for the specified channel
|
|
73
|
+
*/
|
|
74
|
+
private recvPacketFragments;
|
|
75
|
+
/**
|
|
76
|
+
* Read exact number of bytes from socket with buffering
|
|
77
|
+
*/
|
|
78
|
+
private readExact;
|
|
79
|
+
/**
|
|
80
|
+
* Check if response contains an NSError and throw if present
|
|
81
|
+
*/
|
|
82
|
+
private checkForNSError;
|
|
83
|
+
/**
|
|
84
|
+
* Archive a value using NSKeyedArchiver format for DTX protocol
|
|
85
|
+
*/
|
|
86
|
+
private archiveValue;
|
|
87
|
+
/**
|
|
88
|
+
* Archive a selector string for DTX messages
|
|
89
|
+
*/
|
|
90
|
+
private archiveSelector;
|
|
91
|
+
/**
|
|
92
|
+
* Build auxiliary data buffer with NSKeyedArchiver encoding for objects
|
|
93
|
+
*/
|
|
94
|
+
private buildAuxiliaryData;
|
|
95
|
+
/**
|
|
96
|
+
* Parse auxiliary data from buffer
|
|
97
|
+
*
|
|
98
|
+
* The auxiliary data format can be:
|
|
99
|
+
* 1. Standard format: [magic:8][size:8][items...]
|
|
100
|
+
* 2. NSKeyedArchiver bplist format (for handshake responses)
|
|
101
|
+
*/
|
|
102
|
+
private parseAuxiliaryData;
|
|
103
|
+
/**
|
|
104
|
+
* Parse auxiliary data in NSKeyedArchiver bplist format
|
|
105
|
+
*/
|
|
106
|
+
private parseAuxiliaryAsBplist;
|
|
107
|
+
/**
|
|
108
|
+
* Parse auxiliary data in standard DTX format
|
|
109
|
+
*/
|
|
110
|
+
private parseAuxiliaryStandard;
|
|
111
|
+
/**
|
|
112
|
+
* Parse a single auxiliary value
|
|
113
|
+
*/
|
|
114
|
+
private parseAuxiliaryValue;
|
|
115
|
+
}
|
|
116
|
+
export { Channel, ChannelFragmenter, DTXMessage, MessageAux, DTX_CONSTANTS };
|
|
117
|
+
export { decodeNSKeyedArchiver, NSKeyedArchiverDecoder, } from './nskeyedarchiver-decoder.js';
|
|
118
|
+
export type { DTXMessageHeader, DTXMessagePayloadHeader, MessageAuxValue, } from './dtx-message.js';
|
|
119
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/services/ios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