Skip to content

Commit 7dfaa75

Browse files
committed
Introduce timeouts, event log viewer, and UI improvements
**feat: add timeouts, event log viewer, and duplication support** * Add configurable timeout for jobs * Add default timeout option for scripts, automatically loaded in remote shell when selecting a script * Allow passing a timeout to the remote shell * Introduce event log viewer with full overview and statistics * Optimize dark mode styling * Fix Microsoft Defender Antivirus notification filtering * Allow duplication of scripts, sensors, policies, and jobs * A lot of other polishing
1 parent 8b8dab5 commit 7dfaa75

80 files changed

Lines changed: 5011 additions & 738 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

NetLock RMM Agent Comm/Global/Device_Information/Hardware.cs

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public static string CPU_Name()
7070
{
7171
string cpu_name = string.Empty;
7272
// Read the CPU information from the system_profiler command
73-
string systemProfilerOutput = MacOS.Helper.Zsh.Execute_Script("CPU_Name", false, "system_profiler SPHardwareDataType");
73+
string systemProfilerOutput = MacOS.Helper.Zsh.Execute_Script("CPU_Name", false, "system_profiler SPHardwareDataType", 0);
7474
if (!string.IsNullOrEmpty(systemProfilerOutput))
7575
{
7676
// Search for the "Processor Name" line
@@ -283,19 +283,19 @@ public static string CPU_Information()
283283
cpu_name = CPU_Name();
284284

285285
// CPU Cores and Threads
286-
cpu_cores = MacOS.Helper.Zsh.Execute_Script("CPU_Information", false, "sysctl -n hw.physicalcpu").Trim();
287-
cpu_threads = MacOS.Helper.Zsh.Execute_Script("CPU_Information", false, "sysctl -n hw.logicalcpu").Trim();
286+
cpu_cores = MacOS.Helper.Zsh.Execute_Script("CPU_Information", false, "sysctl -n hw.physicalcpu", 0).Trim();
287+
cpu_threads = MacOS.Helper.Zsh.Execute_Script("CPU_Information", false, "sysctl -n hw.logicalcpu", 0).Trim();
288288

289289
// CPU Speed
290-
string cpu_speed_hz = MacOS.Helper.Zsh.Execute_Script("CPU_Information", false, "sysctl -n hw.cpufrequency").Trim();
290+
string cpu_speed_hz = MacOS.Helper.Zsh.Execute_Script("CPU_Information", false, "sysctl -n hw.cpufrequency", 0).Trim();
291291
if (long.TryParse(cpu_speed_hz, out long cpuSpeedHz))
292292
{
293293
double cpuSpeedGHz = cpuSpeedHz / 1_000_000_000.0; // Convert to GHz
294294
cpu_speed = Math.Round(cpuSpeedGHz, 2).ToString() + " GHz";
295295
}
296296

297297
// CPU Cache Size (L3)
298-
cpu_cache = MacOS.Helper.Zsh.Execute_Script("CPU_Information", false, "sysctl -n hw.l3cachesize").Trim();
298+
cpu_cache = MacOS.Helper.Zsh.Execute_Script("CPU_Information", false, "sysctl -n hw.l3cachesize", 0).Trim();
299299
if (long.TryParse(cpu_cache, out long cacheBytes))
300300
{
301301
double cacheMB = cacheBytes / 1_048_576.0; // Convert to MB
@@ -492,7 +492,7 @@ public static int CPU_Usage()
492492
try
493493
{
494494
// Execute the 'top' command to fetch CPU and memory usage
495-
string topOutput = MacOS.Helper.Zsh.Execute_Script("cpu usage", false, "top -l 1 | grep -E \"^CPU|^Phys\"");
495+
string topOutput = MacOS.Helper.Zsh.Execute_Script("cpu usage", false, "top -l 1 | grep -E \"^CPU|^Phys\"", 0);
496496

497497
if (!string.IsNullOrWhiteSpace(topOutput))
498498
{
@@ -796,7 +796,7 @@ public static string RAM_Information()
796796
string hardware_reserved = "N/A";
797797

798798
// Execute vm_stat command to gather memory statistics
799-
string vmStatOutput = MacOS.Helper.Zsh.Execute_Script("RAM_Information", false, "vm_stat");
799+
string vmStatOutput = MacOS.Helper.Zsh.Execute_Script("RAM_Information", false, "vm_stat", 0);
800800
if (!string.IsNullOrEmpty(vmStatOutput))
801801
{
802802
// Parse vm_stat output
@@ -823,7 +823,7 @@ public static string RAM_Information()
823823
}
824824

825825
// Use sysctl to gather additional memory information
826-
string sysctlOutput = MacOS.Helper.Zsh.Execute_Script("RAM_Information", false, "sysctl hw.memsize");
826+
string sysctlOutput = MacOS.Helper.Zsh.Execute_Script("RAM_Information", false, "sysctl hw.memsize", 0);
827827
if (!string.IsNullOrEmpty(sysctlOutput))
828828
{
829829
// Extract total memory size
@@ -949,7 +949,7 @@ public static int RAM_Usage()
949949
else if (OperatingSystem.IsLinux())
950950
{
951951
// RAM utilisation under Linux
952-
string ramUsage = Linux.Helper.Bash.Execute_Script("RAM_Usage", false, "free | grep Mem | awk '{print $3/$2 * 100}'");
952+
string ramUsage = Linux.Helper.Bash.Execute_Script("RAM_Usage", false, "free | grep Mem | awk '{print $3/$2 * 100}'", 0);
953953

954954
// Parse the result into a double to ensure proper rounding
955955
if (double.TryParse(ramUsage, out double usageValue))
@@ -968,7 +968,8 @@ public static int RAM_Usage()
968968
string vmStatOutput = MacOS.Helper.Zsh.Execute_Script(
969969
"RAM_Usage",
970970
false,
971-
"vm_stat | perl -ne '/page size of (\\d+)/ and $size=$1; /Pages\\s+([^:]+)[^\\d]+(\\d+)/ and printf(\"%-16s %16.2f Mi\\n\", \"$1:\", $2 * $size / 1048576);'"
971+
"vm_stat | perl -ne '/page size of (\\d+)/ and $size=$1; /Pages\\s+([^:]+)[^\\d]+(\\d+)/ and printf(\"%-16s %16.2f Mi\\n\", \"$1:\", $2 * $size / 1048576);'",
972+
0
972973
);
973974

974975
if (string.IsNullOrEmpty(vmStatOutput))
@@ -1480,12 +1481,12 @@ public static string RAM_Total()
14801481
}
14811482
else if (OperatingSystem.IsLinux())
14821483
{
1483-
_ram = Linux.Helper.Bash.Execute_Script("RAM_Total", false, "grep MemTotal /proc/meminfo | awk '{print $2}'");
1484+
_ram = Linux.Helper.Bash.Execute_Script("RAM_Total", false, "grep MemTotal /proc/meminfo | awk '{print $2}'", 0);
14841485
_ram = Math.Round(Convert.ToDouble(_ram) / 1024 / 1024).ToString();
14851486
}
14861487
else if (OperatingSystem.IsMacOS())
14871488
{
1488-
string systemProfilerOutput = MacOS.Helper.Zsh.Execute_Script("RAM_Total", false, "system_profiler SPHardwareDataType");
1489+
string systemProfilerOutput = MacOS.Helper.Zsh.Execute_Script("RAM_Total", false, "system_profiler SPHardwareDataType",0);
14891490
if (!string.IsNullOrEmpty(systemProfilerOutput))
14901491
{
14911492
foreach (string line in systemProfilerOutput.Split('\n'))
@@ -1775,7 +1776,7 @@ public static string Mainboard_Name()
17751776
{
17761777
if (File.Exists(path))
17771778
{
1778-
_mainboard = Linux.Helper.Bash.Execute_Script("Mainboard_Name", false, $"cat {path}").Trim();
1779+
_mainboard = Linux.Helper.Bash.Execute_Script("Mainboard_Name", false, $"cat {path}", 0).Trim();
17791780
break;
17801781
}
17811782
}
@@ -1785,7 +1786,7 @@ public static string Mainboard_Name()
17851786
{
17861787
if (File.Exists(path))
17871788
{
1788-
mainboard_manufacturer = Linux.Helper.Bash.Execute_Script("Mainboard_Name", false, $"cat {path}").Trim();
1789+
mainboard_manufacturer = Linux.Helper.Bash.Execute_Script("Mainboard_Name", false, $"cat {path}",0).Trim();
17891790
break;
17901791
}
17911792
}
@@ -1825,7 +1826,7 @@ public static string GPU_Name()
18251826
}
18261827
else if (OperatingSystem.IsLinux())
18271828
{
1828-
string output = Linux.Helper.Bash.Execute_Script("GPU_Name", false, "lshw -C display");
1829+
string output = Linux.Helper.Bash.Execute_Script("GPU_Name", false, "lshw -C display", 0);
18291830
if (!string.IsNullOrWhiteSpace(output))
18301831
{
18311832
string product = null;

NetLock RMM Agent Comm/Global/Device_Information/Network.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public static string Network_Adapter_Information()
123123
List<string> network_adapterJsonList = new List<string>();
124124

125125
// Run the 'ip link' command to get a list of network adapters
126-
string output = Linux.Helper.Bash.Execute_Script("Network_Adapter_Information", false, "ip link show");
126+
string output = Linux.Helper.Bash.Execute_Script("Network_Adapter_Information", false, "ip link show", 0);
127127

128128
// Split the output into individual network adapters
129129
var networkAdapters = output.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
@@ -134,7 +134,7 @@ public static string Network_Adapter_Information()
134134
string adapterName = adapterDetails[1].Trim();
135135

136136
// Run the 'ip' command to get IP address and other details for each adapter
137-
string output2 = Linux.Helper.Bash.Execute_Script("", false, $"ip addr show {adapterName}");
137+
string output2 = Linux.Helper.Bash.Execute_Script("", false, $"ip addr show {adapterName}", 0);
138138

139139
// Parse the necessary information from the second command output
140140
string ipv4Address = "N/A";
@@ -205,7 +205,7 @@ public static string Network_Adapter_Information()
205205
List<string> network_adapterJsonList = new List<string>();
206206

207207
// Execute the 'ifconfig' command to get the network adapter information
208-
string output = MacOS.Helper.Zsh.Execute_Script("Network_Adapter_Information", false, "ifconfig -a");
208+
string output = MacOS.Helper.Zsh.Execute_Script("Network_Adapter_Information", false, "ifconfig -a", 0);
209209

210210
// Divide the output into individual adapter sections
211211
var networkAdapters = output.Split(new[] { "\n\n" }, StringSplitOptions.RemoveEmptyEntries);
@@ -221,7 +221,7 @@ public static string Network_Adapter_Information()
221221

222222
try
223223
{
224-
string networksetupOutput = MacOS.Helper.Zsh.Execute_Script("Network_Adapter_Information", false, "networksetup -listallhardwareports");
224+
string networksetupOutput = MacOS.Helper.Zsh.Execute_Script("Network_Adapter_Information", false, "networksetup -listallhardwareports", 0);
225225
var match = Regex.Match(networksetupOutput, $"Hardware Port: (.+?)\\s+Device: {adapterName}");
226226
if (match.Success)
227227
{
@@ -267,15 +267,15 @@ public static string Network_Adapter_Information()
267267
// DHCP status can be checked using ipconfig (if available)
268268
string dhcp_enabled = "N/A";
269269

270-
var dhcpMatch = Zsh.Execute_Script("Network_Adapter_Information", false, $"ipconfig getpacket {adapterName}");
270+
var dhcpMatch = Zsh.Execute_Script("Network_Adapter_Information", false, $"ipconfig getpacket {adapterName}", 0);
271271
if (!string.IsNullOrEmpty(dhcpMatch) && dhcpMatch.Contains("dhcp"))
272272
dhcp_enabled = "True";
273273
else
274274
dhcp_enabled = "False";
275275

276276
// Subnet mask extraction (ifconfig example)
277277
string subnet_mask = "N/A";
278-
var subnetMatch = Zsh.Execute_Script("Network_Adapter_Information", false, $"ifconfig {adapterName}");
278+
var subnetMatch = Zsh.Execute_Script("Network_Adapter_Information", false, $"ifconfig {adapterName}", 0);
279279
var subnetMaskMatch = Regex.Match(subnetMatch, @"netmask\s+([a-fA-F0-9:]+)");
280280

281281
if (subnetMaskMatch.Success)
@@ -381,7 +381,7 @@ public static bool Firewall_Status()
381381
if (OperatingSystem.IsLinux())
382382
{
383383
// Check whether UFW is installed
384-
string ufwCheck = Bash.Execute_Script("Check_UFW_Installed", false, "command -v ufw");
384+
string ufwCheck = Bash.Execute_Script("Check_UFW_Installed", false, "command -v ufw", 0);
385385

386386
if (string.IsNullOrWhiteSpace(ufwCheck))
387387
{
@@ -391,7 +391,7 @@ public static bool Firewall_Status()
391391
}
392392

393393
// Check the status of the firewall
394-
string firewallStatus = Bash.Execute_Script("Check_Firewall_Status", false, "ufw status");
394+
string firewallStatus = Bash.Execute_Script("Check_Firewall_Status", false, "ufw status", 0);
395395

396396
// Check whether UFW is active
397397
if (firewallStatus.Contains("active"))
@@ -411,7 +411,7 @@ public static bool Firewall_Status()
411411
// 2 = On for essential services
412412

413413
// Check if the firewall is enabled
414-
string firewallStatus = Zsh.Execute_Script("Firewall_Status", false, "defaults read /Library/Preferences/com.apple.alf globalstate");
414+
string firewallStatus = Zsh.Execute_Script("Firewall_Status", false, "defaults read /Library/Preferences/com.apple.alf globalstate", 0);
415415

416416
if (firewallStatus.Contains("1"))
417417
{

NetLock RMM Agent Comm/Global/Device_Information/OS.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public static string Version()
8989
try
9090
{
9191
// macOS Systeminformationen abrufen
92-
string systemInfo = MacOS.Helper.Zsh.Execute_Script("Version", false, "sw_vers");
92+
string systemInfo = MacOS.Helper.Zsh.Execute_Script("Version", false, "sw_vers", 0);
9393
string productName = "-";
9494
string productVersion = "-";
9595
string buildVersion = "-";
@@ -326,7 +326,7 @@ public static string Get_Last_Boot_Time()
326326
else if (OperatingSystem.IsMacOS())
327327
{
328328
// Get the last boot time from the system
329-
string rawBootTime = MacOS.Helper.Zsh.Execute_Script("Get_Last_Boot_Time", false, "sysctl kern.boottime");
329+
string rawBootTime = MacOS.Helper.Zsh.Execute_Script("Get_Last_Boot_Time", false, "sysctl kern.boottime", 0);
330330

331331
// Extract the seconds part using Regex
332332
var match = System.Text.RegularExpressions.Regex.Match(rawBootTime, @"sec\s*=\s*(\d+)");
@@ -384,12 +384,12 @@ public static string Get_Last_Active_User()
384384
else if (OperatingSystem.IsLinux())
385385
{
386386
// Get the last active user from who command including ip
387-
lastLoggedOnUser = Linux.Helper.Bash.Execute_Script("Get_Last_Active_User", false, "who | awk '{print $1, $5}' | head -n 1");
387+
lastLoggedOnUser = Linux.Helper.Bash.Execute_Script("Get_Last_Active_User", false, "who | awk '{print $1, $5}' | head -n 1", 0);
388388
}
389389
else if (OperatingSystem.IsMacOS())
390390
{
391391
// Trim any whitespace and return the user
392-
lastLoggedOnUser = MacOS.Helper.Zsh.Execute_Script("Get_Last_Active_User", false, "whoami");
392+
lastLoggedOnUser = MacOS.Helper.Zsh.Execute_Script("Get_Last_Active_User", false, "whoami", 0);
393393
}
394394

395395
return lastLoggedOnUser;

0 commit comments

Comments
 (0)