HWDI Login

by Estivan - 01-13-2018 - 02:34 AM
Posts:
4

Reputation:
0

Credits:

Rookie User
Posts:
4

Threads:
2

Joined:
Jan 2018

Likes:
1

Credits:

Reputation:
0

Warning Level:

#1
OP
Posted: 01-13-2018 - 02:34 AM
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;
       }

Posts:
18

Reputation:
0

Credits:

Rookie User
Posts:
18

Threads:
0

Joined:
Jan 2018

Likes:
1

Credits:

Reputation:
0

Warning Level:

#2
Posted: 01-16-2018 - 01:13 AM
Do not trust WMI for information gathering.
Posts:
4

Reputation:
0

Credits:

Rookie User
Posts:
4

Threads:
2

Joined:
Jan 2018

Likes:
1

Credits:

Reputation:
0

Warning Level:

#3
OP
Posted: 01-16-2018 - 04:45 AM
(01-16-2018 - 01: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.
Posts:
600

Reputation:
18

Credits:

Candy CaneCredit WhoreYouTubeKnightGoldReferrerDiamond
Staff Management
Staff
Posts:
600

Threads:
42

Joined:
Nov 2015

Likes:
117

Credits:

Reputation:
18

Warning Level:

Staff
2 Years Of Service
Candy CaneCredit WhoreYouTubeKnightGoldReferrerDiamond
#4
Posted: 01-16-2018 - 06:14 AM
Nice share man <3



Are you a guest to this site? Click the image below and sign up today!
[Image: kv2SnH.gif]

Posts:
4

Reputation:
0

Credits:

Rookie User
Posts:
4

Threads:
2

Joined:
Jan 2018

Likes:
1

Credits:

Reputation:
0

Warning Level:

#5
OP
Posted: 01-16-2018 - 09:44 AM
(01-16-2018 - 06:14 AM)CaptainModz Wrote: Nice share man <3

Thanks, man! <3




USERS BROWSING THIS THREAD:  1 Guest(s)
"Join for the content, stay for the community."
© All Rights Reserved DemonForums.
© 2015-2017 / DemonForums
Server time: 01-19-2018, 01:05 AM (817 Days Online)