Add: Agent v2.1.2, WebSocket Live Shell, WebRTC Remote Desktop (Beta), Announcement Push
- Agent v2.1.2: WebSocket ShellService, ACK nach WS-Ankündigungen, shown_announcements Fix - Backend: shellServer.js mit WebSocket-Server (Shell + Announcement Push + RTC Signaling) - Backend: patch.controller.js Fix (command_id=0 Falsy-Bug beim Auto-Update) - Frontend: Remote Desktop Tab (WebRTC Beta) in AgentDetailPage für super_admin/admin - Frontend: PatchManagementPage auf v2.1.2 aktualisiert - WPF Notification: AllowsTransparency=False + kein DropShadowEffect (Dispatcher-Crash Fix) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -27,6 +27,7 @@ public class CommandExecutor(ApiService api, string hostname, string dataDir, st
|
||||
"reboot" => await Reboot(cmd.Id),
|
||||
"upgrade_win11" => await UpgradeWin11(),
|
||||
"update_agent" => await UpdateAgent(),
|
||||
"shell_exec" => await ShellExec(cmd.Params ?? ""),
|
||||
_ => $"Unbekannter Command: {cmd.Command}"
|
||||
};
|
||||
}
|
||||
@@ -95,6 +96,33 @@ public class CommandExecutor(ApiService api, string hostname, string dataDir, st
|
||||
return Task.FromResult("running");
|
||||
}
|
||||
|
||||
private Task<string> ShellExec(string command)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(command)) return Task.FromResult("Kein Befehl angegeben");
|
||||
try
|
||||
{
|
||||
var psi = new ProcessStartInfo("powershell.exe",
|
||||
$"-NonInteractive -NoProfile -ExecutionPolicy Bypass -Command \"{command.Replace("\"", "\\\"")}\"")
|
||||
{
|
||||
CreateNoWindow = true,
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError = true,
|
||||
UseShellExecute = false
|
||||
};
|
||||
var p = Process.Start(psi)!;
|
||||
var stdout = p.StandardOutput.ReadToEnd();
|
||||
var stderr = p.StandardError.ReadToEnd();
|
||||
p.WaitForExit(30000);
|
||||
var output = stdout;
|
||||
if (!string.IsNullOrEmpty(stderr)) output += "\n[STDERR] " + stderr;
|
||||
return Task.FromResult(string.IsNullOrEmpty(output) ? "(kein Output)" : output.Trim());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Task.FromResult($"Fehler: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<string> UpdateAgent()
|
||||
{
|
||||
var bytes = await _api.DownloadSetupAsync();
|
||||
|
||||
Reference in New Issue
Block a user