Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

c# hwid lock

hey guys, which one is better?

https://github.com/Roshly/AyyHook-Loader

https://github.com/ThaisenPM/Serial-Numb...em-C-Sharp

i need c# hwid lock for my program, it's not cs:go cheat but i'll extract just the important things..

these can get leaked?

if you know another one more better for hwid lock, let me know, thank you
(Apr 25, 2020 08:20 AM)notahackerman Wrote:  hey guys, which one is better?

https://github.com/Roshly/AyyHook-Loader

https://github.com/ThaisenPM/Serial-Numb...em-C-Sharp

i need c# hwid lock for my program, it's not cs:go cheat but i'll extract just the important things..

these can get leaked?

if you know another one more better for hwid lock, let me know, thank you

If I have a better understanding of what you are trying to prevent people from doing, I might be able to recommend the best approach. I've always been a fan of keeping authentication online and not doing these client side. Do you really care whether its a single machine? Or do you care about that it's being used by the same person?

For most software where licensing is a consideration I would strongly advise a server side approach.

You could take a combination of things in something like this :

Code
class HWID
    {
        Boolean IsServer { get; set; }
        String BIOS { get; set; }
        String CPU { get; set; }
        String HDD { get; set; }
        String GPU { get; set; }
        String MAC { get; set; }
        String HardwareID { get; set; }
        String OS { get; set; }
        String SCSI { get; set; }

        public HWID()
        {
            BIOS = GetWMIIdent("Win32_BIOS", "Manufacturer", "SMBIOSBIOSVersion", "IdentificationCode");
            CPU  = GetWMIIdent("Win32_Processor", "ProcessorId", "UniqueId", "Name");
            HDD  = GetWMIIdent("Win32_DiskDrive", "Model", "TotalHeads");
            GPU  = GetWMIIdent("Win32_VideoController", "DriverVersion", "Name");
            MAC  = GetWMIIdent("Win32_NetworkAdapterConfiguration", "MACAddress");
            OS   = GetWMIIdent("Win32_OperatingSystem", "SerialNumber", "Name");
            SCSI = GetWMIIdent("Win32_SCSIController", "DeviceID", "Name");

            // checking if system is a server. scsi indicates a server system
            IsServer = HDD.Contains("SCSI");

            HardwareID = Build();
        }

        private String Build()
        {
            var tmp = String.Concat(BIOS, CPU, HDD, GPU, MAC, SCSI);

            if (tmp == null)
                Console.WriteLine("Could not resolve hardware informations...");

            return Convert.ToBase64String(new System.Security.Cryptography.SHA1CryptoServiceProvider().ComputeHash(Encoding.Default.GetBytes(tmp)));
        }

        private Boolean IsWinServer()
            => OS.Contains("Microsoft Windows Server");

        [DllImport("user32.dll")]
        internal static extern bool OpenClipboard(IntPtr hWndNewOwner);

        [DllImport("user32.dll")]
        internal static extern bool CloseClipboard();

        [DllImport("user32.dll")]
        internal static extern bool SetClipboardData(uint uFormat, IntPtr data);

        // Ghetto SetClipboard function using imports
        public void Copy()
        {
            OpenClipboard(IntPtr.Zero);
            var ptr = Marshal.StringToHGlobalUni(HardwareID == null ? Build() : HardwareID);
            SetClipboardData(13, ptr);
            CloseClipboard();
            Marshal.FreeHGlobal(ptr);
        }

        public override String ToString()
            => String.Format("BIOS\t\t - \t{0}\nCPU\t\t - \t{1}\nGPU\t\t - \t{2}\nMAC\t\t - \t{3}\nOS\t\t - \t{4}\n" + (IsServer ? "SCSI\t\t - \t{5}\n" : "") + "\nGenerated Hardware ID:\n{6}\n", BIOS, CPU, GPU, MAC, OS, SCSI, HardwareID);

        private static String GetWMIIdent(String Class, String Property)
        {
            var ident = "";
            var objCol = new ManagementClass(Class).GetInstances();
            foreach(var obj in objCol)
            {
                if((ident = obj.GetPropertyValue(Property) as String) != "")
                    break;
            }
            return ident;
        }

        private static String GetWMIIdent(String Class, params String[] Propertys)
        {
            var ident = "";
            Array.ForEach(Propertys, prop => ident += GetWMIIdent(Class, prop) + " ");
            return ident;
        }

        public static String Get()
            => new HWID().HardwareID;
    }

Or something as simple as a registry value.
(Apr 25, 2020 08:33 AM)Shadow_Cloud Wrote:  If I have a better understanding of what you are trying to prevent people from doing, I might be able to recommend the best approach.   I've always been a fan of keeping authentication online and not doing these client side.  Do you really care whether its a single machine?  Or do you care about that it's being used by the same person?

For most software where licensing is a consideration I would strongly advise a server side approach.  

You could take a combination of things in something like this :

