inital commit

This commit is contained in:
KingKDot
2026-03-05 00:04:26 -06:00
commit f8515a2883
269 changed files with 47081 additions and 0 deletions
@@ -0,0 +1,48 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Sample Plugin</title>
<link rel="stylesheet" href="/plugins/sample/assets/sample.css" />
</head>
<body>
<main class="container">
<header class="header">
<h1>Sample Plugin</h1>
<p class="sub">Go WASM + UI plugin</p>
</header>
<section class="card">
<div class="row">
<label class="label">Client ID</label>
<input id="client-id" class="input" placeholder="clientId" />
</div>
<div class="row">
<label class="label">Message</label>
<input id="message" class="input" placeholder="hello from UI" />
</div>
<div class="row">
<label class="label">Message Box</label>
<input id="msgbox" class="input" placeholder="Windows only" />
</div>
<div class="actions">
<button id="send-btn" class="btn">Send event to client</button>
<button id="ping-btn" class="btn">Ping Test x100</button>
<button id="msgbox-btn" class="btn">Show Message Box</button>
<button id="run-cmd-btn" class="btn">Run Command (example)</button>
</div>
</section>
<section class="card">
<h2>Log</h2>
<pre id="log" class="log"></pre>
</section>
</main>
<script src="/plugins/sample/assets/sample.js"></script>
</body>
</html>
@@ -0,0 +1,103 @@
const params = new URLSearchParams(window.location.search);
const clientIdInput = document.getElementById("client-id");
const messageInput = document.getElementById("message");
const msgBoxInput = document.getElementById("msgbox");
const logEl = document.getElementById("log");
const sendBtn = document.getElementById("send-btn");
const pingBtn = document.getElementById("ping-btn");
const msgBoxBtn = document.getElementById("msgbox-btn");
const runCmdBtn = document.getElementById("run-cmd-btn");
const pluginId = "sample";
const clientIdFromUrl = params.get("clientId") || "";
clientIdInput.value = clientIdFromUrl;
messageInput.value = "hello from sample UI";
msgBoxInput.value = "Hello from Overlord";
function log(line) {
const ts = new Date().toISOString();
logEl.textContent = `${ts} ${line}\n` + logEl.textContent;
}
async function sendEvent(event, payload) {
const clientId = clientIdInput.value.trim();
if (!clientId) {
log("Missing clientId");
return;
}
const res = await fetch(`/api/clients/${encodeURIComponent(clientId)}/plugins/${pluginId}/event`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ event, payload }),
});
if (!res.ok) {
const text = await res.text();
log(`Send failed: ${res.status} ${text}`);
return;
}
log(`Sent event: ${event}`);
}
sendBtn.addEventListener("click", () => {
const message = messageInput.value.trim();
sendEvent("ui_message", { message });
});
pingBtn?.addEventListener("click", async () => {
const clientId = clientIdInput.value.trim();
if (!clientId) {
log("Missing clientId");
return;
}
const res = await fetch(`/api/clients/${encodeURIComponent(clientId)}/command`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ action: "ping_bulk", count: 100 }),
});
if (!res.ok) {
const msg = await res.text();
log(`Ping test failed: ${msg}`);
return;
}
log("Ping test x100 dispatched (single request)");
});
msgBoxBtn?.addEventListener("click", async () => {
const clientId = clientIdInput.value.trim();
if (!clientId) {
log("Missing clientId");
return;
}
const text = msgBoxInput.value.trim() || "Hello from Overlord";
const script = `$os = $env:OS; if ($os -ne 'Windows_NT') { exit } ; Add-Type -AssemblyName PresentationFramework; [System.Windows.MessageBox]::Show('${text.replace(/'/g, "''")}') | Out-Null`;
const res = await fetch(`/api/clients/${encodeURIComponent(clientId)}/command`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ action: "script_exec", script, scriptType: "powershell" }),
});
if (!res.ok) {
const msg = await res.text();
log(`Message box failed: ${msg}`);
return;
}
log("Message box command sent (Windows only)");
});
runCmdBtn?.addEventListener("click", async () => {
const clientId = clientIdInput.value.trim();
if (!clientId) {
log("Missing clientId");
return;
}
const res = await fetch(`/api/clients/${encodeURIComponent(clientId)}/command`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ action: "screenshot" }),
});
if (!res.ok) {
const msg = await res.text();
log(`Command failed: ${msg}`);
return;
}
log("Command sent: screenshot");
});