From 77413fd7c4c16ea448e708250c86500f4f8777f0 Mon Sep 17 00:00:00 2001 From: M&G System <39799614+MEGSystem@users.noreply.github.com> Date: Thu, 12 Jan 2023 15:00:24 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9F=A2=20Switched=20from=20WInForm=20to?= =?UTF-8?q?=20Console=20Program?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VMDetector.sln | 14 +-- VMDetector/App.config | 6 - VMDetector/Main.Designer.cs | 72 ------------ VMDetector/Main.cs | 47 -------- VMDetector/Main.resx | 120 -------------------- VMDetector/Program.cs | 108 ++++++++++++++++-- VMDetector/Properties/AssemblyInfo.cs | 40 +++---- VMDetector/Properties/Resources.Designer.cs | 63 ---------- VMDetector/Properties/Resources.resx | 117 ------------------- VMDetector/Properties/Settings.Designer.cs | 26 ----- VMDetector/Properties/Settings.settings | 7 -- VMDetector/VMDetector.csproj | 42 +------ 12 files changed, 128 insertions(+), 534 deletions(-) delete mode 100644 VMDetector/App.config delete mode 100644 VMDetector/Main.Designer.cs delete mode 100644 VMDetector/Main.cs delete mode 100644 VMDetector/Main.resx delete mode 100644 VMDetector/Properties/Resources.Designer.cs delete mode 100644 VMDetector/Properties/Resources.resx delete mode 100644 VMDetector/Properties/Settings.Designer.cs delete mode 100644 VMDetector/Properties/Settings.settings diff --git a/VMDetector.sln b/VMDetector.sln index e1e6872..f2e0264 100644 --- a/VMDetector.sln +++ b/VMDetector.sln @@ -1,9 +1,9 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 -VisualStudioVersion = 17.1.32210.238 +VisualStudioVersion = 17.3.32825.248 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VMDetector", "VMDetector\VMDetector.csproj", "{88DCFA93-74FC-4BA5-AC01-9B5E1996F2B2}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VMDetector", "VMDetector\VMDetector.csproj", "{07377759-E33D-4CA0-95C5-54C29F082C8F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,15 +11,15 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {88DCFA93-74FC-4BA5-AC01-9B5E1996F2B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {88DCFA93-74FC-4BA5-AC01-9B5E1996F2B2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {88DCFA93-74FC-4BA5-AC01-9B5E1996F2B2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {88DCFA93-74FC-4BA5-AC01-9B5E1996F2B2}.Release|Any CPU.Build.0 = Release|Any CPU + {07377759-E33D-4CA0-95C5-54C29F082C8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {07377759-E33D-4CA0-95C5-54C29F082C8F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {07377759-E33D-4CA0-95C5-54C29F082C8F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {07377759-E33D-4CA0-95C5-54C29F082C8F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {9B14A5B2-22E8-4065-B21F-409048CDB410} + SolutionGuid = {474C2A01-16AD-4DC0-BB40-5927E33C96A7} EndGlobalSection EndGlobal diff --git a/VMDetector/App.config b/VMDetector/App.config deleted file mode 100644 index 56efbc7..0000000 --- a/VMDetector/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/VMDetector/Main.Designer.cs b/VMDetector/Main.Designer.cs deleted file mode 100644 index 9eb93c7..0000000 --- a/VMDetector/Main.Designer.cs +++ /dev/null @@ -1,72 +0,0 @@ -namespace VMDetector -{ - partial class Main - { - /// - /// Variabile di progettazione necessaria. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Pulire le risorse in uso. - /// - /// ha valore true se le risorse gestite devono essere eliminate, false in caso contrario. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Codice generato da Progettazione Windows Form - - /// - /// Metodo necessario per il supporto della finestra di progettazione. Non modificare - /// il contenuto del metodo con l'editor di codice. - /// - private void InitializeComponent() - { - this.label1 = new System.Windows.Forms.Label(); - this.SuspendLayout(); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font("Comic Sans MS", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label1.Location = new System.Drawing.Point(-2, -1); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(699, 51); - this.label1.TabIndex = 0; - this.label1.Text = "You are running this program in a VM"; - // - // Form1 - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.White; - this.ClientSize = new System.Drawing.Size(695, 58); - this.Controls.Add(this.label1); - this.Cursor = System.Windows.Forms.Cursors.Help; - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "Form1"; - this.ShowIcon = false; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "SimpleVMDetector"; - this.TopMost = true; - this.Load += new System.EventHandler(this.Main_Load); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Label label1; - } -} - diff --git a/VMDetector/Main.cs b/VMDetector/Main.cs deleted file mode 100644 index 17f9c17..0000000 --- a/VMDetector/Main.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Windows.Forms; - -namespace VMDetector -{ - public partial class Main : Form - { - public Main() - { - InitializeComponent(); - } - - private void Main_Load(object sender, EventArgs e) - { - using (var searcher = new System.Management.ManagementObjectSearcher("Select * from Win32_ComputerSystem")) - { - using (var items = searcher.Get()) - { - foreach (var item in items) - { - string manufacturer = item["Manufacturer"].ToString().ToLower(); - if ((manufacturer == "microsoft corporation" && item["Model"].ToString().ToUpperInvariant().Contains("VIRTUAL")) - || manufacturer.Contains("vmware") - || item["Model"].ToString() == "VirtualBox") - { - //VM - MessageBox.Show("This program is a test program\n" + - "This program is running on VM\n" + - "Instagram: @cursed_dev.tiktok\n" + - "GitHub: megsystem", "SimpleVMDetector", MessageBoxButtons.OK, MessageBoxIcon.Warning); - } - else - { - //Real Hardware - MessageBox.Show("This program is a test program\n" + - "This program is running on Real Hardware\n" + - "Be careful on the internet, there are many vm detectors\n" + - "Instagram: @cursed_dev.tiktok\n" + - "GitHub: megsystem", "SimpleVMDetector", MessageBoxButtons.OK, MessageBoxIcon.Warning); - Environment.Exit(-1); - } - } - } - } - } - } -} diff --git a/VMDetector/Main.resx b/VMDetector/Main.resx deleted file mode 100644 index 1af7de1..0000000 --- a/VMDetector/Main.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/VMDetector/Program.cs b/VMDetector/Program.cs index a800656..0c67079 100644 --- a/VMDetector/Program.cs +++ b/VMDetector/Program.cs @@ -1,19 +1,107 @@ using System; -using System.Windows.Forms; +using System.Collections.Generic; +using System.Linq; +using System.Management; +using System.Runtime.InteropServices; +using System.Text; namespace VMDetector { - internal static class Program + internal class Program { - /// - /// Punto di ingresso principale dell'applicazione. - /// - [STAThread] - static void Main() + static string text; + static string result; + static void Main(string[] args) { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new Main()); + text = "This program is running on a [RESULT]\nProgram created by @giovanni_giannone_"; + if (Detector.checkVM() || + Detector.checkSandboxie() || + Detector.checkDebugger()) result = "VM"; else result = "Real Machine"; + + // print output + Console.WriteLine(text.Replace("[RESULT]", result)); + Console.ReadKey(); + return; + } + } + + class Detector + { + // Check if in a virtual machine (like vmware and virtualbox) + public static bool checkVM() + { + using (ManagementObjectSearcher managementObjectSearcher = new ManagementObjectSearcher("Select * from Win32_ComputerSystem")) + { + try + { + using (ManagementObjectCollection managementObjectCollection = managementObjectSearcher.Get()) + { + foreach (ManagementBaseObject managementBaseObject in managementObjectCollection) + { + if ((managementBaseObject["Manufacturer"].ToString().ToLower() == "microsoft corporation" + && managementBaseObject["Model"].ToString().ToUpperInvariant().Contains("VIRTUAL")) || + managementBaseObject["Manufacturer"].ToString().ToLower().Contains("vmware") || + managementBaseObject["Model"].ToString() == "VirtualBox") + { + return true; // VM + } + } + } + } + catch + { + return true; // VM + } + } + foreach (ManagementBaseObject managementBaseObject2 in + new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_VideoController").Get()) + { + if (managementBaseObject2.GetPropertyValue("Name").ToString().Contains("VMware") && + managementBaseObject2.GetPropertyValue("Name").ToString().Contains("VBox")) + { + return true; // VM + } + } + return false; // Real Machine + } + + // SandBoxie + [DllImport("kernel32.dll")] + private static extern IntPtr GetModuleHandle(string lpModuleName); + public static bool checkSandboxie() + { + string[] array = new string[5] + { + "SbieDll.dll", + "SxIn.dll", + "Sf2.dll", + "snxhk.dll", + "cmdvrt32.dll" + }; + for (int i = 0; i < array.Length; i++) + { + if (GetModuleHandle(array[i]).ToInt32() != 0) + { + return true; // VM + } + } + return false; // Real Machine + } + + // Debugger + public static bool checkDebugger() + { + try + { + long ticks = DateTime.Now.Ticks; + System.Threading.Thread.Sleep(10); + if (DateTime.Now.Ticks - ticks < 10L) + { + return true; // VM + } + } + catch { } + return false; // Real Machine } } } diff --git a/VMDetector/Properties/AssemblyInfo.cs b/VMDetector/Properties/AssemblyInfo.cs index c00539c..37729e2 100644 --- a/VMDetector/Properties/AssemblyInfo.cs +++ b/VMDetector/Properties/AssemblyInfo.cs @@ -2,35 +2,35 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// Le informazioni generali relative a un assembly sono controllate dal seguente -// set di attributi. Modificare i valori di questi attributi per modificare le informazioni -// associate a un assembly. -[assembly: AssemblyTitle("VMDetector")] -[assembly: AssemblyDescription("VM Detector in C#")] +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("VM Detector")] +[assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("cursed_dev aka megsystem")] -[assembly: AssemblyProduct("VMDetector")] -[assembly: AssemblyCopyright("Copyright © 2022")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("VM Detector")] +[assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili -// ai componenti COM. Se è necessario accedere a un tipo in questo assembly da -// COM, impostare su true l'attributo ComVisible per tale tipo. +// 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 +// COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] -// Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi -[assembly: Guid("88dcfa93-74fc-4ba5-ac01-9b5e1996f2b2")] +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("07377759-e33d-4ca0-95c5-54c29f082c8f")] -// Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori: +// Version information for an assembly consists of the following four values: // -// Versione principale -// Versione secondaria -// Numero di build -// Revisione +// Major Version +// Minor Version +// Build Number +// Revision // -// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build -// usando l'asterisco '*' come illustrato di seguito: +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/VMDetector/Properties/Resources.Designer.cs b/VMDetector/Properties/Resources.Designer.cs deleted file mode 100644 index 30ea78a..0000000 --- a/VMDetector/Properties/Resources.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Il codice è stato generato da uno strumento. -// Versione runtime:4.0.30319.42000 -// -// Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se -// il codice viene rigenerato. -// -//------------------------------------------------------------------------------ - -namespace VMDetector.Properties { - using System; - - - /// - /// Classe di risorse fortemente tipizzata per la ricerca di stringhe localizzate e così via. - /// - // Questa classe è stata generata automaticamente dalla classe StronglyTypedResourceBuilder. - // tramite uno strumento quale ResGen o Visual Studio. - // Per aggiungere o rimuovere un membro, modificare il file con estensione ResX ed eseguire nuovamente ResGen - // con l'opzione /str oppure ricompilare il progetto VS. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Restituisce l'istanza di ResourceManager nella cache utilizzata da questa classe. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("VMDetector.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Esegue l'override della proprietà CurrentUICulture del thread corrente per tutte le - /// ricerche di risorse eseguite utilizzando questa classe di risorse fortemente tipizzata. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff --git a/VMDetector/Properties/Resources.resx b/VMDetector/Properties/Resources.resx deleted file mode 100644 index af7dbeb..0000000 --- a/VMDetector/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/VMDetector/Properties/Settings.Designer.cs b/VMDetector/Properties/Settings.Designer.cs deleted file mode 100644 index 75a66a9..0000000 --- a/VMDetector/Properties/Settings.Designer.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Il codice è stato generato da uno strumento. -// Versione runtime:4.0.30319.42000 -// -// Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se -// il codice viene rigenerato. -// -//------------------------------------------------------------------------------ - -namespace VMDetector.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.1.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff --git a/VMDetector/Properties/Settings.settings b/VMDetector/Properties/Settings.settings deleted file mode 100644 index 3964565..0000000 --- a/VMDetector/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/VMDetector/VMDetector.csproj b/VMDetector/VMDetector.csproj index a7ee62b..b9fde83 100644 --- a/VMDetector/VMDetector.csproj +++ b/VMDetector/VMDetector.csproj @@ -4,13 +4,12 @@ Debug AnyCPU - {88DCFA93-74FC-4BA5-AC01-9B5E1996F2B2} - WinExe + {07377759-E33D-4CA0-95C5-54C29F082C8F} + Exe VMDetector VMDetector - v4.7.2 + v4.0 512 - true true @@ -40,46 +39,11 @@ - - - - - - Form - - - Main.cs - - - Main.cs - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - True - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - \ No newline at end of file