Feature: Add remote lock screen for Android hosts

Implement the Ctrl+Alt+Del path on Android as a system lock screen.
Android has no secure attention sequence, so COMMAND_SCREEN_CTRL_ALT_DEL
is mapped in the client to GLOBAL_ACTION_LOCK_SCREEN and the server
exposes it as the new MCP tool remote_lock_screen.

The Android client resolves ControlService.lockScreen()/canLockScreen()
in nativeInit and dispatches the command from the screen sub-connection
through the usual attach/detach JNI path. The lock action is posted to
the accessibility service handler because performGlobalAction must not
run on the receiver thread.

Login advertises the new CLIENT_CAP_LOCK_SCREEN bit only when the
accessibility service is bound and the API level is 28+, so the server
can reject old APKs and Windows/Linux hosts up front instead of
reporting a lock that never happened. There is no receipt: a successful
call only means the command was delivered, and the tool description
tells the caller to confirm with get_screenshot.

Server side adds the schema and handler next to remote_clipboard, audits
the call, and gates it on client type plus the capability bit. Since it
is the only APK-only tool, check_platform_table.py gains a documented
exemption from the Windows baseline invariant, and make_tools_json.py
learns an APK-only platform set. tools.json is regenerated from the live
server and the plan document now counts 62 tools.

Co-Authored-By: deepseek-flash
This commit is contained in:
yuanyuanxianganddeepseek-flash committed 2026-11-11 20:59:10 +01:00
1 parent 0a0b709e8a
commit fd1b085279
11 files changed
+264 -14

No files matched your search

