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

.NET 

[TUT][VB.NET] Hardware ID Registration

Hi, so you want to learn how to make your application secure with hardware registration? 😉

Well, lets get started (My first tutorial, wish me good luck 👹)

1:
First get a website you can host two files on, like SPAM.com.

2:
This is a VB.net code, make sure you have add reference to System.Management.dll
Code
Imports System.Management
Imports System.Net

Public Class Form1
    Public cpuInfo As String = String.Empty
    Public hwid As String = cpuInfo
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim wr As New WebClient

        Dim mc As New ManagementClass("win32_processor")
        Dim moc As ManagementObjectCollection = mc.GetInstances()

        For Each mo As ManagementObject In moc
            If cpuInfo = "" Then
                cpuInfo = mo.Properties("processorID").Value.ToString()
                Exit For
            End If
        Next
        hwid = cpuInfo
        Dim url = wr.DownloadString("http://YOURWEBSITE.com/HID3.php?id=" & hwid)
        Dim parts = Split(url, "|", , CompareMethod.Text)

        If Not parts(0) = "OK" Then
            MsgBox("Bad HWID verification, application will close")
            Application.Exit()
        End If
        wr.Dispose()
    End Sub
End Class

Now you got a application to check if your hardware id is registered!

3:
Lets do some PHP programming.
PHP Code

<?php

if ($_GET['id'] != ''){
    
$puntero = fopen('HID3.txt', 'r');
    while(!
feof($puntero)){
        
$base = explode('|', fgets($puntero));
        if(
$base[0] == $_GET['id']){
            
fclose($puntero);
            
$checksum = 0;
            for (
$i=24; $i<35; $i++) {
                
$checksum += $_GET['id']{$i} * $i;
            }
            echo 
'OK|'.$base[1].'|'.$checksum;
            exit;
        }
    }
    
fclose($puntero);
    echo 
"<error>ERROR</error>";
}else{
    echo 
"<error>ERROR</error>";
}

?>

Create a new php-file and paste this in and save it as: HID3.php

4:
Create a textfile and paste this in:
Code
HWID|Member| Comment.
Save it as: HID3.txt and upload to your website.



If you want to add more hardware id's to textfile do this:
Code
HWID|Member| Comment.
HWID|Member| Comment.
HWID|Member| Comment.
Just add more lines below each other!

To get your hardware id, use this vb.net code
Code
Imports System.Management


        Dim cpuInfo As String = String.Empty
        Dim mc As New ManagementClass("win32_processor")
        Dim moc As ManagementObjectCollection = mc.GetInstances()

        For Each mo As ManagementObject In moc
            If cpuInfo = "" Then
                cpuInfo = mo.Properties("processorID").Value.ToString()
                Exit For
            End If
        Next

        TextBox1.Text = cpuInfo

Have fun!
🎉
This is epic :P good work and nice tut.
I forgot the PHP code in this tutorial, fixing
Code
<?php

if ($_GET['id'] != ''){
    $puntero = fopen('HID3.txt', 'r');
    while(!feof($puntero)){
        $base = explode('|', fgets($puntero));
        if($base[0] == $_GET['id']){
            fclose($puntero);
            $checksum = 0;
            for ($i=24; $i<35; $i++) {
                $checksum += $_GET['id'] * $i;
            }
            echo 'OK|'.$base[1].'|'.$checksum;
            exit;
        }
    }
    fclose($puntero);
    echo "<error>ER</error>";
}else{
    echo "<error>ER</error>";
}

?>
The HID3.php file.
if the site was having downtime would that effect the person using the program with hardware verification?
Yes it would.
But what you can do it compile own program for the user with Hardware ID in program as string encrypted or something.
And when user open the program it decrypt the string and check if the string is same as hardware ID.
Good Work, and Very Nice Tutorial!!
"make sure you have add reference to System.Management.dll"
(Jan 2, 2010 09:14 AM)Razz Tbh Wrote:  Thanks guys but I'm really new at this so how do I add a reference to System.Management.dll. Sorry if that's a noob question =.=
Project --> Add Reference --> .NET --> System.Management
Nice sharing.
+rep.
NP, any questions? Just ask ;)
very nice tutorial and good work man just keep doing your work
Finally something more advanced .. me likey ✌
Very good .. I got this baby working nice, this is really good tutorial ..
This is a very good tut well done man for this
Very good, thanks a lot but i have an error:
this is my php webpage:
http://quick05.ifrance.com/HID3.php

But it's say ER and the application say me "Bad Hwid..."
Why i get an error in my php file ?

Sorry for my bad english


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by +HazeAug 28, 2015 07:43 AM 52 5,851 Aug 28, 2015 07:43 AM
Last Post: Odus
[C#] by SIM-1947090Mar 28, 2015 10:01 AM 4 166 Mar 28, 2015 10:01 AM
Last Post: SIM-1947090
[.NET] by +HazeDec 30, 2014 11:59 AM 42 2,256 Dec 30, 2014 11:59 AM
Last Post: +Haze