Code
class HWID
   {
       Boolean IsServer { get; set; }
       String BIOS { get; set; }
       String CPU { get; set; }
       String HDD { get; set; }
       String GPU { get; set; }
       String MAC { get; set; }
       String HardwareID { get; set; }
       String OS { get; set; }
       String SCSI { get; set; }

       public HWID()
       {
           BIOS = GetWMIIdent("Win32_BIOS", "Manufacturer", "SMBIOSBIOSVersion", "IdentificationCode");
           CPU  = GetWMIIdent("Win32_Processor", "ProcessorId", "UniqueId", "Name");
           HDD  = GetWMIIdent("Win32_DiskDrive", "Model", "TotalHeads");
           GPU  = GetWMIIdent("Win32_VideoController", "DriverVersion", "Name");
           MAC  = GetWMIIdent("Win32_NetworkAdapterConfiguration", "MACAddress");
           OS   = GetWMIIdent("Win32_OperatingSystem", "SerialNumber", "Name");
           SCSI = GetWMIIdent("Win32_SCSIController", "DeviceID", "Name");

           // checking if system is a server. scsi indicates a server system
           IsServer = HDD.Contains("SCSI");

           HardwareID = Build();
       }

       private String Build()
       {
           var tmp = String.Concat(BIOS, CPU, HDD, GPU, MAC, SCSI);

           if (tmp == null)
               Console.WriteLine("Could not resolve hardware informations...");

           return Convert.ToBase64String(new System.Security.Cryptography.SHA1CryptoServiceProvider().ComputeHash(Encoding.Default.GetBytes(tmp)));
       }

       private Boolean IsWinServer()
           => OS.Contains("Microsoft Windows Server");

       [DllImport("user32.dll")]
       internal static extern bool OpenClipboard(IntPtr hWndNewOwner);

       [DllImport("user32.dll")]
       internal static extern bool CloseClipboard();

       [DllImport("user32.dll")]
       internal static extern bool SetClipboardData(uint uFormat, IntPtr data);

       // Ghetto SetClipboard function using imports
       public void Copy()
       {
           OpenClipboard(IntPtr.Zero);
           var ptr = Marshal.StringToHGlobalUni(HardwareID == null ? Build() : HardwareID);
           SetClipboardData(13, ptr);
           CloseClipboard();
           Marshal.FreeHGlobal(ptr);
       }

       public override String ToString()
           => String.Format("BIOS\t\t - \t{0}\nCPU\t\t - \t{1}\nGPU\t\t - \t{2}\nMAC\t\t - \t{3}\nOS\t\t - \t{4}\n" + (IsServer ? "SCSI\t\t - \t{5}\n" : "") + "\nGenerated Hardware ID:\n{6}\n", BIOS, CPU, GPU, MAC, OS, SCSI, HardwareID);

       private static String GetWMIIdent(String Class, String Property)
       {
           var ident = "";
           var objCol = new ManagementClass(Class).GetInstances();
           foreach(var obj in objCol)
           {
               if((ident = obj.GetPropertyValue(Property) as String) != "")
                   break;
           }
           return ident;
       }

       private static String GetWMIIdent(String Class, params String[] Propertys)
       {
           var ident = "";
           Array.ForEach(Propertys, prop => ident += GetWMIIdent(Class, prop) + " ");
           return ident;
       }

       public static String Get()
           => new HWID().HardwareID;
   }

Or something as simple as a registry value.

i would like to have a php system checking hwid and others..
(Apr 25, 2020 08:59 AM)notahackerman Wrote:  i would like to have a php system checking hwid and others..

So I presume you want send these hwids from the clients to the server and in your case that would be php. This tells me nothing about the behaviour you are after.
(Apr 25, 2020 09:01 AM)Shadow_Cloud Wrote:  So I presume you want send these hwids from the clients to the server and in your case that would be php.  This tells me nothing about the behaviour you are after.

what you didn't understood?
(Apr 25, 2020 10:03 AM)notahackerman Wrote:  what you didn't understood?

What is it you want to achieve with HWID?
(Apr 25, 2020 10:11 AM)Shadow_Cloud Wrote:  What is it you want to achieve with HWID?

i have a builder, i want to have php check for hwid.
the customer should have hwid registered already in my database to use the builder to compile the source

that's all wtf..

i need the c# part and php part, it should be unbreakable, i mean non-crackable..
(Apr 25, 2020 10:17 AM)notahackerman Wrote:  i have a builder, i want to have php check for hwid.
the customer should have hwid registered already in my database to use the builder to compile the source

that's all wtf..

i need the c# part and php part, it should be unbreakable, i mean non-crackable..

So what prevents one customer from registering his HWID and having that spoofed on the request for everyone else?

All you'd need to do is set your connection to route via a proxy, intercept all request for service and swap out the HWID for the one he registered. But I'm sure you have considered this already correct?
HWID System is useless with .NET ...
Unless you crypt or obfuscate your files any noob can edit out the check and everything is useless.
(Apr 26, 2020 11:43 PM)ucsandaasu Wrote:  HWID System is useless with .NET ...
Unless you crypt or obfuscate your files any noob can edit out the check and everything is useless.

Its not completely useless, that's a bit of a leap. But for the use case here, yeah definitely not what you want to do.

I've seen multiple API's that require the HWID as part of the authentication. HTTP headers are way easier to spoof than colliding on the same HWID, when used as part of authentication this definitely makes sense to me. But relying on this as a lock mechanism... Not so much.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by 3 X P L 0 I TFeb 20, 2020 07:29 PM 18 3,274 Feb 20, 2020 07:29 PM
Last Post: Deadfreak99
[Python] by sqrewyAug 16, 2019 05:19 AM 0 254 Aug 16, 2019 05:19 AM
Last Post: sqrewy
[.NET] by TurboFastAug 25, 2017 06:26 PM 8 370 Aug 25, 2017 06:26 PM
Last Post: Ninja