dsh-winrm 0.2.0 → 0.3.1
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/README.md +9 -5
- package/README.zh.md +9 -5
- package/lib/client.js +71 -71
- package/lib/index.js +981 -75
- package/lib/types/engine/client.d.ts +48 -1
- package/lib/types/engine/wsman.d.ts +153 -0
- package/lib/types/engine.d.ts +4 -4
- package/lib/types/index.d.ts +6 -5
- package/lib/types/powershell.d.ts +110 -1
- package/lib/types/smb.d.ts +24 -5
- package/package.json +2 -2
- package/src/engine/client.ts +439 -5
- package/src/engine/wsman.ts +357 -0
- package/src/engine.ts +104 -40
- package/src/index.ts +6 -5
- package/src/powershell.ts +298 -2
- package/src/smb.ts +57 -5
- package/src/tools.ts +4 -4
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
| PowerShell 控制台 | WebSocket 命令会话(每条命令通过原生 Node WinRM 客户端执行,输出实时返回) |
|
|
16
16
|
| 服务管理 | 列出 / 启动 / 停止 / 重启 / 改启动类型(自动/手动/禁用) |
|
|
17
17
|
| 进程管理 | 列出(CPU/内存/路径)/ 按 PID 结束 |
|
|
18
|
-
| 文件传输 |
|
|
18
|
+
| 文件传输 | WinRM 流式传输(上传单 shell 单流 / 下载并行区间,**不依赖 SMB**,任意路径可传);上传自动建目录 |
|
|
19
19
|
| 集群 | 一条命令并发跑多台主机(按 aliases / environment / tags 过滤) |
|
|
20
20
|
|
|
21
21
|
## 认证与传输
|
|
@@ -47,7 +47,7 @@ powershell -ExecutionPolicy Bypass -File .\scripts\enable-winrm.ps1
|
|
|
47
47
|
从 [Releases](https://github.com/MoRanYue/dsh-winrm/releases) 下载最新的 `dsh-winrm-*.tgz`,加入 profile:
|
|
48
48
|
|
|
49
49
|
```powershell
|
|
50
|
-
dsh plugin --profile web add D:\downloads\dsh-winrm-0.
|
|
50
|
+
dsh plugin --profile web add D:\downloads\dsh-winrm-0.3.0.tgz
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
也可以直接从 npm 安装:
|
|
@@ -93,10 +93,11 @@ src/
|
|
|
93
93
|
engine.ts WinRmEngine 门面:exec / services / processes / ls / upload / download / console / cluster / test
|
|
94
94
|
store.ts ~/.dsh/dsh-winrm.json 主机存储(原子写,0600)
|
|
95
95
|
protocol.ts 宿主↔浏览器 wire 类型
|
|
96
|
-
powershell.ts PS 片段构造器 + stdin 信封(outer/child 包装 / 服务 / 进程 / 目录 /
|
|
96
|
+
powershell.ts PS 片段构造器 + stdin 信封(outer/child 包装 / 服务 / 进程 / 目录 / 流式收发脚本)
|
|
97
97
|
routes.ts /api/dsh-winrm 路由族 + 控制台 WebSocket(loopback 围栏)
|
|
98
98
|
tools.ts 7 个 winrm_* agent 工具
|
|
99
|
-
engine/client.ts winrm-client 传输层:进程内认证(NTLM/Basic)、UTF-8
|
|
99
|
+
engine/client.ts winrm-client 传输层:进程内认证(NTLM/Basic)、UTF-8 信封、流式上传/下载 + 分块回退
|
|
100
|
+
engine/wsman.ts 手写 WSMan Send/Receive 信封(原始字节走 stdin,不做二次 base64;512000 信封上限)
|
|
100
101
|
engine/console.ts 流式 PowerShell 控制台会话
|
|
101
102
|
client/ 浏览器半:侧边栏入口 + 居中面板(5 页签)
|
|
102
103
|
scripts/
|
|
@@ -109,7 +110,10 @@ scripts/
|
|
|
109
110
|
## 已知限制
|
|
110
111
|
|
|
111
112
|
- 控制台是命令会话,不保持 PowerShell 变量和当前目录状态;每条命令独立执行
|
|
112
|
-
-
|
|
113
|
+
- 上传走**单条 stdin 流**:一个 shell、一个命令,每 256KB 一个 `Send`,可压缩内容自动按块 gzip(实测 1.7MB JSON 线上仅 91KB)。旧的 48KB 分块路径保留为回退,仅在流式通道不可用时启用
|
|
114
|
+
- 下载走**并行区间流**:默认最多 4 个 worker,各自一个 shell 读同一文件的绝对字节区间,远端 gzip 后回传,本地按 offset 落位(实测 2MiB 约 10-12 秒,16MiB 约 21-23 秒,可压缩的 16MiB 约 6 秒;旧的 48KB 分块路径 2MiB 需 129 秒,保留为回退)。服务端单次 `Receive` 最多回 128KB,与信封大小无关,所以下载是往返次数受限而非带宽受限
|
|
115
|
+
- `channel=auto`(默认)先探测目标机 445 端口:`net use` 自身没有短超时,SMB 不可用时要等约 60 秒才失败,此前这段等待发生在每次上传之前。现在 3 秒内判定并直接走 WinRM
|
|
116
|
+
- 下载失败不留残file:已写入的数据会被丢弃、目标文件被删除;若失败发生在任何字节到达之前(路径不存在、目标是目录、主机不可达),已存在的本地文件保持原样不动(目标文件在首次写入时才创建)
|
|
113
117
|
- 单命令默认 60s 超时,可传 `timeoutMs`
|
|
114
118
|
- 目标机需已启用 WinRM(见上);HTTP 明文 Basic 不应用于公网
|
|
115
119
|
- 面板关闭再打开会回到「主机」页签:面板是 `main` 插槽的占用者,切回对话时卸载,页签状态不跨开关保留
|
package/README.zh.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
| PowerShell 控制台 | WebSocket 命令会话(每条命令通过原生 Node WinRM 客户端执行,输出实时返回) |
|
|
14
14
|
| 服务管理 | 列出 / 启动 / 停止 / 重启 / 改启动类型(自动/手动/禁用) |
|
|
15
15
|
| 进程管理 | 列出(CPU/内存/路径)/ 按 PID 结束 |
|
|
16
|
-
| 文件传输 |
|
|
16
|
+
| 文件传输 | WinRM 流式传输(上传单 shell 单流 / 下载并行区间,**不依赖 SMB**,任意路径可传);上传自动建目录 |
|
|
17
17
|
| 集群 | 一条命令并发跑多台主机(按 aliases / environment / tags 过滤) |
|
|
18
18
|
|
|
19
19
|
## 认证与传输
|
|
@@ -50,7 +50,7 @@ powershell -ExecutionPolicy Bypass -File .\scripts\enable-winrm.ps1
|
|
|
50
50
|
从 [Releases](https://github.com/MoRanYue/dsh-winrm/releases) 下载最新的 `dsh-winrm-*.tgz`,加入 profile:
|
|
51
51
|
|
|
52
52
|
```powershell
|
|
53
|
-
dsh plugin --profile web add D:\downloads\dsh-winrm-0.
|
|
53
|
+
dsh plugin --profile web add D:\downloads\dsh-winrm-0.3.0.tgz
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
也可以直接从 npm 安装:
|
|
@@ -96,10 +96,11 @@ src/
|
|
|
96
96
|
engine.ts WinRmEngine 门面:exec / services / processes / ls / upload / download / console / cluster / test
|
|
97
97
|
store.ts ~/.dsh/dsh-winrm.json 主机存储(原子写,0600)
|
|
98
98
|
protocol.ts 宿主↔浏览器 wire 类型
|
|
99
|
-
powershell.ts PS 片段构造器 + stdin 信封(outer/child 包装 / 服务 / 进程 / 目录 /
|
|
99
|
+
powershell.ts PS 片段构造器 + stdin 信封(outer/child 包装 / 服务 / 进程 / 目录 / 流式收发脚本)
|
|
100
100
|
routes.ts /api/dsh-winrm 路由族 + 控制台 WebSocket(loopback 围栏)
|
|
101
101
|
tools.ts 7 个 winrm_* agent 工具
|
|
102
|
-
engine/client.ts winrm-client 传输层:进程内认证(NTLM/Basic)、UTF-8
|
|
102
|
+
engine/client.ts winrm-client 传输层:进程内认证(NTLM/Basic)、UTF-8 信封、流式上传/下载 + 分块回退
|
|
103
|
+
engine/wsman.ts 手写 WSMan Send/Receive 信封(原始字节走 stdin,不做二次 base64;512000 信封上限)
|
|
103
104
|
engine/console.ts 流式 PowerShell 控制台会话
|
|
104
105
|
client/ 浏览器半:侧边栏入口 + 居中面板(5 页签)
|
|
105
106
|
scripts/
|
|
@@ -112,7 +113,10 @@ scripts/
|
|
|
112
113
|
## 已知限制
|
|
113
114
|
|
|
114
115
|
- 控制台是命令会话,不保持 PowerShell 变量和当前目录状态;每条命令独立执行
|
|
115
|
-
-
|
|
116
|
+
- 上传走**单条 stdin 流**:一个 shell、一个命令,每 256KB 一个 `Send`,可压缩内容自动按块 gzip(实测 1.7MB JSON 线上仅 91KB)。旧的 48KB 分块路径保留为回退,仅在流式通道不可用时启用
|
|
117
|
+
- 下载走**并行区间流**:默认最多 4 个 worker,各自一个 shell 读同一文件的绝对字节区间,远端 gzip 后回传,本地按 offset 落位(实测 2MiB 约 10-12 秒,16MiB 约 21-23 秒,可压缩的 16MiB 约 6 秒;旧的 48KB 分块路径 2MiB 需 129 秒,保留为回退)。服务端单次 `Receive` 最多回 128KB,与信封大小无关,所以下载是往返次数受限而非带宽受限
|
|
118
|
+
- `channel=auto`(默认)先探测目标机 445 端口:`net use` 自身没有短超时,SMB 不可用时要等约 60 秒才失败,此前这段等待发生在每次上传之前。现在 3 秒内判定并直接走 WinRM
|
|
119
|
+
- 下载失败不留残file:已写入的数据会被丢弃、目标文件被删除;若失败发生在任何字节到达之前(路径不存在、目标是目录、主机不可达),已存在的本地文件保持原样不动(目标文件在首次写入时才创建)
|
|
116
120
|
- 单命令默认 60s 超时,可传 `timeoutMs`
|
|
117
121
|
- 目标机需已启用 WinRM(见上);HTTP 明文 Basic 不应用于公网
|
|
118
122
|
- 面板关闭再打开会回到「主机」页签:面板是 `main` 插槽的占用者,切回对话时卸载,页签状态不跨开关保留
|
package/lib/client.js
CHANGED
|
@@ -565,93 +565,93 @@ if (typeof document !== "undefined" && document.querySelector("style[data-plugin
|
|
|
565
565
|
document.head.appendChild(tag);
|
|
566
566
|
}
|
|
567
567
|
var panel_module_css_default = {
|
|
568
|
-
"
|
|
569
|
-
"
|
|
570
|
-
"
|
|
571
|
-
"
|
|
572
|
-
"
|
|
573
|
-
"
|
|
574
|
-
"
|
|
575
|
-
"
|
|
568
|
+
"formRow": "hAbY3W_formRow",
|
|
569
|
+
"termPlaceholder": "hAbY3W_termPlaceholder",
|
|
570
|
+
"entryLabel": "hAbY3W_entryLabel",
|
|
571
|
+
"search": "hAbY3W_search",
|
|
572
|
+
"inlineTest": "hAbY3W_inlineTest",
|
|
573
|
+
"loading": "hAbY3W_loading",
|
|
574
|
+
"checkRow": "hAbY3W_checkRow",
|
|
575
|
+
"tabBody": "hAbY3W_tabBody",
|
|
576
|
+
"linkButton": "hAbY3W_linkButton",
|
|
577
|
+
"browseList": "hAbY3W_browseList",
|
|
578
|
+
"dirRow": "hAbY3W_dirRow",
|
|
579
|
+
"clusterFilters": "hAbY3W_clusterFilters",
|
|
576
580
|
"cellPre": "hAbY3W_cellPre",
|
|
577
581
|
"dialog": "hAbY3W_dialog",
|
|
582
|
+
"fieldLabel": "hAbY3W_fieldLabel",
|
|
583
|
+
"panelContent": "hAbY3W_panelContent",
|
|
584
|
+
"spinner": "hAbY3W_spinner",
|
|
585
|
+
"transferBlock": "hAbY3W_transferBlock",
|
|
586
|
+
"consoleOutput": "hAbY3W_consoleOutput",
|
|
587
|
+
"table": "hAbY3W_table",
|
|
588
|
+
"dialogOverlay": "hAbY3W_dialogOverlay",
|
|
589
|
+
"tunnelRow": "hAbY3W_tunnelRow",
|
|
590
|
+
"browseHeader": "hAbY3W_browseHeader",
|
|
591
|
+
"primaryButton": "hAbY3W_primaryButton",
|
|
592
|
+
"panelHeader": "hAbY3W_panelHeader",
|
|
593
|
+
"consoleInputRow": "hAbY3W_consoleInputRow",
|
|
594
|
+
"entry": "hAbY3W_entry",
|
|
595
|
+
"groupSection": "hAbY3W_groupSection",
|
|
596
|
+
"panelTitle": "hAbY3W_panelTitle",
|
|
597
|
+
"banner": "hAbY3W_banner",
|
|
598
|
+
"empty": "hAbY3W_empty",
|
|
599
|
+
"modalTitle": "hAbY3W_modalTitle",
|
|
600
|
+
"modalFooter": "hAbY3W_modalFooter",
|
|
601
|
+
"groupCount": "hAbY3W_groupCount",
|
|
602
|
+
"radioRow": "hAbY3W_radioRow",
|
|
603
|
+
"termBody": "hAbY3W_termBody",
|
|
604
|
+
"groupName": "hAbY3W_groupName",
|
|
605
|
+
"dirSize": "hAbY3W_dirSize",
|
|
606
|
+
"field": "hAbY3W_field",
|
|
607
|
+
"progressMeta": "hAbY3W_progressMeta",
|
|
608
|
+
"fieldHint": "hAbY3W_fieldHint",
|
|
609
|
+
"utf8Note": "hAbY3W_utf8Note",
|
|
610
|
+
"panel": "hAbY3W_panel",
|
|
578
611
|
"hiddenFile": "hAbY3W_hiddenFile",
|
|
579
|
-
"linkButton": "hAbY3W_linkButton",
|
|
580
|
-
"tabBody": "hAbY3W_tabBody",
|
|
581
|
-
"dirName": "hAbY3W_dirName",
|
|
582
|
-
"fillBody": "hAbY3W_fillBody",
|
|
583
612
|
"backButton": "hAbY3W_backButton",
|
|
584
|
-
"
|
|
613
|
+
"tableWrap": "hAbY3W_tableWrap",
|
|
614
|
+
"clusterForm": "hAbY3W_clusterForm",
|
|
615
|
+
"tab": "hAbY3W_tab",
|
|
616
|
+
"input": "hAbY3W_input",
|
|
617
|
+
"tunnelLabel": "hAbY3W_tunnelLabel",
|
|
618
|
+
"iconButton": "hAbY3W_iconButton",
|
|
585
619
|
"actions": "hAbY3W_actions",
|
|
586
|
-
"
|
|
587
|
-
"
|
|
620
|
+
"fillBody": "hAbY3W_fillBody",
|
|
621
|
+
"toolbarSpacer": "hAbY3W_toolbarSpacer",
|
|
588
622
|
"ghostButton": "hAbY3W_ghostButton",
|
|
589
|
-
"
|
|
590
|
-
"
|
|
591
|
-
"
|
|
592
|
-
"
|
|
593
|
-
"
|
|
594
|
-
"progressBar": "hAbY3W_progressBar",
|
|
595
|
-
"dialogTitle": "hAbY3W_dialogTitle",
|
|
596
|
-
"dirRow": "hAbY3W_dirRow",
|
|
623
|
+
"termWrap": "hAbY3W_termWrap",
|
|
624
|
+
"browsePanel": "hAbY3W_browsePanel",
|
|
625
|
+
"browsePath": "hAbY3W_browsePath",
|
|
626
|
+
"modal": "hAbY3W_modal",
|
|
627
|
+
"groupBySelect": "hAbY3W_groupBySelect",
|
|
597
628
|
"groupHeader": "hAbY3W_groupHeader",
|
|
598
|
-
"
|
|
599
|
-
"
|
|
600
|
-
"
|
|
601
|
-
"
|
|
629
|
+
"dshSshSpin": "hAbY3W_dshSshSpin",
|
|
630
|
+
"hint": "hAbY3W_hint",
|
|
631
|
+
"dirName": "hAbY3W_dirName",
|
|
632
|
+
"dirType": "hAbY3W_dirType",
|
|
633
|
+
"progressBar": "hAbY3W_progressBar",
|
|
634
|
+
"formCard": "hAbY3W_formCard",
|
|
635
|
+
"modalBackdrop": "hAbY3W_modalBackdrop",
|
|
636
|
+
"commandInput": "hAbY3W_commandInput",
|
|
637
|
+
"cellDetails": "hAbY3W_cellDetails",
|
|
602
638
|
"progressTrack": "hAbY3W_progressTrack",
|
|
639
|
+
"dialogTitle": "hAbY3W_dialogTitle",
|
|
640
|
+
"controls": "hAbY3W_controls",
|
|
603
641
|
"termContainer": "hAbY3W_termContainer",
|
|
604
|
-
"loading": "hAbY3W_loading",
|
|
605
|
-
"tunnelList": "hAbY3W_tunnelList",
|
|
606
|
-
"cellDetails": "hAbY3W_cellDetails",
|
|
607
642
|
"consoleWrap": "hAbY3W_consoleWrap",
|
|
608
|
-
"
|
|
609
|
-
"formRow": "hAbY3W_formRow",
|
|
610
|
-
"progressMeta": "hAbY3W_progressMeta",
|
|
611
|
-
"controls": "hAbY3W_controls",
|
|
612
|
-
"modalFooter": "hAbY3W_modalFooter",
|
|
613
|
-
"groupName": "hAbY3W_groupName",
|
|
614
|
-
"modalTitle": "hAbY3W_modalTitle",
|
|
643
|
+
"consoleHeader": "hAbY3W_consoleHeader",
|
|
615
644
|
"radioLabel": "hAbY3W_radioLabel",
|
|
616
|
-
"toolbarSpacer": "hAbY3W_toolbarSpacer",
|
|
617
|
-
"browsePanel": "hAbY3W_browsePanel",
|
|
618
|
-
"checkRow": "hAbY3W_checkRow",
|
|
619
645
|
"entryIcon": "hAbY3W_entryIcon",
|
|
620
|
-
"groupSection": "hAbY3W_groupSection",
|
|
621
|
-
"input": "hAbY3W_input",
|
|
622
|
-
"formError": "hAbY3W_formError",
|
|
623
|
-
"empty": "hAbY3W_empty",
|
|
624
|
-
"entry": "hAbY3W_entry",
|
|
625
646
|
"badge": "hAbY3W_badge",
|
|
626
|
-
"
|
|
627
|
-
"
|
|
628
|
-
"dshSshSpin": "hAbY3W_dshSshSpin",
|
|
647
|
+
"mono": "hAbY3W_mono",
|
|
648
|
+
"formError": "hAbY3W_formError",
|
|
629
649
|
"toolbar": "hAbY3W_toolbar",
|
|
630
|
-
"dirType": "hAbY3W_dirType",
|
|
631
|
-
"panelTitle": "hAbY3W_panelTitle",
|
|
632
|
-
"formCard": "hAbY3W_formCard",
|
|
633
|
-
"browseHeader": "hAbY3W_browseHeader",
|
|
634
|
-
"entryLabel": "hAbY3W_entryLabel",
|
|
635
|
-
"groupChevron": "hAbY3W_groupChevron",
|
|
636
|
-
"panelContent": "hAbY3W_panelContent",
|
|
637
|
-
"termWrap": "hAbY3W_termWrap",
|
|
638
|
-
"termPlaceholder": "hAbY3W_termPlaceholder",
|
|
639
|
-
"fieldHint": "hAbY3W_fieldHint",
|
|
640
|
-
"groupBySelect": "hAbY3W_groupBySelect",
|
|
641
650
|
"groupToggle": "hAbY3W_groupToggle",
|
|
642
|
-
"
|
|
643
|
-
"fieldLabel": "hAbY3W_fieldLabel",
|
|
644
|
-
"cellMuted": "hAbY3W_cellMuted",
|
|
651
|
+
"groupChevron": "hAbY3W_groupChevron",
|
|
645
652
|
"tabBar": "hAbY3W_tabBar",
|
|
646
|
-
"
|
|
647
|
-
"
|
|
648
|
-
"search": "hAbY3W_search",
|
|
649
|
-
"inlineTest": "hAbY3W_inlineTest",
|
|
650
|
-
"hint": "hAbY3W_hint",
|
|
651
|
-
"tunnelLabel": "hAbY3W_tunnelLabel",
|
|
652
|
-
"dirSize": "hAbY3W_dirSize",
|
|
653
|
-
"clusterFilters": "hAbY3W_clusterFilters",
|
|
654
|
-
"primaryButton": "hAbY3W_primaryButton"
|
|
653
|
+
"cellMuted": "hAbY3W_cellMuted",
|
|
654
|
+
"tunnelList": "hAbY3W_tunnelList"
|
|
655
655
|
};
|
|
656
656
|
//#endregion
|
|
657
657
|
//#region src/client/panel/ConsoleTab.tsx
|