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
177 lines (156 loc) · 12.4 KB
/
Copy pathApplication_Paths.cs
File metadata and controls
177 lines (156 loc) · 12.4 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace NetLock_RMM_Agent_Comm
{
internal class Application_Paths
{
// Paths
public static string c_temp = GetTempPath();
public static string c_temp_netlock_dir = Path.Combine(GetTempPath(), "netlock rmm");
public static string c_temp_installer_dir = Path.Combine(GetTempPath(), "netlock rmm", "installer");
public static string c_temp_installer_path = Path.Combine(c_temp_installer_dir, OperatingSystem.IsWindows() ? "NetLock_RMM_Agent_Installer.exe" : "NetLock_RMM_Agent_Installer");
// NetLock Paths
public static string netlock_service_exe = Path.Combine(GetBasePath_ProgramFiles(), "0x101 Cyber Security", "NetLock RMM", "NetLock RMM Comm Agent Windows", "NetLock_RMM_Comm_Agent_Windows.exe");
public static string netlock_health_service_exe = Path.Combine(GetBasePath_ProgramFiles(), "0x101 Cyber Security", "NetLock RMM", "Health", "NetLock_RMM_Health_Agent.exe");
public static string netlock_comm_agent_version_txt = Path.Combine(GetBasePath_CommonApplicationData(), "0x101 Cyber Security", "NetLock RMM", "Comm Agent", "version.txt");
//public static string netlock_installer_exe = Path.Combine(GetBasePath_CommonApplicationData(), "0x101 Cyber Security", "NetLock RMM", "Installer", "Installer.exe");
//public static string netlock_uninstaller_exe = Path.Combine(GetBasePath_CommonApplicationData(), "0x101 Cyber Security", "NetLock RMM", "Uninstaller", "Uninstaller.exe");
// User Process paths (cross-platform)
public static string program_files_user_process_dir = Path.Combine(GetBasePath_ProgramFiles(), OperatingSystem.IsWindows() ? "0x101 Cyber Security" : "0x101_Cyber_Security", OperatingSystem.IsWindows() ? "NetLock RMM" : "NetLock_RMM", OperatingSystem.IsWindows() ? "User Process" : "User_Process");
public static string program_files_user_process_path = Path.Combine(GetBasePath_ProgramFiles(), OperatingSystem.IsWindows() ? "0x101 Cyber Security" : "0x101_Cyber_Security", OperatingSystem.IsWindows() ? "NetLock RMM" : "NetLock_RMM", OperatingSystem.IsWindows() ? "User Process" : "User_Process", OperatingSystem.IsWindows() ? "NetLock_RMM_User_Process.exe" : "NetLock_RMM_User_Process");
public static string program_files_user_process_uac_path = Path.Combine(GetBasePath_ProgramFiles(), OperatingSystem.IsWindows() ? "0x101 Cyber Security" : "0x101_Cyber_Security", OperatingSystem.IsWindows() ? "NetLock RMM" : "NetLock_RMM", OperatingSystem.IsWindows() ? "User Process" : "User_Process", OperatingSystem.IsWindows() ? "NetLock_RMM_User_Process_UAC.exe" : "NetLock_RMM_User_Process");
// Linux autostart paths
public static string linux_autostart_dir = "/etc/xdg/autostart";
public static string linux_autostart_user_process_desktop_file = "/etc/xdg/autostart/netlock-rmm-user-process.desktop";
public static string linux_autostart_tray_icon_desktop_file = "/etc/xdg/autostart/netlock-rmm-tray-icon.desktop";
// macOS LaunchAgent paths
public static string macos_launch_agents_dir = "/Library/LaunchAgents";
public static string macos_launch_agent_user_process_plist = "/Library/LaunchAgents/com.netlock.rmm.user.process.plist";
public static string macos_launch_agent_tray_icon_plist = "/Library/LaunchAgents/com.netlock.rmm.tray.icon.plist";
public static string program_data = Path.Combine(GetBasePath_CommonApplicationData(), "0x101 Cyber Security", "NetLock RMM", "Comm Agent");
public static string program_data_logs = Path.Combine(GetBasePath_CommonApplicationData(), "0x101 Cyber Security", "NetLock RMM", "Comm Agent", "Logs");
public static string program_data_installer = Path.Combine(GetBasePath_CommonApplicationData(), "0x101 Cyber Security", "NetLock RMM", "Installer");
public static string program_data_updates = Path.Combine(GetBasePath_CommonApplicationData(), "0x101 Cyber Security", "NetLock RMM", "Updates");
public static string program_data_temp = Path.Combine(GetBasePath_CommonApplicationData(), "0x101 Cyber Security", "NetLock RMM", "Comm Agent", "Temp");
public static string program_data_updates_service_package = Path.Combine(GetBasePath_CommonApplicationData(), "0x101 Cyber Security", "NetLock RMM", "Updates", "comm_agent.package");
public static string program_data_server_config_json = Path.Combine(GetBasePath_CommonApplicationData(), "0x101 Cyber Security", "NetLock RMM", "Comm Agent", "server_config.json");
public static string program_data_health_agent_server_config = Path.Combine(GetBasePath_CommonApplicationData(), "0x101 Cyber Security", "NetLock RMM", "Health Agent", "server_config.json");
public static string program_data_debug_txt = Path.Combine(GetBasePath_CommonApplicationData(), "0x101 Cyber Security", "NetLock RMM", "Comm Agent", "debug.txt");
public static string program_data_scripts = Path.Combine(GetBasePath_CommonApplicationData(), "0x101 Cyber Security", "NetLock RMM", "Comm Agent", "Scripts");
public static string program_data_remote_agent_scripts = Path.Combine(GetBasePath_CommonApplicationData(), "0x101 Cyber Security", "NetLock RMM", "Remote Agent", "Scripts");
public static string program_data_sensors = Path.Combine(GetBasePath_CommonApplicationData(), "0x101 Cyber Security", "NetLock RMM", "Comm Agent", "Sensors");
public static string program_data_microsoft_defender_antivirus_eventlog_backup = @"C:\ProgramData\0x101 Cyber Security\NetLock RMM\Comm Agent\Microsoft Defender Antivirus\Microsoft-Windows-Windows Defender Operational.bak";
public static string program_data_microsoft_defender_antivirus_scan_jobs = @"C:\ProgramData\0x101 Cyber Security\NetLock RMM\Comm Agent\Microsoft Defender Antivirus\Scan Jobs";
public static string program_data_jobs = Path.Combine(GetBasePath_CommonApplicationData(), "0x101 Cyber Security", "NetLock RMM", "Comm Agent", "Jobs");
public static string program_data_netlock_policy_database = Path.Combine(GetBasePath_CommonApplicationData(), "0x101 Cyber Security", "NetLock RMM", "Comm Agent", "policy.nlock");
public static string program_data_netlock_events_database = Path.Combine(GetBasePath_CommonApplicationData(), "0x101 Cyber Security", "NetLock RMM", "Comm Agent", "events.nlock");
public static string device_identity_json_path = Path.Combine(GetBasePath_CommonApplicationData(), "0x101 Cyber Security", "NetLock RMM", "Comm Agent", "device_identity.json");
public static string agent_settings_json_path = Path.Combine(GetBasePath_CommonApplicationData(), "0x101 Cyber Security", "NetLock RMM", "Comm Agent", "agent_config.json");
// Tray Icon
public static string tray_icon_dir = Path.Combine(GetBasePath_CommonApplicationData(), "0x101 Cyber Security", "NetLock RMM", "Comm Agent", "Tray Icon");
public static string tray_icon_settings_json_path = Path.Combine(GetBasePath_CommonApplicationData(), "0x101 Cyber Security", "NetLock RMM", "Comm Agent", "Tray Icon", "config.json");
public static string program_files_tray_icon_path = GetTrayIconPath();
private static string GetTrayIconPath()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return Path.Combine(GetBasePath_ProgramFiles(), "0x101 Cyber Security", "NetLock RMM", "Tray Icon", "NetLock_RMM_Tray_Icon.exe");
}
else
{
// Linux and macOS use underscores instead of spaces in paths
return Path.Combine(GetBasePath_ProgramFiles(), "0x101_Cyber_Security", "NetLock_RMM", "Tray_Icon", "NetLock_RMM_Tray_Icon");
}
}
//public static string tray_icon_icon_exe = Path.Combine(GetBasePath_ProgramFiles(), "0x101 Cyber Security", "NetLock RMM", "Tray Icon", "NetLock_RMM_Tray_Icon.exe");
// 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";
// Reg Keys
public static string netlock_reg_path = @"SOFTWARE\WOW6432Node\NetLock RMM\Comm Agent";
public static string netlock_microsoft_defender_antivirus_reg_path = @"SOFTWARE\WOW6432Node\NetLock RMM\Comm Agent\Microsoft Defender Antivirus";
public static string netlock_yara_reg_path = @"SOFTWARE\WOW6432Node\NetLock RMM\Comm Agent\YARA";
public static string netlock_sensors_reg_path = @"SOFTWARE\WOW6432Node\NetLock RMM\Comm Agent\Sensors";
public static string netlock_sensor_management_reg_path = @"SOFTWARE\WOW6432Node\NetLock RMM\Comm Agent\Sensor_Management";
public static string netlock_log_connector_reg_path = @"SOFTWARE\WOW6432Node\NetLock RMM\Comm Agent\Log_Connector";
public static string netlock_rustdesk_reg_path = @"SOFTWARE\WOW6432Node\NetLock RMM\Comm Agent\RustDesk";
public static string netlock_support_mode_reg_path = @"SOFTWARE\WOW6432Node\NetLock RMM\Comm Agent\Support_Mode";
public static string hklm_run_directory_reg_path = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
public static string hklm_sas_reg_path = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System";
// Other
public static string just_installed = Path.Combine(GetBasePath_CommonApplicationData(), "0x101 Cyber Security", "NetLock RMM", "Comm Agent", "just_installed.txt");
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) || OperatingSystem.IsMacOS())
{
return "/usr/local/bin";
}
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;
}
}
}