Feature: add build_client MCP tool and improve build dialog linkage
Add a service-local MCP tool, build_client, that patches a client template with this master's connect settings and writes the binary on the server. It covers ghost/TestRun/ServerDll/TinyRun plus Linux, macOS and Android, reusing the same byte path as CBuildDlg::OnBnClickedOk (CONNECT_ADDRESS overwrite, build-date check, embedded TLS anchor before UPX/padding). ShellCode AES and payload impersonation stay dialog-only. The tool is gated by a new McpBuild switch (default 0) and McpReadonly=0. It refuses to overwrite an existing file unless overwrite=true, protects the server binaries/settings.ini/upx.exe, validates names strictly and uses a unique UPX temp file so it cannot race the dialog. Results report the path, size, target, TLS-anchor status and follow-up tips. In the build dialog, Linux/macOS/Android targets now also grey out the install-location combo/label and run mode, save and restore the Windows compress choice, hide payload/download rows, grey the random-name and run-as-admin menu items, and fix the TLS-anchor label for posix targets. OnBnClickedOk is untouched; generated output is unchanged for every target. New UI strings were added to the en_US, zh_TW and de_DE language packs. McpBuild is off by default and changes require a server restart. Verified on a Debug x64 instance: MCP generation for Linux is patched correctly, Android and ghost anchor/error paths behave, and dialog-driven Linux/TestRun/SC_AES generation still succeeds. mcp/tools.json regenerated (55 tools); check_platform_table.py passes. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
1401ff0a4c
commit
7172ab376d
20 files changed
+1619
-36
No files matched your search
@@ -181,6 +181,9 @@ BOOL CMcpSettingsDlg::OnInitDialog()
|
||||
m_btnKeylog.Create(_TR("启用键盘记录(AI 采集击键)"),
|
||||
WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
|
||||
r0, this, IDC_MCP_KEYLOG);
|
||||
m_btnBuild.Create(_TR("启用客户端生成(AI 生成客户端文件,要求只读关)"),
|
||||
WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
|
||||
r0, this, IDC_MCP_BUILD);
|
||||
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,
|
||||
@@ -217,6 +220,7 @@ BOOL CMcpSettingsDlg::OnInitDialog()
|
||||
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_btnBuild.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));
|
||||
@@ -239,6 +243,7 @@ BOOL CMcpSettingsDlg::OnInitDialog()
|
||||
int machineDangerous = THIS_CFG.GetInt("settings", "McpMachineDangerous", 0);
|
||||
int chat = THIS_CFG.GetInt("settings", "McpChat", 0);
|
||||
int keylog = THIS_CFG.GetInt("settings", "McpKeylog", 0);
|
||||
int build = THIS_CFG.GetInt("settings", "McpBuild", 0);
|
||||
std::string whitelist = THIS_CFG.GetStr("settings", "McpCmdWhitelist", "");
|
||||
int https = THIS_CFG.GetInt("settings", "McpHttps", 0);
|
||||
std::string certPath = THIS_CFG.GetStr("settings", "McpCertPath", "");
|
||||
@@ -265,6 +270,7 @@ BOOL CMcpSettingsDlg::OnInitDialog()
|
||||
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_btnBuild.SetCheck(build ? BST_CHECKED : BST_UNCHECKED);
|
||||
// 白名单存储为逗号分隔,展示为每行一条。
|
||||
m_editWhitelist.SetWindowText(CString(WhitelistForDisplay(whitelist).c_str()));
|
||||
|
||||
@@ -339,6 +345,7 @@ void CMcpSettingsDlg::OnOK()
|
||||
bool machineDangerous = (m_btnMachineDangerous.GetCheck() == BST_CHECKED);
|
||||
bool chat = (m_btnChat.GetCheck() == BST_CHECKED);
|
||||
bool keylog = (m_btnKeylog.GetCheck() == BST_CHECKED);
|
||||
bool build = (m_btnBuild.GetCheck() == BST_CHECKED);
|
||||
bool https = (m_btnHttps.GetCheck() == BST_CHECKED);
|
||||
|
||||
// 危险子集依附于主机管理总开关:没开主机管理就没有工具可放开,直接清除并提示。
|
||||
@@ -401,6 +408,7 @@ void CMcpSettingsDlg::OnOK()
|
||||
THIS_CFG.SetInt("settings", "McpMachineDangerous", machineDangerous ? 1 : 0);
|
||||
THIS_CFG.SetInt("settings", "McpChat", chat ? 1 : 0);
|
||||
THIS_CFG.SetInt("settings", "McpKeylog", keylog ? 1 : 0);
|
||||
THIS_CFG.SetInt("settings", "McpBuild", build ? 1 : 0);
|
||||
std::string whitelist = CT2A(sWhitelist);
|
||||
whitelist = NormalizeWhitelist(whitelist);
|
||||
THIS_CFG.SetStr("settings", "McpCmdWhitelist", whitelist);
|
||||
@@ -416,6 +424,7 @@ void CMcpSettingsDlg::OnOK()
|
||||
_TR("主机管理的写操作需只读模式关闭;冻结/解冻进程、停止/重启服务还需启用危险主机操作。") + _T("\r\n") +
|
||||
_TR("远程交谈开关的改动需重启程序生效。") + _T("\r\n") +
|
||||
_TR("键盘记录开关的改动需重启程序生效。") + _T("\r\n") +
|
||||
_TR("客户端生成开关的改动需重启程序生效;它还会写出带主控凭据的客户端文件,请谨慎开启。") + _T("\r\n") +
|
||||
_TR("HTTPS 开关与证书路径的改动需重启程序生效。") + _T("\r\n") +
|
||||
_TR("证书须为 PEM 格式,私钥须为 PKCS#8 格式。"),
|
||||
_TR("提示"), MB_ICONINFORMATION);
|
||||
@@ -494,6 +503,9 @@ void CMcpSettingsDlg::LayoutControls(int cx, int cy)
|
||||
m_btnKeylog.MoveWindow(margin, y, cx - margin * 2, 22);
|
||||
y += 30;
|
||||
|
||||
m_btnBuild.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);
|
||||
|
||||
Reference in new issue
Block a user