ai-remote 0.4.2 → 0.4.4
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/dist/index.js +1 -6
- package/dist/{protocols/index.d.ts → protocols.d.ts} +2 -0
- package/dist/protocols.js +24 -0
- package/package.json +15 -10
- package/dist/protocols/index.js +0 -34
- package/dist/protocols/rdp/buffer.d.ts +0 -38
- package/dist/protocols/rdp/buffer.js +0 -169
- package/dist/protocols/rdp/caps.d.ts +0 -49
- package/dist/protocols/rdp/caps.js +0 -259
- package/dist/protocols/rdp/cert.d.ts +0 -18
- package/dist/protocols/rdp/cert.js +0 -134
- package/dist/protocols/rdp/client.d.ts +0 -56
- package/dist/protocols/rdp/client.js +0 -1069
- package/dist/protocols/rdp/cliprdr.d.ts +0 -27
- package/dist/protocols/rdp/cliprdr.js +0 -239
- package/dist/protocols/rdp/credssp.d.ts +0 -34
- package/dist/protocols/rdp/credssp.js +0 -253
- package/dist/protocols/rdp/crypto.d.ts +0 -63
- package/dist/protocols/rdp/crypto.js +0 -368
- package/dist/protocols/rdp/display.d.ts +0 -38
- package/dist/protocols/rdp/display.js +0 -588
- package/dist/protocols/rdp/gcc.d.ts +0 -23
- package/dist/protocols/rdp/gcc.js +0 -131
- package/dist/protocols/rdp/keymap.d.ts +0 -9
- package/dist/protocols/rdp/keymap.js +0 -131
- package/dist/protocols/rdp/mcs.d.ts +0 -40
- package/dist/protocols/rdp/mcs.js +0 -222
- package/dist/protocols/rdp/ntlm.d.ts +0 -61
- package/dist/protocols/rdp/ntlm.js +0 -304
- package/dist/protocols/rdp/pdu.d.ts +0 -155
- package/dist/protocols/rdp/pdu.js +0 -443
- package/dist/protocols/rdp/rail.d.ts +0 -119
- package/dist/protocols/rdp/rail.js +0 -382
- package/dist/protocols/rdp/rle.d.ts +0 -13
- package/dist/protocols/rdp/rle.js +0 -275
- package/dist/protocols/rdp/sec.d.ts +0 -59
- package/dist/protocols/rdp/sec.js +0 -155
- package/dist/protocols/rdp/session.d.ts +0 -62
- package/dist/protocols/rdp/session.js +0 -306
- package/dist/protocols/rdp/tls.d.ts +0 -18
- package/dist/protocols/rdp/tls.js +0 -353
- package/dist/protocols/rdp/vchannel.d.ts +0 -28
- package/dist/protocols/rdp/vchannel.js +0 -58
- package/dist/protocols/rdp/x224.d.ts +0 -40
- package/dist/protocols/rdp/x224.js +0 -109
- package/dist/protocols/ssh/kex.d.ts +0 -97
- package/dist/protocols/ssh/kex.js +0 -176
- package/dist/protocols/ssh/messages.d.ts +0 -50
- package/dist/protocols/ssh/messages.js +0 -54
- package/dist/protocols/ssh/session.d.ts +0 -66
- package/dist/protocols/ssh/session.js +0 -608
- package/dist/protocols/ssh/terminal.d.ts +0 -46
- package/dist/protocols/ssh/terminal.js +0 -190
- package/dist/protocols/ssh/transport.d.ts +0 -62
- package/dist/protocols/ssh/transport.js +0 -612
- package/dist/protocols/ssh/wire.d.ts +0 -52
- package/dist/protocols/ssh/wire.js +0 -188
- package/dist/protocols/types.d.ts +0 -127
- package/dist/protocols/types.js +0 -0
- package/dist/protocols/vnc/input.d.ts +0 -5
- package/dist/protocols/vnc/input.js +0 -15
- package/dist/protocols/vnc/session.d.ts +0 -12
- package/dist/protocols/vnc/session.js +0 -258
- package/dist/shared/connection.d.ts +0 -81
- package/dist/shared/connection.js +0 -113
- package/dist/shared/device.d.ts +0 -26
- package/dist/shared/device.js +0 -0
- package/dist/shared/hosts.d.ts +0 -63
- package/dist/shared/hosts.js +0 -132
- package/dist/shared/icons.d.ts +0 -46
- package/dist/shared/icons.js +0 -41
- package/dist/shared/protocol.d.ts +0 -28
- package/dist/shared/protocol.js +0 -39
- package/dist/shared/signals.d.ts +0 -37
- package/dist/shared/signals.js +0 -41
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
import { Writer, concatBytes } from "./buffer.js";
|
|
2
|
-
import { md5, rc4Crypt, rc4Init } from "./crypto.js";
|
|
3
|
-
function rotl32(value, count) {
|
|
4
|
-
return value << count | value >>> 32 - count;
|
|
5
|
-
}
|
|
6
|
-
function md4(message) {
|
|
7
|
-
const blockCount = Math.floor((message.length + 8) / 64) + 1;
|
|
8
|
-
const padded = new Uint8Array(blockCount * 64);
|
|
9
|
-
padded.set(message);
|
|
10
|
-
padded[message.length] = 128;
|
|
11
|
-
const view = new DataView(padded.buffer);
|
|
12
|
-
const bitLength = message.length * 8;
|
|
13
|
-
view.setUint32(padded.length - 8, bitLength >>> 0, true);
|
|
14
|
-
view.setUint32(padded.length - 4, Math.floor(bitLength / 4294967296), true);
|
|
15
|
-
let a0 = 1732584193, b0 = 4023233417, c0 = 2562383102, d0 = 271733878;
|
|
16
|
-
const x = new Uint32Array(16);
|
|
17
|
-
const round1Shifts = [3, 7, 11, 19];
|
|
18
|
-
const round2Order = [0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15];
|
|
19
|
-
const round2Shifts = [3, 5, 9, 13];
|
|
20
|
-
const round3Order = [0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15];
|
|
21
|
-
const round3Shifts = [3, 9, 11, 15];
|
|
22
|
-
for (let block = 0; block < blockCount; block++) {
|
|
23
|
-
for (let i = 0; i < 16; i++) x[i] = view.getUint32(block * 64 + i * 4, true);
|
|
24
|
-
let a = a0, b = b0, c = c0, d = d0;
|
|
25
|
-
const step = (value, shift) => rotl32(value | 0, shift);
|
|
26
|
-
for (let i = 0; i < 16; i++) {
|
|
27
|
-
const f = b & c | ~b & d;
|
|
28
|
-
const shift = round1Shifts[i % 4];
|
|
29
|
-
const next = step(a + f + x[i] | 0, shift);
|
|
30
|
-
a = d;
|
|
31
|
-
d = c;
|
|
32
|
-
c = b;
|
|
33
|
-
b = next;
|
|
34
|
-
}
|
|
35
|
-
for (let i = 0; i < 16; i++) {
|
|
36
|
-
const g = b & c | b & d | c & d;
|
|
37
|
-
const shift = round2Shifts[i % 4];
|
|
38
|
-
const next = step(a + g + x[round2Order[i]] + 1518500249 | 0, shift);
|
|
39
|
-
a = d;
|
|
40
|
-
d = c;
|
|
41
|
-
c = b;
|
|
42
|
-
b = next;
|
|
43
|
-
}
|
|
44
|
-
for (let i = 0; i < 16; i++) {
|
|
45
|
-
const h = b ^ c ^ d;
|
|
46
|
-
const shift = round3Shifts[i % 4];
|
|
47
|
-
const next = step(a + h + x[round3Order[i]] + 1859775393 | 0, shift);
|
|
48
|
-
a = d;
|
|
49
|
-
d = c;
|
|
50
|
-
c = b;
|
|
51
|
-
b = next;
|
|
52
|
-
}
|
|
53
|
-
a0 = a0 + a | 0;
|
|
54
|
-
b0 = b0 + b | 0;
|
|
55
|
-
c0 = c0 + c | 0;
|
|
56
|
-
d0 = d0 + d | 0;
|
|
57
|
-
}
|
|
58
|
-
const digest = new Uint8Array(16);
|
|
59
|
-
const out = new DataView(digest.buffer);
|
|
60
|
-
out.setUint32(0, a0 >>> 0, true);
|
|
61
|
-
out.setUint32(4, b0 >>> 0, true);
|
|
62
|
-
out.setUint32(8, c0 >>> 0, true);
|
|
63
|
-
out.setUint32(12, d0 >>> 0, true);
|
|
64
|
-
return digest;
|
|
65
|
-
}
|
|
66
|
-
function hmacMd5(key, message) {
|
|
67
|
-
const blockSize = 64;
|
|
68
|
-
const normalized = key.length > blockSize ? md5(key) : key;
|
|
69
|
-
const padded = new Uint8Array(blockSize);
|
|
70
|
-
padded.set(normalized);
|
|
71
|
-
const inner = new Uint8Array(blockSize);
|
|
72
|
-
const outer = new Uint8Array(blockSize);
|
|
73
|
-
for (let i = 0; i < blockSize; i++) {
|
|
74
|
-
inner[i] = padded[i] ^ 54;
|
|
75
|
-
outer[i] = padded[i] ^ 92;
|
|
76
|
-
}
|
|
77
|
-
return md5(concatBytes(outer, md5(concatBytes(inner, message))));
|
|
78
|
-
}
|
|
79
|
-
const NTLMSSP_SIGNATURE = new Uint8Array([78, 84, 76, 77, 83, 83, 80, 0]);
|
|
80
|
-
const NTLM_FLAG = {
|
|
81
|
-
UNICODE: 1,
|
|
82
|
-
REQUEST_TARGET: 4,
|
|
83
|
-
SIGN: 16,
|
|
84
|
-
SEAL: 32,
|
|
85
|
-
NTLM: 512,
|
|
86
|
-
ALWAYS_SIGN: 32768,
|
|
87
|
-
EXTENDED_SESSION_SECURITY: 524288,
|
|
88
|
-
TARGET_INFO: 8388608,
|
|
89
|
-
VERSION: 33554432,
|
|
90
|
-
KEY_128: 536870912,
|
|
91
|
-
KEY_EXCH: 1073741824,
|
|
92
|
-
KEY_56: 2147483648
|
|
93
|
-
};
|
|
94
|
-
const CLIENT_FLAGS = NTLM_FLAG.UNICODE | NTLM_FLAG.REQUEST_TARGET | NTLM_FLAG.SIGN | NTLM_FLAG.SEAL | NTLM_FLAG.NTLM | NTLM_FLAG.ALWAYS_SIGN | NTLM_FLAG.EXTENDED_SESSION_SECURITY | NTLM_FLAG.TARGET_INFO | NTLM_FLAG.VERSION | NTLM_FLAG.KEY_128 | NTLM_FLAG.KEY_EXCH | NTLM_FLAG.KEY_56;
|
|
95
|
-
const MSV_AV_EOL = 0;
|
|
96
|
-
const MSV_AV_TIMESTAMP = 7;
|
|
97
|
-
const MSV_AV_FLAGS = 6;
|
|
98
|
-
const MSV_AV_FLAGS_MIC = 2;
|
|
99
|
-
const utf16 = (text) => {
|
|
100
|
-
const writer = new Writer(text.length * 2 + 2);
|
|
101
|
-
writer.utf16le(text);
|
|
102
|
-
return writer.take();
|
|
103
|
-
};
|
|
104
|
-
const VERSION_FIELD = new Uint8Array([10, 0, 99, 69, 0, 0, 0, 15]);
|
|
105
|
-
function negotiateMessage() {
|
|
106
|
-
const writer = new Writer(40);
|
|
107
|
-
writer.raw(NTLMSSP_SIGNATURE);
|
|
108
|
-
writer.u32le(1);
|
|
109
|
-
writer.u32le(CLIENT_FLAGS >>> 0);
|
|
110
|
-
writer.u16le(0).u16le(0).u32le(0);
|
|
111
|
-
writer.u16le(0).u16le(0).u32le(0);
|
|
112
|
-
writer.raw(VERSION_FIELD);
|
|
113
|
-
return writer.take();
|
|
114
|
-
}
|
|
115
|
-
function parseChallengeMessage(bytes) {
|
|
116
|
-
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
117
|
-
if (view.getUint32(8, true) !== 2) {
|
|
118
|
-
throw new Error("NTLM: the host did not answer with a challenge message");
|
|
119
|
-
}
|
|
120
|
-
const targetNameLength = view.getUint16(12, true);
|
|
121
|
-
const targetNameOffset = view.getUint32(16, true);
|
|
122
|
-
const flags = view.getUint32(20, true);
|
|
123
|
-
const serverChallenge = bytes.subarray(24, 32).slice();
|
|
124
|
-
const targetInfoLength = view.getUint16(40, true);
|
|
125
|
-
const targetInfoOffset = view.getUint32(44, true);
|
|
126
|
-
return {
|
|
127
|
-
flags,
|
|
128
|
-
serverChallenge,
|
|
129
|
-
targetName: bytes.subarray(targetNameOffset, targetNameOffset + targetNameLength).slice(),
|
|
130
|
-
targetInfo: bytes.subarray(targetInfoOffset, targetInfoOffset + targetInfoLength).slice()
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
function readAvPairs(targetInfo) {
|
|
134
|
-
const pairs = [];
|
|
135
|
-
let offset = 0;
|
|
136
|
-
const view = new DataView(targetInfo.buffer, targetInfo.byteOffset, targetInfo.byteLength);
|
|
137
|
-
while (offset + 4 <= targetInfo.length) {
|
|
138
|
-
const id = view.getUint16(offset, true);
|
|
139
|
-
const length = view.getUint16(offset + 2, true);
|
|
140
|
-
const value = targetInfo.subarray(offset + 4, offset + 4 + length);
|
|
141
|
-
offset += 4 + length;
|
|
142
|
-
if (id === MSV_AV_EOL) break;
|
|
143
|
-
pairs.push({ id, value });
|
|
144
|
-
}
|
|
145
|
-
return pairs;
|
|
146
|
-
}
|
|
147
|
-
function writeAvPairs(pairs) {
|
|
148
|
-
const writer = new Writer(256);
|
|
149
|
-
for (const pair of pairs) {
|
|
150
|
-
writer.u16le(pair.id);
|
|
151
|
-
writer.u16le(pair.value.length);
|
|
152
|
-
writer.raw(pair.value);
|
|
153
|
-
}
|
|
154
|
-
writer.u16le(MSV_AV_EOL).u16le(0);
|
|
155
|
-
return writer.take();
|
|
156
|
-
}
|
|
157
|
-
function fileTimeNow() {
|
|
158
|
-
const ticks = (BigInt(Date.now()) + 11644473600000n) * 10000n;
|
|
159
|
-
const out = new Uint8Array(8);
|
|
160
|
-
new DataView(out.buffer).setBigUint64(0, ticks, true);
|
|
161
|
-
return out;
|
|
162
|
-
}
|
|
163
|
-
function authenticateMessage({ username, domain, password, challenge, negotiateBytes, challengeBytes }) {
|
|
164
|
-
const responseKey = hmacMd5(
|
|
165
|
-
md4(utf16(password)),
|
|
166
|
-
utf16(username.toUpperCase() + domain)
|
|
167
|
-
);
|
|
168
|
-
const pairs = readAvPairs(challenge.targetInfo);
|
|
169
|
-
const timestamp = pairs.find((pair) => pair.id === MSV_AV_TIMESTAMP)?.value.slice() || fileTimeNow();
|
|
170
|
-
const flagsPair = pairs.find((pair) => pair.id === MSV_AV_FLAGS);
|
|
171
|
-
if (flagsPair) {
|
|
172
|
-
const view = new DataView(flagsPair.value.buffer, flagsPair.value.byteOffset, 4);
|
|
173
|
-
view.setUint32(0, view.getUint32(0, true) | MSV_AV_FLAGS_MIC, true);
|
|
174
|
-
} else {
|
|
175
|
-
const value = new Uint8Array(4);
|
|
176
|
-
new DataView(value.buffer).setUint32(0, MSV_AV_FLAGS_MIC, true);
|
|
177
|
-
pairs.push({ id: MSV_AV_FLAGS, value });
|
|
178
|
-
}
|
|
179
|
-
const targetInfo = writeAvPairs(pairs);
|
|
180
|
-
const clientChallenge = new Uint8Array(8);
|
|
181
|
-
crypto.getRandomValues(clientChallenge);
|
|
182
|
-
const temp = concatBytes(
|
|
183
|
-
new Uint8Array([1, 1, 0, 0, 0, 0, 0, 0]),
|
|
184
|
-
// version, reserved
|
|
185
|
-
timestamp,
|
|
186
|
-
clientChallenge,
|
|
187
|
-
new Uint8Array(4),
|
|
188
|
-
targetInfo,
|
|
189
|
-
new Uint8Array(4)
|
|
190
|
-
);
|
|
191
|
-
const proof = hmacMd5(responseKey, concatBytes(challenge.serverChallenge, temp));
|
|
192
|
-
const ntResponse = concatBytes(proof, temp);
|
|
193
|
-
const sessionBaseKey = hmacMd5(responseKey, proof);
|
|
194
|
-
const exportedSessionKey = new Uint8Array(16);
|
|
195
|
-
crypto.getRandomValues(exportedSessionKey);
|
|
196
|
-
const encryptedSessionKey = rc4Crypt(rc4Init(sessionBaseKey), exportedSessionKey);
|
|
197
|
-
const domainBytes = utf16Trimmed(domain);
|
|
198
|
-
const userBytes = utf16Trimmed(username);
|
|
199
|
-
const workstationBytes = utf16Trimmed("");
|
|
200
|
-
const lmResponse = new Uint8Array(24);
|
|
201
|
-
const headerLength = 72;
|
|
202
|
-
let offset = headerLength;
|
|
203
|
-
const layout = [];
|
|
204
|
-
const place = (bytes) => {
|
|
205
|
-
layout.push({ bytes, offset });
|
|
206
|
-
offset += bytes.length;
|
|
207
|
-
return layout[layout.length - 1];
|
|
208
|
-
};
|
|
209
|
-
const lm = place(lmResponse);
|
|
210
|
-
const nt = place(ntResponse);
|
|
211
|
-
const dom = place(domainBytes);
|
|
212
|
-
const user = place(userBytes);
|
|
213
|
-
const workstation = place(workstationBytes);
|
|
214
|
-
const sessionKey = place(encryptedSessionKey);
|
|
215
|
-
const writer = new Writer(offset + 16);
|
|
216
|
-
writer.raw(NTLMSSP_SIGNATURE);
|
|
217
|
-
writer.u32le(3);
|
|
218
|
-
const field = (entry) => {
|
|
219
|
-
writer.u16le(entry.bytes.length);
|
|
220
|
-
writer.u16le(entry.bytes.length);
|
|
221
|
-
writer.u32le(entry.offset + 16);
|
|
222
|
-
};
|
|
223
|
-
field(lm);
|
|
224
|
-
field(nt);
|
|
225
|
-
field(dom);
|
|
226
|
-
field(user);
|
|
227
|
-
field(workstation);
|
|
228
|
-
field(sessionKey);
|
|
229
|
-
writer.u32le(CLIENT_FLAGS >>> 0);
|
|
230
|
-
writer.raw(VERSION_FIELD);
|
|
231
|
-
writer.zeros(16);
|
|
232
|
-
for (const entry of layout) writer.raw(entry.bytes);
|
|
233
|
-
const message = writer.take();
|
|
234
|
-
const mic = hmacMd5(
|
|
235
|
-
exportedSessionKey,
|
|
236
|
-
concatBytes(negotiateBytes, challengeBytes, message)
|
|
237
|
-
);
|
|
238
|
-
message.set(mic, headerLength);
|
|
239
|
-
return {
|
|
240
|
-
message,
|
|
241
|
-
exportedSessionKey,
|
|
242
|
-
keys: sessionKeys(exportedSessionKey)
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
function utf16Trimmed(text) {
|
|
246
|
-
if (!text) return new Uint8Array(0);
|
|
247
|
-
const bytes = utf16(text);
|
|
248
|
-
return bytes.subarray(0, text.length * 2).slice();
|
|
249
|
-
}
|
|
250
|
-
const CLIENT_SIGNING = "session key to client-to-server signing key magic constant\0";
|
|
251
|
-
const SERVER_SIGNING = "session key to server-to-client signing key magic constant\0";
|
|
252
|
-
const CLIENT_SEALING = "session key to client-to-server sealing key magic constant\0";
|
|
253
|
-
const SERVER_SEALING = "session key to server-to-client sealing key magic constant\0";
|
|
254
|
-
function sessionKeys(exportedSessionKey) {
|
|
255
|
-
const derive = (label) => md5(concatBytes(exportedSessionKey, new TextEncoder().encode(label)));
|
|
256
|
-
return {
|
|
257
|
-
clientSigningKey: derive(CLIENT_SIGNING),
|
|
258
|
-
serverSigningKey: derive(SERVER_SIGNING),
|
|
259
|
-
clientSealing: rc4Init(derive(CLIENT_SEALING)),
|
|
260
|
-
serverSealing: rc4Init(derive(SERVER_SEALING))
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
class NtlmSealer {
|
|
264
|
-
keys;
|
|
265
|
-
sendSequence;
|
|
266
|
-
receiveSequence;
|
|
267
|
-
constructor(keys) {
|
|
268
|
-
this.keys = keys;
|
|
269
|
-
this.sendSequence = 0;
|
|
270
|
-
this.receiveSequence = 0;
|
|
271
|
-
}
|
|
272
|
-
seal(plaintext) {
|
|
273
|
-
const sequence = new Uint8Array(4);
|
|
274
|
-
new DataView(sequence.buffer).setUint32(0, this.sendSequence, true);
|
|
275
|
-
const digest = hmacMd5(this.keys.clientSigningKey, concatBytes(sequence, plaintext));
|
|
276
|
-
const sealed = rc4Crypt(this.keys.clientSealing, plaintext);
|
|
277
|
-
const checksum = rc4Crypt(this.keys.clientSealing, digest.subarray(0, 8));
|
|
278
|
-
this.sendSequence += 1;
|
|
279
|
-
return concatBytes(new Uint8Array([1, 0, 0, 0]), checksum, sequence, sealed);
|
|
280
|
-
}
|
|
281
|
-
unseal(bytes) {
|
|
282
|
-
if (bytes.length < 16) throw new Error("NTLM: sealed message is too short");
|
|
283
|
-
const sealed = bytes.subarray(16);
|
|
284
|
-
const plaintext = rc4Crypt(this.keys.serverSealing, sealed);
|
|
285
|
-
const sequence = bytes.subarray(12, 16);
|
|
286
|
-
const digest = hmacMd5(this.keys.serverSigningKey, concatBytes(sequence, plaintext));
|
|
287
|
-
const expected = rc4Crypt(this.keys.serverSealing, digest.subarray(0, 8));
|
|
288
|
-
const actual = bytes.subarray(4, 12);
|
|
289
|
-
if (!expected.every((byte, i) => byte === actual[i])) {
|
|
290
|
-
throw new Error("NTLM: the host signature did not verify");
|
|
291
|
-
}
|
|
292
|
-
this.receiveSequence += 1;
|
|
293
|
-
return plaintext;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
export {
|
|
297
|
-
NTLM_FLAG,
|
|
298
|
-
NtlmSealer,
|
|
299
|
-
authenticateMessage,
|
|
300
|
-
hmacMd5,
|
|
301
|
-
md4,
|
|
302
|
-
negotiateMessage,
|
|
303
|
-
parseChallengeMessage
|
|
304
|
-
};
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import { Reader } from './buffer';
|
|
2
|
-
export declare const PDU_TYPE: {
|
|
3
|
-
DEMAND_ACTIVE: number;
|
|
4
|
-
CONFIRM_ACTIVE: number;
|
|
5
|
-
DEACTIVATE_ALL: number;
|
|
6
|
-
DATA: number;
|
|
7
|
-
SERVER_REDIRECT: number;
|
|
8
|
-
};
|
|
9
|
-
export declare const PDU_TYPE2: {
|
|
10
|
-
UPDATE: number;
|
|
11
|
-
CONTROL: number;
|
|
12
|
-
POINTER: number;
|
|
13
|
-
INPUT: number;
|
|
14
|
-
SYNCHRONIZE: number;
|
|
15
|
-
REFRESH_RECT: number;
|
|
16
|
-
PLAY_SOUND: number;
|
|
17
|
-
SUPPRESS_OUTPUT: number;
|
|
18
|
-
SHUTDOWN_REQUEST: number;
|
|
19
|
-
SHUTDOWN_DENIED: number;
|
|
20
|
-
SAVE_SESSION_INFO: number;
|
|
21
|
-
FONT_LIST: number;
|
|
22
|
-
FONT_MAP: number;
|
|
23
|
-
SET_ERROR_INFO: number;
|
|
24
|
-
MONITOR_LAYOUT: number;
|
|
25
|
-
};
|
|
26
|
-
export declare const UPDATE_TYPE: {
|
|
27
|
-
ORDERS: number;
|
|
28
|
-
BITMAP: number;
|
|
29
|
-
PALETTE: number;
|
|
30
|
-
SYNCHRONIZE: number;
|
|
31
|
-
};
|
|
32
|
-
export declare const CONTROL_ACTION: {
|
|
33
|
-
REQUEST_CONTROL: number;
|
|
34
|
-
GRANTED_CONTROL: number;
|
|
35
|
-
DETACH: number;
|
|
36
|
-
COOPERATE: number;
|
|
37
|
-
};
|
|
38
|
-
export declare const INPUT_EVENT: {
|
|
39
|
-
SYNC: number;
|
|
40
|
-
SCANCODE: number;
|
|
41
|
-
UNICODE: number;
|
|
42
|
-
MOUSE: number;
|
|
43
|
-
MOUSEX: number;
|
|
44
|
-
};
|
|
45
|
-
export declare const KEYBOARD_FLAG: {
|
|
46
|
-
EXTENDED: number;
|
|
47
|
-
DOWN: number;
|
|
48
|
-
RELEASE: number;
|
|
49
|
-
};
|
|
50
|
-
export declare const POINTER_FLAG: {
|
|
51
|
-
WHEEL: number;
|
|
52
|
-
HWHEEL: number;
|
|
53
|
-
WHEEL_NEGATIVE: number;
|
|
54
|
-
MOVE: number;
|
|
55
|
-
DOWN: number;
|
|
56
|
-
BUTTON1: number;
|
|
57
|
-
BUTTON2: number;
|
|
58
|
-
BUTTON3: number;
|
|
59
|
-
};
|
|
60
|
-
/** Translate browser-style wheel direction to the signed RDP rotation flags. */
|
|
61
|
-
export declare function pointerWheelFlags(delta: number, horizontal?: boolean): number;
|
|
62
|
-
export declare const TOGGLE_FLAG: {
|
|
63
|
-
SCROLL_LOCK: number;
|
|
64
|
-
NUM_LOCK: number;
|
|
65
|
-
CAPS_LOCK: number;
|
|
66
|
-
KANA_LOCK: number;
|
|
67
|
-
};
|
|
68
|
-
export declare function errorInfoMessage(errorInfo: any): any;
|
|
69
|
-
/** TS_SHARECONTROLHEADER + payload. */
|
|
70
|
-
export declare function shareControlPdu(pduType: any, userId: number, payload: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
71
|
-
/** TS_SHAREDATAHEADER inside a share control PDU of type DATA. */
|
|
72
|
-
export declare function shareDataPdu(shareId: number, userId: number, pduType2: any, payload: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
73
|
-
/**
|
|
74
|
-
* Client Info PDU (MS-RDPBCGR 2.2.1.11). The credential lengths sit in front of
|
|
75
|
-
* the strings, so the strings are written to a scratch buffer first.
|
|
76
|
-
*/
|
|
77
|
-
export declare function clientInfoPdu({ domain, username, password, performanceFlags, autoLogon, remoteApp }: {
|
|
78
|
-
autoLogon: any;
|
|
79
|
-
domain: any;
|
|
80
|
-
password: any;
|
|
81
|
-
performanceFlags: any;
|
|
82
|
-
remoteApp?: boolean;
|
|
83
|
-
username: any;
|
|
84
|
-
}): Uint8Array<ArrayBufferLike>;
|
|
85
|
-
export declare function synchronizePdu(targetUser: any): Uint8Array<ArrayBufferLike>;
|
|
86
|
-
export declare function controlPdu(action: any): Uint8Array<ArrayBufferLike>;
|
|
87
|
-
export declare function fontListPdu(): Uint8Array<ArrayBufferLike>;
|
|
88
|
-
export declare function confirmActivePdu(shareId: number, capabilities: any, capabilityCount: any): Uint8Array<ArrayBufferLike>;
|
|
89
|
-
/** TS_INPUT_PDU_DATA: a batch of input events sharing one header. */
|
|
90
|
-
export declare function inputEventsPdu(events: any): Uint8Array<ArrayBufferLike>;
|
|
91
|
-
export declare function scancodeEvent(scancode: any, pressed: boolean, extended: any): Uint8Array<ArrayBufferLike>;
|
|
92
|
-
export declare function unicodeEvent(codeUnit: any, pressed: boolean): Uint8Array<ArrayBufferLike>;
|
|
93
|
-
export declare function mouseEvent(flags: number, x: number, y: number): Uint8Array<ArrayBufferLike>;
|
|
94
|
-
export declare function extendedMouseEvent(flags: number, x: number, y: number): Uint8Array<ArrayBufferLike>;
|
|
95
|
-
export declare function syncEvent(toggleFlags: number): Uint8Array<ArrayBufferLike>;
|
|
96
|
-
export declare function refreshRectPdu(rects: any): Uint8Array<ArrayBufferLike>;
|
|
97
|
-
export declare function suppressOutputPdu(allowDisplayUpdates: any, rect: any): Uint8Array<ArrayBufferLike>;
|
|
98
|
-
export declare function parseShareControlHeader(bytes: Uint8Array): {
|
|
99
|
-
totalLength: number;
|
|
100
|
-
pduType: number;
|
|
101
|
-
pduSource: number;
|
|
102
|
-
payload: Uint8Array<ArrayBufferLike>;
|
|
103
|
-
};
|
|
104
|
-
export declare function parseShareDataHeader(bytes: Uint8Array): {
|
|
105
|
-
shareId: number;
|
|
106
|
-
pduType2: number;
|
|
107
|
-
compressedType: number;
|
|
108
|
-
compressedLength: number;
|
|
109
|
-
payload: Uint8Array<ArrayBufferLike>;
|
|
110
|
-
};
|
|
111
|
-
export declare function parseDemandActive(bytes: Uint8Array): {
|
|
112
|
-
shareId: number;
|
|
113
|
-
capabilities: Uint8Array<ArrayBufferLike>;
|
|
114
|
-
};
|
|
115
|
-
export declare function parseBitmapUpdate(reader: Reader): any[];
|
|
116
|
-
export declare function parsePaletteUpdate(reader: Reader): Uint8Array<ArrayBuffer>;
|
|
117
|
-
export declare function parsePointerUpdate(reader: Reader): {
|
|
118
|
-
kind: string;
|
|
119
|
-
cacheIndex: number;
|
|
120
|
-
hotSpotX: number;
|
|
121
|
-
hotSpotY: number;
|
|
122
|
-
width: number;
|
|
123
|
-
height: number;
|
|
124
|
-
xorBpp: any;
|
|
125
|
-
xorMask: Uint8Array<ArrayBuffer>;
|
|
126
|
-
andMask: Uint8Array<ArrayBuffer>;
|
|
127
|
-
} | {
|
|
128
|
-
kind: string;
|
|
129
|
-
x: number;
|
|
130
|
-
y: number;
|
|
131
|
-
hidden?: undefined;
|
|
132
|
-
cacheIndex?: undefined;
|
|
133
|
-
messageType?: undefined;
|
|
134
|
-
} | {
|
|
135
|
-
x?: undefined;
|
|
136
|
-
y?: undefined;
|
|
137
|
-
kind: string;
|
|
138
|
-
hidden: boolean;
|
|
139
|
-
cacheIndex?: undefined;
|
|
140
|
-
messageType?: undefined;
|
|
141
|
-
} | {
|
|
142
|
-
x?: undefined;
|
|
143
|
-
y?: undefined;
|
|
144
|
-
hidden?: undefined;
|
|
145
|
-
kind: string;
|
|
146
|
-
cacheIndex: number;
|
|
147
|
-
messageType?: undefined;
|
|
148
|
-
} | {
|
|
149
|
-
x?: undefined;
|
|
150
|
-
y?: undefined;
|
|
151
|
-
hidden?: undefined;
|
|
152
|
-
cacheIndex?: undefined;
|
|
153
|
-
kind: string;
|
|
154
|
-
messageType: number;
|
|
155
|
-
};
|