ai-remote 0.4.0 → 0.4.2
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/{src/index.ts → dist/index.d.ts} +0 -1
- package/dist/index.js +0 -1
- package/dist/protocols/index.d.ts +31 -0
- package/dist/protocols/index.js +0 -1
- package/dist/protocols/rdp/buffer.d.ts +38 -0
- package/dist/protocols/rdp/buffer.js +0 -1
- package/dist/protocols/rdp/caps.d.ts +49 -0
- package/dist/protocols/rdp/caps.js +0 -1
- package/dist/protocols/rdp/cert.d.ts +18 -0
- package/dist/protocols/rdp/cert.js +0 -1
- package/dist/protocols/rdp/client.d.ts +56 -0
- package/dist/protocols/rdp/client.js +0 -1
- package/dist/protocols/rdp/cliprdr.d.ts +27 -0
- package/dist/protocols/rdp/cliprdr.js +0 -1
- package/dist/protocols/rdp/credssp.d.ts +34 -0
- package/dist/protocols/rdp/credssp.js +0 -1
- package/dist/protocols/rdp/crypto.d.ts +63 -0
- package/dist/protocols/rdp/crypto.js +0 -1
- package/dist/protocols/rdp/display.d.ts +38 -0
- package/dist/protocols/rdp/display.js +0 -1
- package/dist/protocols/rdp/gcc.d.ts +23 -0
- package/dist/protocols/rdp/gcc.js +0 -1
- package/dist/protocols/rdp/keymap.d.ts +9 -0
- package/dist/protocols/rdp/keymap.js +0 -1
- package/dist/protocols/rdp/mcs.d.ts +40 -0
- package/dist/protocols/rdp/mcs.js +0 -1
- package/dist/protocols/rdp/ntlm.d.ts +61 -0
- package/dist/protocols/rdp/ntlm.js +0 -1
- package/dist/protocols/rdp/pdu.d.ts +155 -0
- package/dist/protocols/rdp/pdu.js +0 -1
- package/dist/protocols/rdp/rail.d.ts +119 -0
- package/dist/protocols/rdp/rail.js +0 -1
- package/dist/protocols/rdp/rle.d.ts +13 -0
- package/dist/protocols/rdp/rle.js +0 -1
- package/dist/protocols/rdp/sec.d.ts +59 -0
- package/dist/protocols/rdp/sec.js +0 -1
- package/dist/protocols/rdp/session.d.ts +62 -0
- package/dist/protocols/rdp/session.js +0 -1
- package/dist/protocols/rdp/tls.d.ts +18 -0
- package/dist/protocols/rdp/tls.js +0 -1
- package/dist/protocols/rdp/vchannel.d.ts +28 -0
- package/dist/protocols/rdp/vchannel.js +0 -1
- package/dist/protocols/rdp/x224.d.ts +40 -0
- package/dist/protocols/rdp/x224.js +0 -1
- package/dist/protocols/ssh/kex.d.ts +97 -0
- package/dist/protocols/ssh/kex.js +0 -1
- package/dist/protocols/ssh/messages.d.ts +50 -0
- package/dist/protocols/ssh/messages.js +0 -1
- package/dist/protocols/ssh/session.d.ts +66 -0
- package/dist/protocols/ssh/session.js +0 -1
- package/dist/protocols/ssh/terminal.d.ts +46 -0
- package/dist/protocols/ssh/terminal.js +0 -1
- package/dist/protocols/ssh/transport.d.ts +62 -0
- package/dist/protocols/ssh/transport.js +0 -1
- package/dist/protocols/ssh/wire.d.ts +52 -0
- package/dist/protocols/ssh/wire.js +0 -1
- package/dist/protocols/types.d.ts +127 -0
- package/dist/protocols/types.js +0 -1
- package/dist/protocols/vnc/input.d.ts +5 -0
- package/dist/protocols/vnc/input.js +0 -1
- package/dist/protocols/vnc/session.d.ts +12 -0
- package/dist/protocols/vnc/session.js +0 -1
- package/dist/shared/connection.d.ts +81 -0
- package/dist/shared/connection.js +0 -1
- package/dist/shared/device.d.ts +26 -0
- package/dist/shared/device.js +0 -1
- package/dist/shared/hosts.d.ts +63 -0
- package/dist/shared/hosts.js +0 -1
- package/dist/shared/icons.d.ts +46 -0
- package/dist/shared/icons.js +0 -1
- package/dist/shared/protocol.d.ts +28 -0
- package/dist/shared/protocol.js +0 -1
- package/dist/shared/signals.d.ts +37 -0
- package/dist/shared/signals.js +0 -1
- package/package.json +10 -11
- package/dist/index.js.map +0 -7
- package/dist/protocols/index.js.map +0 -7
- package/dist/protocols/rdp/buffer.js.map +0 -7
- package/dist/protocols/rdp/caps.js.map +0 -7
- package/dist/protocols/rdp/cert.js.map +0 -7
- package/dist/protocols/rdp/client.js.map +0 -7
- package/dist/protocols/rdp/cliprdr.js.map +0 -7
- package/dist/protocols/rdp/credssp.js.map +0 -7
- package/dist/protocols/rdp/crypto.js.map +0 -7
- package/dist/protocols/rdp/display.js.map +0 -7
- package/dist/protocols/rdp/gcc.js.map +0 -7
- package/dist/protocols/rdp/keymap.js.map +0 -7
- package/dist/protocols/rdp/mcs.js.map +0 -7
- package/dist/protocols/rdp/ntlm.js.map +0 -7
- package/dist/protocols/rdp/pdu.js.map +0 -7
- package/dist/protocols/rdp/rail.js.map +0 -7
- package/dist/protocols/rdp/rle.js.map +0 -7
- package/dist/protocols/rdp/sec.js.map +0 -7
- package/dist/protocols/rdp/session.js.map +0 -7
- package/dist/protocols/rdp/tls.js.map +0 -7
- package/dist/protocols/rdp/vchannel.js.map +0 -7
- package/dist/protocols/rdp/x224.js.map +0 -7
- package/dist/protocols/ssh/kex.js.map +0 -7
- package/dist/protocols/ssh/messages.js.map +0 -7
- package/dist/protocols/ssh/session.js.map +0 -7
- package/dist/protocols/ssh/terminal.js.map +0 -7
- package/dist/protocols/ssh/transport.js.map +0 -7
- package/dist/protocols/ssh/wire.js.map +0 -7
- package/dist/protocols/types.js.map +0 -7
- package/dist/protocols/vnc/input.js.map +0 -7
- package/dist/protocols/vnc/session.js.map +0 -7
- package/dist/shared/connection.js.map +0 -7
- package/dist/shared/device.js.map +0 -7
- package/dist/shared/hosts.js.map +0 -7
- package/dist/shared/icons.js.map +0 -7
- package/dist/shared/protocol.js.map +0 -7
- package/dist/shared/signals.js.map +0 -7
- package/src/cli/cli.ts +0 -462
- package/src/cli/daemon.ts +0 -306
- package/src/cli/framebuffer.ts +0 -115
- package/src/cli/generated/viewer-bundle.ts +0 -5
- package/src/cli/ipc.ts +0 -78
- package/src/cli/native/window.swift +0 -151
- package/src/cli/paths.ts +0 -28
- package/src/cli/png.ts +0 -106
- package/src/cli/session.ts +0 -263
- package/src/cli/shell.ts +0 -184
- package/src/cli/transport.ts +0 -86
- package/src/cli/viewer-client/assets.d.ts +0 -4
- package/src/cli/viewer-client/main.ts +0 -323
- package/src/cli/viewer-page.ts +0 -138
- package/src/cli/viewer.ts +0 -296
- package/src/cli/window.ts +0 -140
- package/src/cli/wsserver.ts +0 -144
- package/src/protocols/index.ts +0 -72
- package/src/protocols/rdp/buffer.ts +0 -204
- package/src/protocols/rdp/caps.ts +0 -304
- package/src/protocols/rdp/cert.ts +0 -190
- package/src/protocols/rdp/client.ts +0 -1371
- package/src/protocols/rdp/cliprdr.ts +0 -344
- package/src/protocols/rdp/credssp.ts +0 -319
- package/src/protocols/rdp/crypto.ts +0 -416
- package/src/protocols/rdp/display.ts +0 -750
- package/src/protocols/rdp/gcc.ts +0 -162
- package/src/protocols/rdp/keymap.ts +0 -68
- package/src/protocols/rdp/mcs.ts +0 -283
- package/src/protocols/rdp/ntlm.ts +0 -380
- package/src/protocols/rdp/pdu.ts +0 -497
- package/src/protocols/rdp/rail.ts +0 -480
- package/src/protocols/rdp/rle.ts +0 -343
- package/src/protocols/rdp/sec.ts +0 -184
- package/src/protocols/rdp/session.ts +0 -393
- package/src/protocols/rdp/tls.ts +0 -452
- package/src/protocols/rdp/vchannel.ts +0 -89
- package/src/protocols/rdp/x224.ts +0 -139
- package/src/protocols/ssh/kex.ts +0 -227
- package/src/protocols/ssh/messages.ts +0 -54
- package/src/protocols/ssh/session.ts +0 -879
- package/src/protocols/ssh/terminal.ts +0 -242
- package/src/protocols/ssh/transport.ts +0 -745
- package/src/protocols/ssh/wire.ts +0 -220
- package/src/protocols/types.ts +0 -146
- package/src/protocols/vnc/input.ts +0 -13
- package/src/protocols/vnc/novnc.d.ts +0 -75
- package/src/protocols/vnc/session.ts +0 -367
- package/src/shared/connection.ts +0 -206
- package/src/shared/device.ts +0 -28
- package/src/shared/hosts.ts +0 -240
- package/src/shared/icons.ts +0 -49
- package/src/shared/protocol.ts +0 -55
- package/src/shared/signals.ts +0 -67
package/dist/index.js
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The protocol registry the workspace talks to.
|
|
3
|
+
*
|
|
4
|
+
* The UI owns the toolbar, the dialogs, the stats rail and the on-screen
|
|
5
|
+
* keyboard, none of which care whether a session is VNC or RDP. Everything that
|
|
6
|
+
* does differ -- the endpoint, how a client is constructed, the wording of a
|
|
7
|
+
* failure, the labels in the connect dialog -- is looked up here instead of
|
|
8
|
+
* branching at each site.
|
|
9
|
+
*/
|
|
10
|
+
import type { ProtocolDriver } from './types';
|
|
11
|
+
import type { RemoteProtocol } from '../shared/protocol';
|
|
12
|
+
export type { ProtocolDriver, RemoteSession, SessionOptions, ScreenGeometry } from './types';
|
|
13
|
+
export declare const DRIVERS: Record<RemoteProtocol, ProtocolDriver>;
|
|
14
|
+
/** Unknown names fall back to VNC, which is what the dialog opens on. */
|
|
15
|
+
export declare function driverFor(protocol: string | undefined): ProtocolDriver;
|
|
16
|
+
/** What the workspace knows about a session that has just ended. */
|
|
17
|
+
export interface DisconnectDiagnostic {
|
|
18
|
+
protocol: RemoteProtocol;
|
|
19
|
+
/** The transport close, when one arrived. A 1006 means it did not. */
|
|
20
|
+
close: {
|
|
21
|
+
code: number;
|
|
22
|
+
reason: string;
|
|
23
|
+
} | null;
|
|
24
|
+
/** True once the session had reached the desktop. */
|
|
25
|
+
established: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Explain a disconnect in terms someone can act on. The protocol gets first
|
|
29
|
+
* say, then the close codes that mean the same thing either way.
|
|
30
|
+
*/
|
|
31
|
+
export declare function explainDisconnect(diagnostic: DisconnectDiagnostic, clean: boolean, protocolMessage: string): string;
|
package/dist/protocols/index.js
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export declare class Writer {
|
|
2
|
+
#private;
|
|
3
|
+
private bytes;
|
|
4
|
+
private view;
|
|
5
|
+
private offset;
|
|
6
|
+
constructor(capacity?: number);
|
|
7
|
+
u8(value: number): this;
|
|
8
|
+
u16le(value: number): this;
|
|
9
|
+
u16be(value: number): this;
|
|
10
|
+
u32le(value: number): this;
|
|
11
|
+
u32be(value: number): this;
|
|
12
|
+
raw(bytes: Uint8Array): this;
|
|
13
|
+
zeros(count: number): this;
|
|
14
|
+
/** UTF-16LE, optionally padded or truncated to a fixed byte width. */
|
|
15
|
+
utf16le(text: string, fixedBytes?: number): this;
|
|
16
|
+
/** Overwrite an earlier 16-bit slot, for length fields known only later. */
|
|
17
|
+
patchU16le(position: number, value: number): this;
|
|
18
|
+
patchU16be(position: number, value: number): this;
|
|
19
|
+
get length(): number;
|
|
20
|
+
take(): Uint8Array;
|
|
21
|
+
}
|
|
22
|
+
export declare class Reader {
|
|
23
|
+
#private;
|
|
24
|
+
private readonly bytes;
|
|
25
|
+
private readonly view;
|
|
26
|
+
offset: number;
|
|
27
|
+
constructor(bytes: Uint8Array, offset?: number);
|
|
28
|
+
get remaining(): number;
|
|
29
|
+
u8(): number;
|
|
30
|
+
u16le(): number;
|
|
31
|
+
u16be(): number;
|
|
32
|
+
u32le(): number;
|
|
33
|
+
u32be(): number;
|
|
34
|
+
raw(count: number): Uint8Array;
|
|
35
|
+
skip(count: number): this;
|
|
36
|
+
rest(): Uint8Array;
|
|
37
|
+
}
|
|
38
|
+
export declare function concatBytes(...parts: readonly Uint8Array[]): Uint8Array;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export declare const CAPSET: {
|
|
2
|
+
GENERAL: number;
|
|
3
|
+
BITMAP: number;
|
|
4
|
+
ORDER: number;
|
|
5
|
+
BITMAPCACHE: number;
|
|
6
|
+
CONTROL: number;
|
|
7
|
+
ACTIVATION: number;
|
|
8
|
+
POINTER: number;
|
|
9
|
+
SHARE: number;
|
|
10
|
+
COLORCACHE: number;
|
|
11
|
+
SOUND: number;
|
|
12
|
+
INPUT: number;
|
|
13
|
+
FONT: number;
|
|
14
|
+
BRUSH: number;
|
|
15
|
+
GLYPHCACHE: number;
|
|
16
|
+
OFFSCREENCACHE: number;
|
|
17
|
+
VIRTUALCHANNEL: number;
|
|
18
|
+
RAIL: number;
|
|
19
|
+
WINDOW: number;
|
|
20
|
+
MULTIFRAGMENTUPDATE: number;
|
|
21
|
+
LARGE_POINTER: number;
|
|
22
|
+
SURFACE_COMMANDS: number;
|
|
23
|
+
BITMAP_CODECS: number;
|
|
24
|
+
};
|
|
25
|
+
export declare function buildClientCapabilities({ width, height, keyboardLayout, remoteApp, remoteAppCaps }: {
|
|
26
|
+
height: any;
|
|
27
|
+
keyboardLayout: any;
|
|
28
|
+
remoteApp?: boolean;
|
|
29
|
+
remoteAppCaps?: any;
|
|
30
|
+
width: any;
|
|
31
|
+
}): {
|
|
32
|
+
bytes: Uint8Array<ArrayBufferLike>;
|
|
33
|
+
count: number;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Read the host's Demand Active capabilities. The desktop size it reports wins
|
|
37
|
+
* over anything the client asked for.
|
|
38
|
+
*/
|
|
39
|
+
export declare function parseServerCapabilities(bytes: Uint8Array): {
|
|
40
|
+
desktopWidth: number;
|
|
41
|
+
desktopHeight: number;
|
|
42
|
+
preferredBitsPerPixel: number;
|
|
43
|
+
refreshRectSupport: boolean;
|
|
44
|
+
railSupportLevel: number;
|
|
45
|
+
windowSupportLevel: number;
|
|
46
|
+
numIconCaches: number;
|
|
47
|
+
numIconCacheEntries: number;
|
|
48
|
+
types: any[];
|
|
49
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pull the RSA public key out of a DER X.509 certificate, for the TLS layer.
|
|
3
|
+
*
|
|
4
|
+
* CredSSP needs the exact bytes of the certificate's subjectPublicKey BIT
|
|
5
|
+
* STRING contents -- the DER RSAPublicKey -- because that is what both ends
|
|
6
|
+
* hash to bind the authentication to this TLS channel (MS-CSSP 3.1.5).
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseX509PublicKey(der: Uint8Array): {
|
|
9
|
+
modulus: Uint8Array<ArrayBufferLike>;
|
|
10
|
+
exponent: Uint8Array<ArrayBufferLike>;
|
|
11
|
+
subjectPublicKey: any;
|
|
12
|
+
};
|
|
13
|
+
/** Parse a server certificate blob into an RSA public key. */
|
|
14
|
+
export declare function parseServerCertificate(certificateBytes: Uint8Array): {
|
|
15
|
+
modulus: Uint8Array<ArrayBuffer>;
|
|
16
|
+
exponent: Uint8Array<ArrayBuffer>;
|
|
17
|
+
source: string;
|
|
18
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A single RDP connection. Emits:
|
|
3
|
+
* 'ready' { width, height } -- the desktop size is known
|
|
4
|
+
* 'bitmap' { rects } -- decoded rectangles to paint
|
|
5
|
+
* 'palette' Uint8Array -- 8bpp palette update
|
|
6
|
+
* 'pointer' pointer update -- shape, position or visibility
|
|
7
|
+
* 'error' { message } -- fatal, always followed by 'close'
|
|
8
|
+
* 'close' { clean, message }
|
|
9
|
+
*/
|
|
10
|
+
export declare class RdpClient extends EventTarget {
|
|
11
|
+
#private;
|
|
12
|
+
constructor(url: string, options?: {});
|
|
13
|
+
disconnect(): void;
|
|
14
|
+
/**
|
|
15
|
+
* The window the session exists to show: the largest top-level application
|
|
16
|
+
* window. Menus, tooltips and drag images are RAIL windows too, and fitting
|
|
17
|
+
* one of those to the browser instead of the application would be worse than
|
|
18
|
+
* doing nothing.
|
|
19
|
+
*/
|
|
20
|
+
get remoteAppPrimaryWindow(): any;
|
|
21
|
+
/**
|
|
22
|
+
* Size the remote application's window to the room the browser has for it.
|
|
23
|
+
*
|
|
24
|
+
* The RDP desktop is fixed for the life of a connection -- resizing it needs
|
|
25
|
+
* the dynamic virtual channel this client does not speak -- so the desktop is
|
|
26
|
+
* negotiated large at connect time and the application window is moved and
|
|
27
|
+
* resized inside it instead. The canvas then shows only that window.
|
|
28
|
+
*/
|
|
29
|
+
fitRemoteApp(width: number, height: number): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Hand the host our clipboard text. Resolves once the host has acknowledged
|
|
32
|
+
* owning it, which is what makes it safe to send a paste keystroke next.
|
|
33
|
+
*/
|
|
34
|
+
setClipboardText(text: string): any;
|
|
35
|
+
get clipboardShared(): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Deliver text into the session the way a person would: put it on the host's
|
|
38
|
+
* clipboard, wait for the host to acknowledge owning it, then press the paste
|
|
39
|
+
* shortcut. Waiting is what stops the keystroke from pasting the previous
|
|
40
|
+
* contents. A host with no clipboard channel gets the text typed instead.
|
|
41
|
+
*/
|
|
42
|
+
pasteToHost(text: string): any;
|
|
43
|
+
get connected(): boolean;
|
|
44
|
+
sendKeyByCode(code: number, pressed: boolean): boolean;
|
|
45
|
+
sendUnicode(text: string): void;
|
|
46
|
+
sendCtrlAltDel(): void;
|
|
47
|
+
sendMouseMove(x: number, y: number): void;
|
|
48
|
+
sendMouseButton(button: number, pressed: boolean, x: number, y: number): void;
|
|
49
|
+
sendWheel(delta: number, x: number, y: number, horizontal?: boolean): void;
|
|
50
|
+
/** Tell the host which lock keys are already on, so they do not drift. */
|
|
51
|
+
sendKeyboardSync(toggleFlags: number): void;
|
|
52
|
+
/** Ask the host to resend a region, used after the canvas is re-created. */
|
|
53
|
+
refresh(rect: any): void;
|
|
54
|
+
/** Pause or resume host output, e.g. while the tab is hidden. */
|
|
55
|
+
setOutputEnabled(enabled: boolean): void;
|
|
56
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One clipboard channel. Emits:
|
|
3
|
+
* 'text' { text } -- the host's clipboard now holds this text
|
|
4
|
+
*/
|
|
5
|
+
export declare class ClipboardChannel extends EventTarget {
|
|
6
|
+
#private;
|
|
7
|
+
private readonly send;
|
|
8
|
+
private readonly log;
|
|
9
|
+
private ready;
|
|
10
|
+
private longFormatNames;
|
|
11
|
+
private localText;
|
|
12
|
+
private pendingAck;
|
|
13
|
+
/**
|
|
14
|
+
* @param {(bytes: Uint8Array) => void} send delivers one complete channel message
|
|
15
|
+
* @param {(step: string, detail?: unknown) => void} [log]
|
|
16
|
+
*/
|
|
17
|
+
constructor({ send, log }: {
|
|
18
|
+
log: any;
|
|
19
|
+
send: any;
|
|
20
|
+
});
|
|
21
|
+
/**
|
|
22
|
+
* Announce that this side now owns the clipboard and holds `text`. Resolves
|
|
23
|
+
* once the host has acknowledged, so a paste keystroke can safely follow.
|
|
24
|
+
*/
|
|
25
|
+
setLocalText(text: string): Promise<unknown>;
|
|
26
|
+
receive(bytes: Uint8Array): void;
|
|
27
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare class CredSspClient {
|
|
2
|
+
#private;
|
|
3
|
+
private readonly username;
|
|
4
|
+
private readonly domain;
|
|
5
|
+
private readonly password;
|
|
6
|
+
private readonly serverPublicKey;
|
|
7
|
+
private readonly send;
|
|
8
|
+
private readonly log;
|
|
9
|
+
private inbound;
|
|
10
|
+
private waiters;
|
|
11
|
+
constructor({ username, domain, password, serverPublicKey, send, log }: {
|
|
12
|
+
domain: any;
|
|
13
|
+
log: any;
|
|
14
|
+
password: any;
|
|
15
|
+
send: any;
|
|
16
|
+
serverPublicKey: any;
|
|
17
|
+
username: any;
|
|
18
|
+
});
|
|
19
|
+
/** Feed decrypted TLS application data. */
|
|
20
|
+
receive(bytes: Uint8Array): void;
|
|
21
|
+
authenticate(): Promise<{
|
|
22
|
+
authenticated: boolean;
|
|
23
|
+
reachedChallenge: boolean;
|
|
24
|
+
hostVersion: any;
|
|
25
|
+
targetName: string;
|
|
26
|
+
note: string;
|
|
27
|
+
} | {
|
|
28
|
+
reachedChallenge?: undefined;
|
|
29
|
+
note?: undefined;
|
|
30
|
+
authenticated: boolean;
|
|
31
|
+
hostVersion: any;
|
|
32
|
+
targetName: string;
|
|
33
|
+
}>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export declare function md5(message: Uint8Array): Uint8Array<ArrayBuffer>;
|
|
2
|
+
export declare function sha1(message: Uint8Array): Uint8Array<ArrayBuffer>;
|
|
3
|
+
/** RC4 keystream position. RDP re-keys every 4096 PDUs, so this is mutable. */
|
|
4
|
+
export interface Rc4State {
|
|
5
|
+
s: Uint8Array;
|
|
6
|
+
i: number;
|
|
7
|
+
j: number;
|
|
8
|
+
}
|
|
9
|
+
/** The five values MS-RDPBCGR 5.3.5 derives from the two randoms. */
|
|
10
|
+
export interface SessionKeys {
|
|
11
|
+
macKey: Uint8Array;
|
|
12
|
+
keyLength: number;
|
|
13
|
+
is40Bit: boolean;
|
|
14
|
+
initialDecryptKey: Uint8Array;
|
|
15
|
+
initialEncryptKey: Uint8Array;
|
|
16
|
+
decryptKey: Uint8Array;
|
|
17
|
+
encryptKey: Uint8Array;
|
|
18
|
+
}
|
|
19
|
+
export declare function rc4Init(key: Uint8Array): Rc4State;
|
|
20
|
+
/** RC4 is symmetric, so this both encrypts and decrypts. State advances. */
|
|
21
|
+
export declare function rc4Crypt(state: any, data: Uint8Array): Uint8Array<ArrayBuffer>;
|
|
22
|
+
/**
|
|
23
|
+
* Textbook RSA over little-endian buffers, which is what RDP's Security
|
|
24
|
+
* Exchange PDU carries: the client random is raised to the server's public
|
|
25
|
+
* exponent with no padding scheme (MS-RDPBCGR 5.3.4.1).
|
|
26
|
+
*/
|
|
27
|
+
export declare function rsaEncrypt(dataLe: Uint8Array, modulusLe: Uint8Array, exponentLe: Uint8Array): Uint8Array<ArrayBuffer>;
|
|
28
|
+
/**
|
|
29
|
+
* RSAES-PKCS1-v1_5 encryption over big-endian buffers, which is what TLS uses
|
|
30
|
+
* for an RSA key exchange. WebCrypto only offers OAEP, so the padding is built
|
|
31
|
+
* here and the modular exponentiation reuses the same BigInt path as RDP.
|
|
32
|
+
*/
|
|
33
|
+
export declare function rsaEncryptPkcs1(message: Uint8Array, modulusBe: Uint8Array, exponentBe: Uint8Array): Uint8Array<ArrayBuffer>;
|
|
34
|
+
export declare const ENCRYPTION_METHOD: {
|
|
35
|
+
NONE: number;
|
|
36
|
+
BIT_40: number;
|
|
37
|
+
BIT_128: number;
|
|
38
|
+
BIT_56: number;
|
|
39
|
+
FIPS: number;
|
|
40
|
+
};
|
|
41
|
+
export declare function keyLengthForMethod(encryptionMethod: number): 8 | 16;
|
|
42
|
+
/**
|
|
43
|
+
* Derive the MAC key and both directional RC4 keys from the two random values
|
|
44
|
+
* exchanged during connection.
|
|
45
|
+
*/
|
|
46
|
+
export declare function deriveSessionKeys(clientRandom: Uint8Array, serverRandom: Uint8Array, encryptionMethod: number): {
|
|
47
|
+
macKey: Uint8Array<ArrayBuffer>;
|
|
48
|
+
keyLength: number;
|
|
49
|
+
is40Bit: boolean;
|
|
50
|
+
initialDecryptKey: Uint8Array<ArrayBuffer>;
|
|
51
|
+
initialEncryptKey: Uint8Array<ArrayBuffer>;
|
|
52
|
+
decryptKey: Uint8Array<ArrayBuffer>;
|
|
53
|
+
encryptKey: Uint8Array<ArrayBuffer>;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* MACSignature = First64Bits(MD5(macKey + Pad2 + SHA1(macKey + Pad1 + len + data)))
|
|
57
|
+
*/
|
|
58
|
+
export declare function macSignature(macKey: any, data: Uint8Array): Uint8Array<ArrayBuffer>;
|
|
59
|
+
/**
|
|
60
|
+
* Every 4096 PDUs the RC4 key is refreshed from the initial key
|
|
61
|
+
* (MS-RDPBCGR 5.3.7.1). The refreshed key is salted with itself.
|
|
62
|
+
*/
|
|
63
|
+
export declare function updateSessionKey(initialKey: any, currentKey: any, keyLength: any, is40Bit: any): Uint8Array<ArrayBuffer>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export declare class RdpDisplay {
|
|
2
|
+
#private;
|
|
3
|
+
constructor(container: any);
|
|
4
|
+
resize(width: number, height: number): void;
|
|
5
|
+
/**
|
|
6
|
+
* Choose the part of the desktop that is on screen. Everything else about
|
|
7
|
+
* the session -- painting, input coordinates, the remote pointer -- keeps
|
|
8
|
+
* working in desktop coordinates, so only the framing changes here.
|
|
9
|
+
*/
|
|
10
|
+
setViewport({ x, y, width, height }?: {
|
|
11
|
+
x?: number;
|
|
12
|
+
y?: number;
|
|
13
|
+
}): void;
|
|
14
|
+
applyScale(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Zoom about a point, keeping whatever is under it in place. `focal` is in
|
|
17
|
+
* client coordinates -- the midpoint between two fingers, usually.
|
|
18
|
+
*/
|
|
19
|
+
setZoom(next: any, focal?: any): void;
|
|
20
|
+
/** Move the visible window over the desktop. Returns what it actually used. */
|
|
21
|
+
panBy(dx: any, dy: any): {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
};
|
|
25
|
+
/** True when the desktop is larger than the window on either axis. */
|
|
26
|
+
canPan(): boolean;
|
|
27
|
+
setScaleViewport(enabled: boolean): void;
|
|
28
|
+
/** Back to the opening view: whole desktop fitted on screen. */
|
|
29
|
+
resetZoom(): void;
|
|
30
|
+
drawRects(rects: any, palette: any): void;
|
|
31
|
+
applyPointer(pointer: any): void;
|
|
32
|
+
attachInput(client: any): void;
|
|
33
|
+
/** A key held while focus moves away would otherwise stay down on the host. */
|
|
34
|
+
releaseAllKeys(): void;
|
|
35
|
+
focus(): void;
|
|
36
|
+
blur(): void;
|
|
37
|
+
destroy(): void;
|
|
38
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** RDP 5.0 and later. Anything newer would oblige us to speak newer PDUs. */
|
|
2
|
+
export declare const RDP_VERSION_5_PLUS = 524292;
|
|
3
|
+
export declare const ENCRYPTION_LEVEL: {
|
|
4
|
+
NONE: number;
|
|
5
|
+
LOW: number;
|
|
6
|
+
CLIENT_COMPATIBLE: number;
|
|
7
|
+
HIGH: number;
|
|
8
|
+
FIPS: number;
|
|
9
|
+
};
|
|
10
|
+
export declare function clientData(options: any): Uint8Array<ArrayBufferLike>;
|
|
11
|
+
/**
|
|
12
|
+
* Walk the host's answer. Only the security and network blocks carry anything
|
|
13
|
+
* the client must act on; the core block is kept for logging.
|
|
14
|
+
*/
|
|
15
|
+
export declare function parseServerData(blocks: any): {
|
|
16
|
+
version: any;
|
|
17
|
+
encryptionMethod: number;
|
|
18
|
+
encryptionLevel: number;
|
|
19
|
+
serverRandom: any;
|
|
20
|
+
publicKey: any;
|
|
21
|
+
ioChannelId: number;
|
|
22
|
+
channelIds: any[];
|
|
23
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Returns { scancode, extended } or null when the key has no RDP equivalent. */
|
|
2
|
+
export declare function lookupScancode(code: string): {
|
|
3
|
+
scancode: any;
|
|
4
|
+
extended: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare const CTRL_ALT_DEL: {
|
|
7
|
+
code: string;
|
|
8
|
+
pressed: boolean;
|
|
9
|
+
}[];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const MCS_BASE_CHANNEL_ID = 1001;
|
|
2
|
+
export declare const MCS_GLOBAL_CHANNEL_ID = 1003;
|
|
3
|
+
export declare function connectInitial(clientData: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
4
|
+
export declare function parseConnectResponse(frame: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
5
|
+
export declare function erectDomainRequest(): Uint8Array<ArrayBufferLike>;
|
|
6
|
+
export declare function attachUserRequest(): Uint8Array<ArrayBufferLike>;
|
|
7
|
+
export declare function parseAttachUserConfirm(frame: Uint8Array): {
|
|
8
|
+
userId: number;
|
|
9
|
+
};
|
|
10
|
+
export declare function channelJoinRequest(userId: number, channelId: number): Uint8Array<ArrayBufferLike>;
|
|
11
|
+
export declare function parseChannelJoinConfirm(frame: Uint8Array): {
|
|
12
|
+
channelId: number;
|
|
13
|
+
};
|
|
14
|
+
export declare function sendDataRequest(userId: number, channelId: number, payload: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
15
|
+
/**
|
|
16
|
+
* Classify an inbound X.224 data frame. Everything the server sends after the
|
|
17
|
+
* connect sequence arrives as a send-data indication on some channel.
|
|
18
|
+
*/
|
|
19
|
+
export declare function parseDomainPdu(frame: Uint8Array): {
|
|
20
|
+
type: string;
|
|
21
|
+
channelId: number;
|
|
22
|
+
payload: Uint8Array<ArrayBufferLike>;
|
|
23
|
+
reason?: undefined;
|
|
24
|
+
message?: undefined;
|
|
25
|
+
mcsPduType?: undefined;
|
|
26
|
+
} | {
|
|
27
|
+
channelId?: undefined;
|
|
28
|
+
payload?: undefined;
|
|
29
|
+
type: string;
|
|
30
|
+
reason: number;
|
|
31
|
+
message: any;
|
|
32
|
+
mcsPduType?: undefined;
|
|
33
|
+
} | {
|
|
34
|
+
channelId?: undefined;
|
|
35
|
+
payload?: undefined;
|
|
36
|
+
reason?: undefined;
|
|
37
|
+
message?: undefined;
|
|
38
|
+
type: string;
|
|
39
|
+
mcsPduType: number;
|
|
40
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export declare function md4(message: string): Uint8Array<ArrayBuffer>;
|
|
2
|
+
/** HMAC-MD5. WebCrypto has no MD5, so it is built from the MD5 here. */
|
|
3
|
+
export declare function hmacMd5(key: Uint8Array, message: string): Uint8Array<ArrayBuffer>;
|
|
4
|
+
export declare const NTLM_FLAG: {
|
|
5
|
+
UNICODE: number;
|
|
6
|
+
REQUEST_TARGET: number;
|
|
7
|
+
SIGN: number;
|
|
8
|
+
SEAL: number;
|
|
9
|
+
NTLM: number;
|
|
10
|
+
ALWAYS_SIGN: number;
|
|
11
|
+
EXTENDED_SESSION_SECURITY: number;
|
|
12
|
+
TARGET_INFO: number;
|
|
13
|
+
VERSION: number;
|
|
14
|
+
KEY_128: number;
|
|
15
|
+
KEY_EXCH: number;
|
|
16
|
+
KEY_56: number;
|
|
17
|
+
};
|
|
18
|
+
export declare function negotiateMessage(): Uint8Array<ArrayBufferLike>;
|
|
19
|
+
export declare function parseChallengeMessage(bytes: Uint8Array): {
|
|
20
|
+
flags: number;
|
|
21
|
+
serverChallenge: Uint8Array<ArrayBuffer>;
|
|
22
|
+
targetName: Uint8Array<ArrayBuffer>;
|
|
23
|
+
targetInfo: Uint8Array<ArrayBuffer>;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Build the AUTHENTICATE message plus every key CredSSP needs afterwards.
|
|
27
|
+
*
|
|
28
|
+
* The MIC is always sent: a current Windows host expects one, and sending it
|
|
29
|
+
* obliges the client to flag it in the AV pair list, which in turn feeds the
|
|
30
|
+
* NTProofStr -- so the modified list has to be the one that goes on the wire.
|
|
31
|
+
*/
|
|
32
|
+
export declare function authenticateMessage({ username, domain, password, challenge, negotiateBytes, challengeBytes }: {
|
|
33
|
+
challenge: any;
|
|
34
|
+
challengeBytes: any;
|
|
35
|
+
domain: any;
|
|
36
|
+
negotiateBytes: any;
|
|
37
|
+
password: any;
|
|
38
|
+
username: any;
|
|
39
|
+
}): {
|
|
40
|
+
message: Uint8Array<ArrayBufferLike>;
|
|
41
|
+
exportedSessionKey: Uint8Array<ArrayBuffer>;
|
|
42
|
+
keys: {
|
|
43
|
+
clientSigningKey: Uint8Array<ArrayBuffer>;
|
|
44
|
+
serverSigningKey: Uint8Array<ArrayBuffer>;
|
|
45
|
+
clientSealing: import("./crypto").Rc4State;
|
|
46
|
+
serverSealing: import("./crypto").Rc4State;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* NTLM message confidentiality (MS-NLMP 3.4.3). The signature covers the
|
|
51
|
+
* plaintext, and both the payload and the checksum draw from the same RC4
|
|
52
|
+
* stream -- payload first.
|
|
53
|
+
*/
|
|
54
|
+
export declare class NtlmSealer {
|
|
55
|
+
private readonly keys;
|
|
56
|
+
private sendSequence;
|
|
57
|
+
private receiveSequence;
|
|
58
|
+
constructor(keys: any);
|
|
59
|
+
seal(plaintext: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
60
|
+
unseal(bytes: Uint8Array): Uint8Array<ArrayBuffer>;
|
|
61
|
+
}
|