Update SVSTaskGate.ps1

This commit is contained in:
2025-01-27 21:39:22 -05:00
parent 652a9271e4
commit 55365284d8

View File

@@ -1,11 +1,15 @@
### To Modify of January 5 2025 ### To Modify as of January 27 2025
### let's start thinking about the write-log -TaskCategory "On-boarding" or "Off-boarding" ### let's start thinking about the write-log -TaskCategory "On-boarding" or "Off-boarding"
### need RGB color codes form john ### need RGB color codes form john, once we picked the RGBA colors
### add the .net silent install tweaks to toolkit ### 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 ### for the reg tweak need to do/undo function maybe it should have it own check box list
### new tab for client apps? ### added offboard check boxes for dattormm, dattodeb, rocketcyber, cyberQP, SVSHelpdesk and Splashtop
### for the offboarding button, we need to fix the uninstall-svsmsp module
### need to fix path in the uninstall-DattoEDR -
####### ❌ [Error] [GeneralTask] Uninstallation command 'C:\Program Files\Infocyte\Agent\agent.exe' not found. (Event ID: 3000) - bad path
#region Write-Log #region Write-Log
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@@ -175,8 +179,8 @@ function Install-SVSMSP {
"Install-RocketCyber", "Install-RocketCyber",
"Install-Splashtop", "Install-Splashtop",
"Install-ThreatLocker", "Install-ThreatLocker",
"Install-SVSHelpdesk", "Install-SVSHelpdesk"
"Install-SVSWatchtower"
), ),
# Log file path # Log file path
@@ -367,7 +371,7 @@ function Get-N8nWebhookData {
# Define the HTML Content with an Off-Boarding Tab # Define the HTML Content with an Off-Boarding Tab
function GetHtmlContent { function GetHtmlContent {
@" @"
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
@@ -376,120 +380,199 @@ function GetHtmlContent {
<title>SVS TaskGate</title> <title>SVS TaskGate</title>
<link rel="icon" href="https://git.svstools.com/syelle/Logo/raw/branch/main/SVS_Favicon.ico" type="image/x-icon"> <link rel="icon" href="https://git.svstools.com/syelle/Logo/raw/branch/main/SVS_Favicon.ico" type="image/x-icon">
<style> <style>
body { :root {
font-family: Arial, sans-serif; /* Cool Palette */
margin: 0; --background-color: rgba(18, 18, 18, 1);
padding: 0; --border-color: rgba(255, 127, 0, 0.25);
background-color: #1e1e1e;
color: #ffffff; /* Neutral Colors */
} --white-color: rgba(255, 255, 255);
.logo-container { --gray-color: rgba(102, 102, 102);
text-align: left; --dark-gray-color: rgba(51, 51, 51);
padding: 20px; --light-gray-color: rgba(187, 187, 187);
background-color: #1e1e1e; /* Matches the background color */
} /* Sidebar Button Colors */
.logo-container img { --btn-sidebar-light-gray: rgba(68, 68, 68); /* Sidebar button background */
max-width: 300px; /* Adjust size as needed */ --btn-sidebar-blue: rgba(30, 144, 255, 1);
height: auto; --btn-hover: rgba(0, 86, 179, 1); /* Hover state (dark blue) for buttons */
} --btn-hover-scale: 1.05; /* Scale effect for button hover */
/* Button Colors */
--btn-success: rgba(40, 167, 69); /* Green button background */
--btn-success-disabled: rgba(108, 117, 125); /* Disabled success button color */
--btn-danger: rgba(220, 53, 69); /* Red button background */
}
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: var(--background-color);
color: var(--white-color);
height: 100%; /* Ensure the body fills the viewport */
overflow: hidden; /* Prevent scrollbars */
}
.logo-container {
text-align: left;
padding: 20px;
background-color: var(--background-color); /* Matches the background color */
}
.logo-container img {
max-width: 300px; /* Adjust size as needed */
height: auto;
}
.subtitle {
font-size: 1.2rem;
color: var(--gray-color);
margin-top: 0.5em;
}
.container {
display: flex;
height: 100vh; /* Ensure the container is limited to the viewport height */
overflow: hidden; /* Prevent the container from exceeding the viewport height */
}
.sidebar {
width: 200px;
height: 100%; /* Ensure it doesn't exceed the container height */
background-color: var(--background-color);
padding: 10px;
}
.sidebar button {
display: block;
width: 100%;
margin-bottom: 10px;
padding: 10px;
color: var(--white-color);
background-color: var(--btn-sidebar-light-gray);
border: none;
border-radius: 5px;
cursor: pointer;
text-align: left;
transition: background-color 0.3s ease, transform 0.2s ease;
}
.sidebar button.active {
background-color: var(--btn-sidebar-blue);
}
.sidebar button:hover {
background-color: var(--btn-hover);
transform: scale(var(--btn-hover-scale));
}
.content {
flex: 1; /* Allow the content to fill available space */
padding: 20px;
overflow-y: auto; /* Add scrolling only within the content if necessary */
max-height: calc(100vh - 50px); /* Adjust the height dynamically to fit within the viewport */
}
.tab-content {
display: none;
}
.tab-content.active {
display: block;
}
.checkbox-group label {
margin: 0;
padding: 0;
line-height: 1.5;
display: flex;
align-items: center;
}
.password-input,
.dropdown {
width: 30%;
padding: 10px;
margin-bottom: 20px;
border-radius: 5px;
border: 1px solid var(--border-color);
background-color: var(--background-color);
color: var(--white-color);
}
#n8nPasswordContainer {
display: none;
margin-top: 20px; /* Adjust the value to set the desired spacing */
}
.button-group {
margin-top: 20px;
text-align: right;
}
.button-group button {
padding: 10px 20px;
margin-left: 10px;
border: none;
border-radius: 5px;
cursor: pointer;
}
.install-button {
background-color: var(--btn-success);
color: var(--white-color);
}
.install-button:disabled {
background-color: var(--btn-success-disabled);
cursor: not-allowed;
}
.exit-button {
background-color: var(--btn-danger);
color: var(--white-color);
}
.columns-container {
display: flex;
justify-content: center;
gap: 20px;
align-items: flex-start;
padding: 0;
}
.column {
width: 48%;
border: 2px solid var(--border-color);
border-radius: 8px;
padding: 10px;
background-color: var(--background-color);
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.3);
margin: 0;
}
.log {
width: 80%;
margin-top: 20px;
padding: 10px;
background-color: var(--dark-gray-color);
color: var(--light-gray-color);
border-radius: 5px;
max-height: 500px;
overflow-y: auto;
}
@media (max-width: 768px) {
.container { .container {
display: flex; flex-direction: column;
height: 100vh;
} }
.sidebar { .sidebar {
width: 200px;
background-color: #1e1e1e;
padding: 10px;
}
.sidebar button {
display: block;
width: 100%; width: 100%;
margin-bottom: 10px;
padding: 10px;
color: white;
background-color: #444;
border: none;
border-radius: 5px;
cursor: pointer;
text-align: left;
transition: background-color 0.3s ease, transform 0.2s ease;
}
.sidebar button.active {
background-color: #007bff;
}
.sidebar button:hover {
background-color: #0056b3;
transform: scale(1.05);
}
.content {
flex: 1;
padding: 20px;
overflow-y: auto;
}
.tab-content {
display: none;
}
.tab-content.active {
display: block;
}
.checkbox-group label {
margin: 0;
padding: 0;
line-height: 1.5;
display: flex;
align-items: center;
}
.password-input,
.dropdown {
width: 30%;
padding: 10px;
margin-bottom: 20px;
border-radius: 5px;
border: 1px solid #555;
background-color: #2e2e2e;
color: white;
}
.button-group {
margin-top: 20px;
text-align: right;
}
.button-group button {
padding: 10px 20px;
margin-left: 10px;
border: none;
border-radius: 5px;
cursor: pointer;
}
.install-button {
background-color: #28a745;
color: white;
}
.install-button:disabled {
background-color: #6c757d;
cursor: not-allowed;
}
.exit-button {
background-color: #dc3545;
color: white;
}
.log {
width: 80%;
margin-top: 20px;
padding: 10px;
background-color: #333;
color: #bbb;
border-radius: 5px;
max-height: 500px;
overflow-y: auto;
}
@media (max-width: 768px) {
.container {
flex-direction: column;
}
.sidebar {
width: 100%;
}
} }
}
</style> </style>
</head> </head>
<body> <body>
@@ -506,68 +589,82 @@ function GetHtmlContent {
<!-- On-Boarding Tab --> <!-- On-Boarding Tab -->
<div id="onboardTab" class="tab-content active"> <div id="onboardTab" class="tab-content active">
<h2>On-Boarding</h2> <h2>On-Boarding</h2>
<h3 class="subtitle">This new way of deploying our stack will make it easier to be sure everything is deployed successfully</h3> <h3 class="subtitle">This new deployment method ensures everything is successfully deployed with greater ease!</h3>
<div class="checkbox-group">
<label> <div class="columns-container">
<input type="checkbox" id="selectAllOnboardCheckbox" onclick="toggleOnboardCheckboxes(this)"> <!-- Left column -->
Select All <div class="checkbox-group column" id="leftColumn">
</label>
<label>
<input type="checkbox" name="setSVSPowerplan" id="SetSVSPowerplanCheckbox">
Set SVS Powerplan
</label>
<label>
<input type="checkbox" name="installSVSMSPModule" id="installSVSMSPModuleCheckbox">
Install SVSMSP Module
</label>
<label>
<input type="checkbox" name="installCyberQP" id="installCyberQPCheckbox">
Install CyberQP
</label>
<label>
<input type="checkbox" name="installSplashtop" id="installSplashtopCheckbox">
Install Splashtop
</label>
<label>
<input type="checkbox" name="installSVSHelpDesk" id="installSVSHelpDeskCheckbox">
Install SVSHelpDesk
</label>
<label>
<input type="checkbox" name="installSVSWatchtower" id="installSVSWatchtowerCheckbox">
Install SVSWatchtower
</label>
<label>
<input type="checkbox" name="installThreatLocker" id="installThreatLockerCheckbox">
Install ThreatLocker
</label>
<label>
<input type="checkbox" name="installRocketCyber" id="installRocketCyberCheckbox">
Install RocketCyber
</label>
<label>
<input type="checkbox" name="installDattoRMM" id="installDattoRMMCheckbox"
onclick="toggleDattoRMMOptions()">
Install DattoRMM
</label>
<div id="dattoRMMOptionsContainer" style="display:none; padding-left: 20px;">
<label> <label>
<input type="checkbox" name="dattoRMMOption" value="inputVar"> <input type="checkbox" id="selectAllLeftCheckbox" onclick="toggleLeftColumnCheckboxes(this)">
Copy Site Variables Select All
</label> </label>
<label> <label>
<input type="checkbox" name="dattoRMMOption" value="rmm"> <input type="checkbox" class="left-checkbox" name="setSVSPowerplan" id="SetSVSPowerplanCheckbox">
Install DRMM Agent Set SVS Powerplan
</label> </label>
<label> <label>
<input type="checkbox" name="dattoRMMOption" value="exe"> <input type="checkbox" class="left-checkbox" name="installSVSMSPModule" id="installSVSMSPModuleCheckbox">
Download.exe Install SVSMSP Module
</label> </label>
<br><br> <label>
<input type="checkbox" class="left-checkbox" name="installCyberQP" id="installCyberQPCheckbox">
Install CyberQP
</label>
<label>
<input type="checkbox" class="left-checkbox" name="installSplashtop" id="installSplashtopCheckbox">
Install Splashtop
</label>
<label>
<input type="checkbox" class="left-checkbox" name="installSVSHelpDesk" id="installSVSHelpDeskCheckbox">
Install SVSHelpDesk
</label>
<label>
<input type="checkbox" class="left-checkbox" name="installThreatLocker" id="installThreatLockerCheckbox">
Install ThreatLocker
</label>
<label>
<input type="checkbox" class="left-checkbox" name="installRocketCyber" id="installRocketCyberCheckbox">
Install RocketCyber
</label>
<label>
<input type="checkbox" class="left-checkbox" name="installDattoRMM" id="installDattoRMMCheckbox"
onclick="toggleDattoRMMOptions()">
Install DattoRMM
</label>
<div id="dattoRMMOptionsContainer" style="display:none; padding-left: 20px;">
<label>
<input type="checkbox" class="left-checkbox" name="dattoRMMOption" value="inputVar">
Copy Site Variables
</label>
<label>
<input type="checkbox" class="left-checkbox" name="dattoRMMOption" value="rmm">
Install DRMM Agent
</label>
<label>
<input type="checkbox" class="left-checkbox" name="dattoRMMOption" value="exe">
Download.exe
</label>
<br><br>
</div>
</div> </div>
</div>
<!-- Right column -->
<div class="checkbox-group column" id="rightColumn" >
<label>
<input type="checkbox" class="right-checkbox" name="EnableBitLocker" id="EnableBitLockerCheckbox">
Enable Bitlocker
</label>
<label>
<input type="checkbox" class="right-checkbox" name="setedgedefaultsearch" id="setedgedefaultsearchCheckbox">
Set Edge Default Search Engine
</label>
<!-- Add more checkboxes here -->
</div>
</div>
<div id="n8nPasswordContainer" style="display: none;"> <div id="n8nPasswordContainer" style="display: none;">
<label for="n8nPassword">Enter n8n Password:</label><br> <label for="n8nPassword">Enter Password:</label><br>
<input type="password" id="n8nPassword" class="password-input" placeholder="Enter N8N Password"> <input type="password" id="n8nPassword" class="password-input" placeholder="Enter Password">
</div> </div>
<br> <br>
<div id="DattoRMMContainer" style="display: none;"> <div id="DattoRMMContainer" style="display: none;">
@@ -600,6 +697,38 @@ function GetHtmlContent {
<label> <label>
<input type="checkbox" name="uninstallThreatLocker" id="uninstallThreatLockerCheckbox"> <input type="checkbox" name="uninstallThreatLocker" id="uninstallThreatLockerCheckbox">
Uninstall ThreatLocker Uninstall ThreatLocker
</label>
<label>
<input type="checkbox" name="uninstallCyberQP" id="uninstallCyberQPCheckbox">
Uninstall CyberQP
</label>
<label>
<input type="checkbox" name="uninstallDattoEDR" id="uninstallDattoEDRCheckbox">
Uninstall DattoEDR
</label>
<label>
<input type="checkbox" name="uninstallDattoRMM" id="uninstallDattoRMMCheckbox">
Uninstall DattoRMM
</label>
<label>
<input type="checkbox" name="uninstallDattoDEB" id="uninstallDattoDEBCheckbox">
Uninstall DattoDEB
</label>
<label>
<input type="checkbox" name="uninstallRocketCyber" id="uninstallRocketCyberCheckbox">
Uninstall RocketCyber
</label>
<label>
<input type="checkbox" name="uninstallSplashtop" id="uninstallSplashtopCheckbox">
Uninstall splashtop
</label>
<label>
<input type="checkbox" name="uninstallSVSHelpdesk" id="uninstallSVSHelpdeskCheckbox">
Uninstall SVSHelpdesk
</label>
<label>
<input type="checkbox" name="uninstallSVSWatchtower" id="uninstallSVSWatchtowerCheckbox">
Uninstall SVSWatchtower
</label> </label>
<div class="button-group"> <div class="button-group">
<button class="install-button" onclick="triggerOffboard()">Offboard</button> <button class="install-button" onclick="triggerOffboard()">Offboard</button>
@@ -653,15 +782,7 @@ function GetHtmlContent {
const optionsContainer = document.getElementById('dattoRMMOptionsContainer'); const optionsContainer = document.getElementById('dattoRMMOptionsContainer');
const n8nPasswordContainer = document.getElementById('n8nPasswordContainer'); const n8nPasswordContainer = document.getElementById('n8nPasswordContainer');
const dattoRMMContainer = document.getElementById('DattoRMMContainer'); const dattoRMMContainer = document.getElementById('DattoRMMContainer');
checkboxes.forEach(checkbox => {
if (checkbox !== selectedCheckbox) {
checkbox.checked = selectedCheckbox.checked;
}
});
if (dattoRMMCheckbox.checked) { if (dattoRMMCheckbox.checked) {
optionsContainer.style.display = 'block'; optionsContainer.style.display = 'block';
n8nPasswordContainer.style.display = 'block'; n8nPasswordContainer.style.display = 'block';
@@ -673,6 +794,31 @@ function GetHtmlContent {
} }
} }
function toggleLeftColumnCheckboxes(selectAllCheckbox) {
const leftCheckboxes = document.querySelectorAll('#leftColumn input[type="checkbox"]:not(#selectAllLeftCheckbox)');
const dattoRMMCheckbox = document.getElementById('installDattoRMMCheckbox');
const optionsContainer = document.getElementById('dattoRMMOptionsContainer');
const n8nPasswordContainer = document.getElementById('n8nPasswordContainer');
const dattoRMMContainer = document.getElementById('DattoRMMContainer');
// Toggle all checkboxes
leftCheckboxes.forEach(checkbox => {
checkbox.checked = selectAllCheckbox.checked;
});
// Check if "Install DattoRMM" is selected
if (dattoRMMCheckbox.checked) {
optionsContainer.style.display = 'block';
n8nPasswordContainer.style.display = 'block';
dattoRMMContainer.style.display = 'block';
} else {
optionsContainer.style.display = 'none';
n8nPasswordContainer.style.display = 'none';
dattoRMMContainer.style.display = 'none';
}
}
function updateSelectAllonboard() { function updateSelectAllonboard() {
const selectAllCheckbox = document.getElementById('selectAllOnboardCheckbox'); const selectAllCheckbox = document.getElementById('selectAllOnboardCheckbox');
const checkboxes = document const checkboxes = document
@@ -683,43 +829,69 @@ function GetHtmlContent {
selectAllCheckbox.checked = Array.from(checkboxes).every(checkbox => checkbox.checked); selectAllCheckbox.checked = Array.from(checkboxes).every(checkbox => checkbox.checked);
} }
function gatherSelectedTasks() {
const selectedLeftTasks = Array.from(document.querySelectorAll('.left-checkbox:checked')).map(checkbox => checkbox.name);
const selectedRightTasks = Array.from(document.querySelectorAll('.right-checkbox:checked')).map(checkbox => checkbox.name);
return [...selectedLeftTasks, ...selectedRightTasks];
}
// Attach the updateSelectAllonboard function to all individual checkboxes // Attach the updateSelectAllonboard function to all individual checkboxes
document.querySelectorAll('#onboardTab input[type="checkbox"]:not(#selectAllOnboardCheckbox)').forEach(checkbox => { document.querySelectorAll('#onboardTab input[type="checkbox"]:not(#selectAllOnboardCheckbox)').forEach(checkbox => {
checkbox.addEventListener('change', updateSelectAllonboard); checkbox.addEventListener('change', updateSelectAllonboard);
}); });
function toggleOffboardCheckboxes(selectAllCheckbox) { function toggleOffboardCheckboxes(selectAllCheckbox) {
// Get all checkboxes inside the offboardTab container const checkboxes = document.querySelectorAll('#offboardTab input[type="checkbox"]:not(#selectAllOffboardCheckbox)');
const checkboxes = document
.getElementById('offboardTab')
.querySelectorAll('input[type="checkbox"]:not(#selectAllOffboardCheckbox)');
// Set the checked state of all checkboxes to match the "Select All" checkbox
checkboxes.forEach(checkbox => { checkboxes.forEach(checkbox => {
checkbox.checked = selectAllCheckbox.checked; checkbox.checked = selectAllCheckbox.checked;
}); });
} }
function updateSelectAllOffboard() { function updateSelectAllOffboard() {
const selectAllCheckbox = document.getElementById('selectAllOffboardCheckbox'); const selectAllCheckbox = document.getElementById('selectAllOffboardCheckbox');
const checkboxes = document const checkboxes = document.querySelectorAll('#offboardTab input[type="checkbox"]:not(#selectAllOffboardCheckbox)');
.getElementById('offboardTab')
.querySelectorAll('input[type="checkbox"]:not(#selectAllOffboardCheckbox)');
// If any checkbox is unchecked, uncheck "Select All"
selectAllCheckbox.checked = Array.from(checkboxes).every(checkbox => checkbox.checked); selectAllCheckbox.checked = Array.from(checkboxes).every(checkbox => checkbox.checked);
} }
// Attach the updateSelectAllOffboard function to all individual checkboxes
document.querySelectorAll('#offboardTab input[type="checkbox"]:not(#selectAllOffboardCheckbox)').forEach(checkbox => { document.querySelectorAll('#offboardTab input[type="checkbox"]:not(#selectAllOffboardCheckbox)').forEach(checkbox => {
checkbox.addEventListener('change', updateSelectAllOffboard); checkbox.addEventListener('change', updateSelectAllOffboard);
}); });
function triggerOffboard() { function triggerOffboard() {
appendLog("testeteteteteteet") const checkboxes = document.querySelectorAll('#offboardTab input[type="checkbox"]:not(#selectAllOffboardCheckbox)');
const selectedTasks = Array.from(checkboxes)
.filter(checkbox => checkbox.checked)
.map(checkbox => checkbox.name);
if (selectedTasks.length === 0) {
appendLog("Please select at least one offboarding task.", "red");
return;
}
appendLog("Starting offboarding tasks...", "yellow");
fetch('/offboard', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ SelectedTasks: selectedTasks })
})
.then(response => {
if (!response.ok) {
throw new Error('Failed to execute offboarding tasks.');
}
return response.text();
})
.then(message => {
appendLog(message, "green");
})
.catch(error => {
appendLog("Error: " + error.message, "red");
});
} }
function toggleTweaksCheckboxes(selectAllCheckbox) { function toggleTweaksCheckboxes(selectAllCheckbox) {
// Get all checkboxes inside the tweaksTab container // Get all checkboxes inside the tweaksTab container
const checkboxes = document const checkboxes = document
@@ -838,7 +1010,6 @@ function GetHtmlContent {
} }
} }
function triggerInstall() { function triggerInstall() {
const dropdown = document.getElementById('dattoRmmDropdown'); const dropdown = document.getElementById('dattoRmmDropdown');
const UID = dropdown && dropdown.options[dropdown.selectedIndex] const UID = dropdown && dropdown.options[dropdown.selectedIndex]
@@ -851,15 +1022,14 @@ function GetHtmlContent {
(async () => { (async () => {
// Priority 1: Install SVSMSP Module // Priority 1: Install SVSMSP Module
if (document.querySelector('input[name="installSVSMSPModule"]').checked) { if (document.querySelector('input[name="installSVSMSPModule"]').checked) {
appendLog("Installing SVSMSP Module (Priority 1)...", "cyan"); appendLog("Installing SVSMSP Module (Priority 1)...", "cyan");
try { try {
await fetch('/installSVSMSPModule', { method: 'GET' }); await fetch('/installSVSMSPModule', { method: 'GET' });
appendLog("SVSMSP Module installation completed.", "green"); appendLog("SVSMSP Module installation completed.", "green");
} catch (error) { } catch (error) {
appendLog("Error installing SVSMS", "red"); appendLog("Error installing SVSMSP Module: " + error.message, "red");
} }
} }
// Priority 2: Install DattoRMM // Priority 2: Install DattoRMM
if (document.querySelector('input[name="installDattoRMM"]').checked) { if (document.querySelector('input[name="installDattoRMM"]').checked) {
@@ -881,85 +1051,99 @@ function GetHtmlContent {
}); });
appendLog("DattoRMM installation completed.", "green"); appendLog("DattoRMM installation completed.", "green");
} catch (error) { } catch (error) {
appendLog("Error installing DattoRMM: ${error.message}", "red"); appendLog("Error installing DattoRMM: " + error.message, "red");
} }
} }
// Priority 3: Other tasks // Priority 3: Other tasks
if (document.querySelector('input[name="setSVSPowerplan"]').checked) { if (document.querySelector('input[name="setSVSPowerplan"]').checked) {
appendLog("Setting SVS Powerplan (Priority 3)...", "cyan"); appendLog("Setting SVS Powerplan (Priority 3)...", "cyan");
try { try {
await fetch('/SetSVSPowerplan', { method: 'GET' }); await fetch('/SetSVSPowerplan', { method: 'GET' });
appendLog("SVS Powerplan set successfully.", "green"); appendLog("SVS Powerplan set successfully.", "green");
} catch (error) { } catch (error) {
appendLog("Error setting SVS Powerplan: ${error.message}", "red"); appendLog("Error setting SVS Powerplan: " + error.message, "red");
} }
} }
if (document.querySelector('input[name="installCyberQP"]').checked) { if (document.querySelector('input[name="installCyberQP"]').checked) {
appendLog("Installing CyberQP (Priority 3)...", "cyan"); appendLog("Installing CyberQP (Priority 3)...", "cyan");
try { try {
await fetch('/installCyberQP', { method: 'GET' }); await fetch('/installCyberQP', { method: 'GET' });
appendLog("CyberQP installation completed.", "green"); appendLog("CyberQP installation completed.", "green");
} catch (error) { } catch (error) {
appendLog("Error installing CyberQP: ${error.message}", "red"); appendLog("Error installing CyberQP: " + error.message, "red");
} }
} }
if (document.querySelector('input[name="installSplashtop"]').checked) { if (document.querySelector('input[name="installSplashtop"]').checked) {
appendLog("Installing Splashtop (Priority 3)...", "cyan"); appendLog("Installing Splashtop (Priority 3)...", "cyan");
try { try {
await fetch('/installSplashtop', { method: 'GET' }); await fetch('/installSplashtop', { method: 'GET' });
appendLog("Splashtop installation completed.", "green"); appendLog("Splashtop installation completed.", "green");
} catch (error) { } catch (error) {
appendLog("Error installing Splashtop: ${error.message}", "red"); appendLog("Error installing Splashtop: " + error.message, "red");
} }
} }
if (document.querySelector('input[name="installSVSHelpDesk"]').checked) { if (document.querySelector('input[name="installSVSHelpDesk"]').checked) {
appendLog("Installing SVS HelpDesk (Priority 3)...", "cyan"); appendLog("Installing SVS HelpDesk (Priority 3)...", "cyan");
try { try {
await fetch('/installSVSHelpDesk', { method: 'GET' }); await fetch('/installSVSHelpDesk', { method: 'GET' });
appendLog("SVS HelpDesk installation completed.", "green"); appendLog("SVS HelpDesk installation completed.", "green");
} catch (error) { } catch (error) {
appendLog("Error installing SVS HelpDesk: ${error.message}", "red"); appendLog("Error installing SVS HelpDesk: " + error.message, "red");
} }
} }
if (document.querySelector('input[name="installSVSWatchtower"]').checked) {
appendLog("Installing SVS Watchtower (Priority 3)...", "cyan");
try {
await fetch('/installSVSWatchtower', { method: 'GET' });
appendLog("SVS Watchtower installation completed.", "green");
} catch (error) {
appendLog("Error installing SVS Watchtower: ${error.message}", "red");
}
}
if (document.querySelector('input[name="installThreatLocker"]').checked) { if (document.querySelector('input[name="installThreatLocker"]').checked) {
appendLog("Installing ThreatLocker (Priority 3)...", "cyan"); appendLog("Installing ThreatLocker (Priority 3)...", "cyan");
try { try {
await fetch('/installThreatLocker', { method: 'GET' }); await fetch('/installThreatLocker', { method: 'GET' });
appendLog("ThreatLocker installation completed.", "green"); appendLog("ThreatLocker installation completed.", "green");
} catch (error) { } catch (error) {
appendLog("Error installing ThreatLocker: ${error.message}", "red"); appendLog("Error installing ThreatLocker: " + error.message, "red");
} }
} }
if (document.querySelector('input[name="installRocketCyber"]').checked) { if (document.querySelector('input[name="installRocketCyber"]').checked) {
appendLog("Installing RocketCyber (Priority 3)...", "cyan"); appendLog("Installing RocketCyber (Priority 3)...", "cyan");
try { try {
await fetch('/installRocketCyber', { method: 'GET' }); await fetch('/installRocketCyber', { method: 'GET' });
appendLog("RocketCyber installation completed.", "green"); appendLog("RocketCyber installation completed.", "green");
} catch (error) { } catch (error) {
appendLog("Error installing RocketCyber: ${error.message}", "red"); appendLog("Error installing RocketCyber: " + error.message, "red");
} }
} }
// NEW: Set Edge Default Search Engine
if (document.querySelector('input[name="setedgedefaultsearch"]').checked) {
appendLog("Setting Edge Default Search Engine (Priority 3)...", "cyan");
try {
await fetch('/setedgedefaultsearch', { method: 'GET' });
appendLog("Edge Default Search Engine set successfully.", "green");
} catch (error) {
appendLog("Error setting Edge Default Search Engine: " + error.message, "red");
}
}
if (document.querySelector('input[name="EnableBitLocker"]').checked) {
appendLog("Enabling BitLocker (Priority 3)...", "cyan");
try {
await fetch('/EnableBitLocker', { method: 'GET' });
appendLog("BitLocker enabled successfully.", "green");
} catch (error) {
appendLog("Error enabling BitLocker: " + error.message, "red");
}
}
})(); })();
} }
function endSession() { function endSession() {
@@ -1231,7 +1415,7 @@ try {
$responseString = "Method not allowed. Use GET." $responseString = "Method not allowed. Use GET."
$response.StatusCode = 405 $response.StatusCode = 405
} }
$buffer = [System.Text.Encoding]::UTF8.GetBytes($responseString) $buffer = [System.Text.Encoding]::UTF8.GetBytes($responseString)
$response.ContentType = "text/plain" $response.ContentType = "text/plain"
$response.ContentLength64 = $buffer.Length $response.ContentLength64 = $buffer.Length
$response.OutputStream.Write($buffer, 0, $buffer.Length) $response.OutputStream.Write($buffer, 0, $buffer.Length)
@@ -1282,7 +1466,6 @@ try {
"/setedgedefaultsearch"{ "/setedgedefaultsearch"{
if ($request.HttpMethod -eq "GET") { if ($request.HttpMethod -eq "GET") {
write-host "it attempted it!"
try { try {
set-EdgeDefaultSearchProvider set-EdgeDefaultSearchProvider
$responseString = "setedgedefaultsearch triggered successfully." $responseString = "setedgedefaultsearch triggered successfully."
@@ -1324,15 +1507,19 @@ try {
$response.OutputStream.Close() $response.OutputStream.Close()
} }
"/installSVSWatchtower" {
"/EdgeDefaultSearchEngine" {
if ($request.HttpMethod -eq "GET") { if ($request.HttpMethod -eq "GET") {
Install-SVSWatchtower
try { try {
Install-SVSWatchtower Write-LogHybrid -Message "Setting Edge Default Search Engine started." -Level "Info"
$responseString = "Install SVSWatchtower triggered successfully." Set-EdgeDefaultSearchEngine
Write-LogHybrid -Message "Edge Default Search Engine set successfully." -Level "Success"
$responseString = " Set Edge Default Search Engine triggered successfully."
$response.StatusCode = 200 $response.StatusCode = 200
} catch { } catch {
$responseString = "Error triggering Install SVSWatchtower: $_" Write-LogHybrid -Message "Error setting Edge Default Search Engine: $($_.Exception.Message)" -Level "Error"
$responseString = "Error attempting to Set Edge Default Search Engine: $_"
$response.StatusCode = 500 $response.StatusCode = 500
} }
} else { } else {
@@ -1346,6 +1533,92 @@ try {
$response.OutputStream.Close() $response.OutputStream.Close()
} }
"/EnableBitLocker" {
if ($request.HttpMethod -eq "GET") {
try {
Set-SVSBitLocker -Mode Enable -DriveLetter C -SaveToRegistry $true
$responseString = " BitLocker enabled on C successfully."
$response.StatusCode = 200
} catch {
$responseString = "Error Attempting to set BitLocker: $_"
$response.StatusCode = 500
}
} else {
$responseString = "Method not allowed. Use GET."
$response.StatusCode = 405
}
$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()
}
"/offboard" {
if ($request.HttpMethod -eq "POST") {
try {
# Read the Request Body
$bodyStream = New-Object IO.StreamReader $request.InputStream
$body = $bodyStream.ReadToEnd()
$requestData = ConvertFrom-Json $body
$selectedTasks = $requestData.SelectedTasks
Write-LogHybrid -Message "Offboarding request received with tasks: $($selectedTasks -join ', ')" -Level "Info"
if (-not $selectedTasks -or $selectedTasks.Count -eq 0) {
$response.StatusCode = 400
$responseString = "Error: No offboarding tasks selected."
$buffer = [System.Text.Encoding]::UTF8.GetBytes($responseString)
$response.OutputStream.Write($buffer, 0, $buffer.Length)
$response.OutputStream.Close()
return
}
# Process each selected task
foreach ($task in $selectedTasks) {
switch ($task) {
"uninstallSVSMSPModule" { Write-LogHybrid -Message "Uninstalling SVSMSP Module..." -Level "Info"; } #Uninstall-SVSMSP }
"uninstallThreatLocker" { Write-LogHybrid -Message "Uninstalling Threatlocker" -Level "Info"; Uninstall-ThreatLocker }
"uninstallCyberQP" { Write-LogHybrid -Message "Uninstalling CyberQP" -Level "Info";Uninstall-CyberQP }
"uninstallDattoEDR" { Uninstall-DattoEDR }
"uninstallDattoRMM" { Uninstall-DattoRMM }
"uninstallRocketCyber" { Uninstall-RocketCyber }
"uninstallSplashtop" { Uninstall-Splashtop }
"uninstallSVSHelpdesk" { Uninstall-SVSHelpdesk }
"uninstallSVSWatchtower" { Uninstall-SVSWatchtower }
default {
Write-LogHybrid -Message "Unknown task: $task" -Level "Warning"
}
}
}
# Return Success Response
$responseString = "Offboarding tasks executed successfully."
$response.StatusCode = 200
} catch {
$responseString = "Error processing offboarding tasks: $($_.Exception.Message)"
$response.StatusCode = 500
}
# 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()
} else {
$responseString = "Method not allowed. Use POST."
$response.StatusCode = 405
$buffer = [System.Text.Encoding]::UTF8.GetBytes($responseString)
$response.OutputStream.Write($buffer, 0, $buffer.Length)
$response.OutputStream.Close()
}
}
"/runTweaks" { "/runTweaks" {
if ($request.HttpMethod -eq "POST") { if ($request.HttpMethod -eq "POST") {
try { try {