feat: add send connector preflight probes

This commit is contained in:
zhaoyilun
2026-07-10 13:37:08 +08:00
parent b2ce7b0e36
commit 1f99681348
11 changed files with 1307 additions and 25 deletions

View File

@@ -47,17 +47,23 @@ namespace ISphereWinHelper
Dictionary<string, object> filesystem = LiveProbeInventory.CollectFilesystem(runtime);
WriteJson(Path.Combine(outputDir, "filesystem_inventory.json"), filesystem);
Dictionary<string, object> sendEntrypoints = SendConnectorPreflight.ProbeSendEntrypoints(new Dictionary<string, object>());
WriteJson(Path.Combine(outputDir, "send_entrypoints_preflight.json"), sendEntrypoints);
string uiaDir = Path.Combine(outputDir, "uia");
Directory.CreateDirectory(uiaDir);
List<Dictionary<string, object>> uiaSummary = DumpTargetWindowUia(runtime, windows, uiaDir);
WriteJson(Path.Combine(outputDir, "uia_summary.json"), uiaSummary);
List<Dictionary<string, object>> sendUiaPreflight = ProbeTargetWindowSendControls(runtime, windows);
WriteJson(Path.Combine(outputDir, "send_uia_controls_preflight.json"), sendUiaPreflight);
Dictionary<string, object> feasibility = LiveProbeInventory.SummarizeFeasibility(runtime, filesystem, network);
WriteJson(Path.Combine(outputDir, "feasibility_summary.json"), feasibility);
WriteText(Path.Combine(outputDir, "NEXT_STEP.txt"),
"把整个目录压缩后发回即可。\r\n" +
"重点文件probe_client_runtime.json、process_details.json、network_inventory.json、filesystem_inventory.json、services_registry_shortcuts.json、scan_windows.json、uia_summary.json、uia/*.json、feasibility_summary.json\r\n");
"重点文件probe_client_runtime.json、send_entrypoints_preflight.json、send_uia_controls_preflight.json、process_details.json、network_inventory.json、filesystem_inventory.json、services_registry_shortcuts.json、scan_windows.json、uia_summary.json、uia/*.json、feasibility_summary.json\r\n");
Console.WriteLine("OK");
Console.WriteLine("已生成采集目录:");
@@ -77,6 +83,50 @@ namespace ISphereWinHelper
}
}
private static List<Dictionary<string, object>> ProbeTargetWindowSendControls(Dictionary<string, object> runtime, Dictionary<string, object> windows)
{
var targetPids = TargetPids(runtime);
var summary = new List<Dictionary<string, object>>();
object rawWindows;
if (!windows.TryGetValue("windows", out rawWindows))
{
return summary;
}
var windowList = rawWindows as List<Dictionary<string, object>>;
if (windowList == null)
{
return summary;
}
foreach (Dictionary<string, object> window in windowList)
{
int pid = GetInt(window, "pid");
if (!targetPids.Contains(pid))
{
continue;
}
string hwnd = GetString(window, "hwnd");
string title = GetString(window, "title");
Dictionary<string, object> probe = SendConnectorPreflight.ProbeSendUiaControls("live-probe-send-uia", "probe_send_uia_controls", new Dictionary<string, object>
{
{ "hwnd", hwnd },
{ "max_depth", 8 },
{ "max_children", 180 }
});
summary.Add(new Dictionary<string, object>
{
{ "pid", pid },
{ "hwnd", hwnd },
{ "title_present", !string.IsNullOrEmpty(title) },
{ "ok", GetBool(probe, "ok") },
{ "probe", probe }
});
}
return summary;
}
private static List<Dictionary<string, object>> DumpTargetWindowUia(Dictionary<string, object> runtime, Dictionary<string, object> windows, string uiaDir)
{
var targetPids = TargetPids(runtime);
@@ -154,7 +204,7 @@ namespace ISphereWinHelper
return new Dictionary<string, object>
{
{ "recorder_name", "ISphereLiveProbeRecorder" },
{ "recorder_version", "0.2.0" },
{ "recorder_version", "0.3.0" },
{ "helper_protocol", HelperProtocol.Protocol },
{ "run_id", runId },
{ "timestamp_local", DateTime.Now.ToString("o") },
@@ -183,7 +233,7 @@ namespace ISphereWinHelper
"5. 双击 ISphereLiveProbeRecorder.exe。\r\n" +
"6. 程序会在 probe-output 下生成 isphere-live-probe-时间戳 目录。\r\n" +
"7. 把整个目录压缩后发回。\r\n\r\n" +
"采集内容:运行进程、模块、命令行摘要、窗口、目标窗口 UIA 控件树、安装目录关键文件、配置/日志/数据库候选、注册表卸载项、快捷方式、服务、本地 TCP 连接、命名管道。\r\n" +
"采集内容:运行进程、模块、命令行摘要、窗口、目标窗口 UIA 控件树、发送入口元数据预检、发送控件/离线状态预检、安装目录关键文件、配置/日志/数据库候选、注册表卸载项、快捷方式、服务、本地 TCP 连接、命名管道。\r\n" +
"不会执行发送消息、发送文件、上传文件、点击、输入、注入、hook、修改客户端数据。\r\n";
}