diff --git a/TGBeta.ps1 b/TGBeta.ps1 index ab0cdce..f81d6b3 100644 --- a/TGBeta.ps1 +++ b/TGBeta.ps1 @@ -4,11 +4,13 @@ ### need RGB color codes form john ### add the .net silent install tweaks to toolkit ### for the reg tweak need to do/undo function maybe it should have it own check box list +### line 1502 need to proper command to uninstall svsmsp module + # changes ## tag line color ## added offboard check boxes for dattormm, dattodeb, rocketcyber, cyberQP, SVSWatchtower, SVSHelpdesk and Splashtop - +## #region Write-Log @@ -845,9 +847,31 @@ function GetHtmlContent { }); function triggerOffboard() { - appendLog("testeteteteteteet") + const checkedCheckboxes = document + .querySelectorAll('#offboardTab input[type="checkbox"]:checked'); + + const selectedTasks = Array.from(checkedCheckboxes).map(checkbox => checkbox.name); + + if (selectedTasks.length === 0) { + appendLog("No offboarding tasks selected.", "yellow"); + return; + } + + selectedTasks.forEach(task => { + fetch(`/offboard/${task}`, { method: 'GET' }) + .then(response => { + if (!response.ok) { + throw new Error(`Failed to run task: ${task}`); + } + appendLog(`Successfully ran offboarding task: ${task}`, "green"); + }) + .catch(error => { + appendLog(`Error running offboarding task ${task}: ${error.message}`, "red"); + }); + }); } + function toggleTweaksCheckboxes(selectAllCheckbox) { // Get all checkboxes inside the tweaksTab container const checkboxes = document @@ -1474,6 +1498,57 @@ try { $response.OutputStream.Close() } + switch ($request.Url.AbsolutePath) { + "/offboard/uninstallSVSMSPModule" { + try { + Uninstall-SVSMSPModule + $responseString = "Uninstalled SVSMSP Module successfully." + $response.StatusCode = 200 + } catch { + $responseString = "Error uninstalling SVSMSP Module: $_" + $response.StatusCode = 500 + } + } + + "/offboard/uninstallThreatLocker" { + try { + Uninstall-ThreatLocker + $responseString = "Uninstalled ThreatLocker successfully." + $response.StatusCode = 200 + } catch { + $responseString = "Error uninstalling ThreatLocker: $_" + $response.StatusCode = 500 + } + } + + "/offboard/uninstallCyberQP" { + try { + Uninstall-CyberQP + $responseString = "Uninstalled CyberQP successfully." + $response.StatusCode = 200 + } catch { + $responseString = "Error uninstalling CyberQP: $_" + $response.StatusCode = 500 + } + } + + # Add routes for other tasks here... + + default { + $response.StatusCode = 404 + $responseString = "Task not found." + } + + # Send the response + $buffer = [System.Text.Encoding]::UTF8.GetBytes($responseString) + $response.ContentType = "text/plain" + $response.ContentLength64 = $buffer.Length + $response.OutputStream.Write($buffer, 0, $buffer.Length) + $response.OutputStream.Close() + } + + + "/runTweaks" { if ($request.HttpMethod -eq "POST") { try {