+9 -9
View File
@@ -49,28 +49,28 @@
## 1. 现状盘点
### 1.1 工具族(60 个)
### 1.1 工具族(62 个)
登记表在 `server/2015Remote/McpInternal.cpp:375` 的 `kToolHints[]`(60 项,与下表的工具逐条对应)。
登记表在 `server/2015Remote/McpInternal.cpp:479` 的 `kToolHints[]`(62 项,与下表的工具逐条对应)。
下表是 P11 之后的口径;写作时是 54 个、8 个族,P10-B 加 3 个(文件系统写)、P10-C 加 1 个
(`remote_block_input`)、P11 加 2 个(`mcp_list_sessions` / `mcp_cancel_session`)。
| 族 | 数 | 工具 | 门控条件 |
|---|---|---|---|
| 服务端本机只读 | 9 | `list_online_hosts` `search_hosts` `list_all_hosts` `get_host_detail` `get_activity_history` `get_audit_log` `get_server_status` `mcp_list_sessions` `mcp_cancel_session` | 全部始终在列表里、只读模式下照常可用;`mcp_list_sessions` / `mcp_cancel_session` 还**不受任何开关或只读限制**(卡住请求的唯一出路,见附录 D.5) |
| 主机只读 | 21 | `list_processes` `list_windows` `list_files` `list_services` `get_client_log` `get_keylog` `get_screenshot` `list_registry` `download_file` `search_file` `list_network_connections` + `host_list_*`(10 个标签页) | 除下列四类外始终在列表里:`get_keylog` 需 `McpKeylog=1`(其 `clear` / `set_offline` 还需 `McpReadonly=0`)、`download_file` 需 `McpFileTransfer=1`、`list_network_connections` 与 `host_list_*` 需 `McpMachine=1` |
| 主机只读 | 22 | `list_processes` `list_windows` `list_files` `list_services` `get_client_log` `get_keylog` `get_screenshot` `list_registry` `download_file` `search_file` `list_network_connections` + `host_list_*`(10 个标签页)+ `host_get_hosts_file` | 除下列四类外始终在列表里:`get_keylog` 需 `McpKeylog=1`(其 `clear` / `set_offline` 还需 `McpReadonly=0`)、`download_file` 需 `McpFileTransfer=1`、`list_network_connections` 与 `host_list_*` 需 `McpMachine=1` |
| 终端 | 4 | `terminal_open` `terminal_exec` `terminal_close` `exec_command` | `terminal_*`:`McpTerminal=1` **且** `McpReadonly=0`;`exec_command` 只要求 `McpReadonly=0` |
| 远程控制 | 6 | `remote_open` `remote_close` `remote_mouse` `remote_keyboard` `remote_clipboard` `remote_block_input` | `McpRemoteControl=1` **且** `McpReadonly=0` |
| 远程控制 | 7 | `remote_open` `remote_close` `remote_mouse` `remote_keyboard` `remote_clipboard` `remote_lock_screen` `remote_block_input` | `McpRemoteControl=1` **且** `McpReadonly=0` |
| 文件传输 | 2 | `upload_file` `copy_files_c2c` | `McpFileTransfer=1` **且** `McpReadonly=0`(`download_file` 只要求此开关) |
| 文件系统写 | 3 | `delete_path` `move_path` `create_folder` | `McpFileWrite=1` **且** `McpReadonly=0` |
| 设备管理 | 4 | `kill_process` `operate_window` `control_service` `power_action` | `McpManage=1` **且** `McpReadonly=0` |
| 主机/连接管理 | 7 | `kill_network_connection` `host_control_process` `host_control_window` `host_control_service` `host_control_task` `host_set_remark` `host_set_watch_level` | 前 5 个:`McpMachine=1` + `McpMachineDangerous=1` + `McpReadonly=0`;`host_set_remark` / `host_set_watch_level` 始终在列表里,调用要求 `McpReadonly=0` |
| 远程交谈 | 4 | `chat_open` `chat_send` `chat_wait` `chat_close` | `McpChat=1`(与 `McpReadonly` 无关) |
合计 9+21+4+6+2+3+4+7+4 = 60。默认配置(`McpReadonly=1`、其余开关 0)下 `tools/list` **19 个**
合计 9+22+4+7+2+3+4+7+4 = 62。默认配置(`McpReadonly=1`、其余开关 0)下 `tools/list` **19 个**
= 服务端本机只读 9 + 主机只读 8(去掉 `get_keylog` / `download_file` / `list_network_connections` /
`host_list_*`)+ 主机/连接管理 2(`host_set_remark` / `host_set_watch_level`);其余各族依赖开关,全部不可见。
开关全开且关闭只读时为 **60 个**。
开关全开且关闭只读时为 **62 个**。
**已有的工程范式**(新工具直接复用,不必重新设计):
@@ -122,7 +122,7 @@
| 屏幕截图 | `COMMAND_SCREEN_PREVIEW_REQ` | ✅ `get_screenshot` | — |
| 鼠标 / 键盘 / 剪贴板写 | `COMMAND_SCREEN_CONTROL` + `MSG64` | ✅ `remote_*` | — |
| **锁定对端键鼠** | `COMMAND_SCREEN_BLOCK_INPUT`(2 字节) | ❌ **缺** | **零客户端改动**(无回包) |
| 黑屏 / Ctrl+Alt+Del | `COMMAND_SCREEN_BLANK` / `COMMAND_SCREEN_CTRL_ALT_DEL` | ❌ | **客户端未实现**,需客户端改动 |
| 黑屏 / Ctrl+Alt+Del | `COMMAND_SCREEN_BLANK` / `COMMAND_SCREEN_CTRL_ALT_DEL` | Ctrl+Alt+Del → ✅ `remote_lock_screen`(仅 Android,映射为锁屏);黑屏 ❌ | 黑屏**客户端未实现**,需客户端改动 |
| 窗口级 / 区域捕获 | `COMMAND_SCREEN_WINDOW` / `COMMAND_SCREEN_ROI` | ❌ | 流式接口,需评估(见 §4.2) |
| 注册表读 | `COMMAND_REGEDIT` + `COMMAND_REG_FIND` | ✅ `list_registry`(子键 + 值) | — |
| **注册表写** | 无命令 | ❌ | **需客户端改动** |
@@ -547,7 +547,7 @@ P10-C(`3d388f8`)加工具时索性去掉数字——避免每加一个工具
| 写 hosts 文件 | `CREATE_ALWAYS` 整文件覆盖 + 无回包,误操作导致目标机 DNS 全断 |
| 卸载软件 | `WinExec` 卸载串,无回包、可能弹 UAC 阻塞,无法确认结果 |
| 清除事件日志 / 隐藏开网页 / 卸载后门 | 当前 Windows 客户端**未实现**这些命令(死命令) |
| `Ctrl+Alt+Del` / 黑屏 | 客户端未实现,需客户端改动 |
| `Ctrl+Alt+Del` / 黑屏 | 黑屏客户端未实现;`Ctrl+Alt+Del` 只在 Android 上映射为锁屏(`remote_lock_screen`),Windows 侧要发 SAR 需要 SYSTEM/UIAccess,本轮不做 |
| 10 个 `host_list_*` 合并为 1 个 | 体积收益 20%,discoverability 损失更大(见 §5.11) |
---
@@ -576,7 +576,7 @@ COMMAND_WEBCAM / COMMAND_AUDIO→ 流式音视频 client/K
> 已排除 `COMMAND_PROCESS_FREEZING` / `COMMAND_PROCESS_THAW`——它们**已被 `host_control_process` 使用**
> (`McpMachine.cpp:2107`),不属于缺口。
**定义了但 Windows 客户端未实现**(不可用):`COMMAND_CLEAN_EVENT`、`COMMAND_OPEN_URL_HIDE`、`COMMAND_OPEN_URL_SHOW`、`COMMAND_REMOVE`、`COMMAND_SCREEN_CTRL_ALT_DEL`、`COMMAND_SCREEN_BLANK`。
**定义了但 Windows 客户端未实现**(不可用):`COMMAND_CLEAN_EVENT`、`COMMAND_OPEN_URL_HIDE`、`COMMAND_OPEN_URL_SHOW`、`COMMAND_REMOVE`、`COMMAND_SCREEN_CTRL_ALT_DEL`(Android 已实现,映射为锁屏)、`COMMAND_SCREEN_BLANK`。
---