ALERT!
Click here to register with a few steps and explore all our cool stuff we have to offer!
Home
Upgrade
Credits
Help
Search
Awards
Achievements
 8081

HWID Login

by Estivan - 01-13-2018 - 04:34 AM
#1
Hi, this is just something someone wanted me to make for them a while back, I want to contribute to the community so I decided to share this.

Note: I got some of the code from online, but I can't remember where I got it from, but, credits to whoever wrote it.

Oh, btw, remember to import System.Management (using System.Management;)

 
Code:
public string GetHDDSerial() // Public string that contains the variable of the hardware id string from URL.txt
       {
           ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia");
           foreach (ManagementObject wmi_HD in searcher.Get())
           {
               if (wmi_HD["SerialNumber"] != null)
                   return wmi_HD["SerialNumber"].ToString();
           }

           return string.Empty;
       }

     
       private void lgnhwid_Click(object sender, EventArgs e)
       {

           System.Net.WebClient Wc = new System.Net.WebClient();
           string pplbanned = Wc.DownloadString("Web URL"); // Banned Hardware ID's from server
           string pplallowed = Wc.DownloadString("Web URL"); // Whitelisted Hardware ID's from server

           if (pplbanned.Contains(GetHDDSerial())) // this if statement checks if the System Hardware ID matches with the string from the server
           {
               MessageBox.Show("You have been banned from '[name]'!", Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
               Environment.Exit(-1);
           }
           else if (pplallowed.Contains(GetHDDSerial()))
           {
               MessageBox.Show("You're allowed to use '[name]', Welcome.", Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
               HWDI_Login frm = new HWDI_Login();
               frm.Show();
               this.Hide();
           }
           else
           {
               MessageBox.Show("You're not whitelisted, make sure you sent Your" +
                   " Hwid to [name] and you bought our [product].", Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
               Environment.Exit(-1);
           }
           
       }

       private void HWDI_Login_Load(object sender, EventArgs e)
       {
           var mbs = new ManagementObjectSearcher("Select ProcessorId From Win32_processor");  // Get System Hardware id
           ManagementObjectCollection mbsList = mbs.Get();
           string id = "";
           foreach (ManagementObject mo in mbsList)
           {
               id = mo["ProcessorId"].ToString();
               break;
           }

           System_HWDI.Text = "System Hardware ID: " + id;
       }
Reply
#2
Do not trust WMI for information gathering.
Reply
#3
(01-16-2018 - 03:13 AM)zwcdxhdy Wrote: Do not trust WMI for information gathering.

Now, why is that? Dude, if you are one of those who doesn't trust windows libraries to gather or do things for you, remember windows itself is (maybe) on your computer.
Reply
#4
Nice share man <3
[Image: giphy.gif]
Reply
#5
(01-16-2018 - 08:14 AM)CaptainModz Wrote: Nice share man <3

Thanks, man! <3
Reply
#6
This is some nice code, my dude. Good job.
Reply
#7
Thank you!  Cheese
Reply
#8
Not the most secure but thanks :)
Btw instead of having to type " System.Net.WebClient Wc = new System.Net.WebClient();"
Just import it
:pepe:
Reply
#9
What is the point of this if you do the checking client side? I would be smarter to take the HWID and send it to your server where you check against a db, if the user is valid then the server responds else no response. Simple stuff :/
Reply
#10
(01-16-2018 - 06:45 AM)Estivan Wrote:
(01-16-2018 - 03:13 AM)zwcdxhdy Wrote: Do not trust WMI for information gathering.

Now, why is that? Dude, if you are one of those who doesn't trust windows libraries to gather or do things for you, remember windows itself is (maybe) on your computer.

Because of things like this: https://github.com/ccman32/WMISpoofer
Reply

Users browsing: 4 Guest(s)