forked from 0x101-Cyber-Security/NetLock-RMM
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApplication_Paths.cs
More file actions
104 lines (95 loc) · 4.53 KB
/
Copy pathApplication_Paths.cs
File metadata and controls
104 lines (95 loc) · 4.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace NetLock_RMM_Agent_Health
{
internal class Application_Paths
{
//public static string c_temp = @"C:\temp";
public static string c_temp_netlock_dir = Path.Combine(GetTempPath() ,"netlock rmm");
public static string c_temp_netlock_logs_dir = Path.Combine(GetTempPath(), "netlock rmm", "installer", "logs");
public static string c_temp_netlock_installer_dir = Path.Combine(GetTempPath(), "netlock rmm", "installer");
public static string c_temp_netlock_installer_path = Path.Combine(c_temp_netlock_installer_dir, OperatingSystem.IsWindows() ? "NetLock_RMM_Agent_Installer.exe" : "NetLock_RMM_Agent_Installer");
public static string installer_package_url_winx64 = "/private/downloads/netlock/installer.package.win-x64.zip";
public static string installer_package_url_winarm64 = "/private/downloads/netlock/installer.package.win-arm64.zip";
public static string installer_package_url_linuxx64 = "/private/downloads/netlock/installer.package.linux-x64.zip";
public static string installer_package_url_linuxarm64 = "/private/downloads/netlock/installer.package.linux-arm64.zip";
public static string installer_package_url_osx64 = "/private/downloads/netlock/installer.package.osx-x64.zip";
public static string installer_package_url_osxarm64 = "/private/downloads/netlock/installer.package.osx-arm64.zip";
public static string installer_package_path = @"installer.package";
public static string program_data = Path.Combine(GetBasePath_CommonApplicationData(), "0x101 Cyber Security", "NetLock RMM", "Health Agent");
public static string program_data_logs = Path.Combine(GetBasePath_CommonApplicationData(), "0x101 Cyber Security", "NetLock RMM", "Health Agent", "Logs");
public static string program_data_debug_txt = Path.Combine(GetBasePath_CommonApplicationData(), "0x101 Cyber Security", "NetLock RMM", "Health Agent", "debug.txt");
public static string program_data_server_config_json = Path.Combine(GetBasePath_CommonApplicationData(), "0x101 Cyber Security", "NetLock RMM", "Health Agent", "server_config.json");
private static string GetBasePath_CommonApplicationData()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
return "/var";
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
return "/Library/Application Support";
}
else if (OperatingSystem.IsMacOS())
{
return "/Library/Application Support";
}
else
{
throw new NotSupportedException("Unsupported OS");
}
}
private static string GetBasePath_ProgramFiles()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
return "/usr";
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
return "/Applications";
}
else if (OperatingSystem.IsMacOS())
{
return "/Applications";
}
else
{
throw new NotSupportedException("Unsupported OS");
}
}
public static string GetTempPath()
{
string basePath;
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
basePath = @"C:\temp";
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
basePath = "/tmp";
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
basePath = "/tmp";
}
else
{
throw new NotSupportedException("Unsupported OS");
}
return basePath;
}
}
}