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!
🎉
niz one!!
i once used da system.management to mke a Sys. info viewer(still usng :DD)
the only thing is to filter the RUBBISH ging out from it :DD
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.
Also you can use
http://www.Spam.com
http://www.fileave.com

Sometimes SPAM, their downtime is shitloads
The one Vuz3 posted is also nice. I used it for a couple apps.
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!!
Great man nice tut ^.^
Hey man great tut, only one thing I can't seem to get to work. Whenever I paste in the VB code it always says

Type 'ManagementClass' is not defined
Type 'ManagementObjectCollection' is not defined
Type 'ManagementObject' is not defined

Any help would be appreciated.
"make sure you have add reference to System.Management.dll"
put imports system.management at the top of your code

and even add a reference to system.management object
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 =.=
(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


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,259 Dec 30, 2014 11:59 AM
Last Post: +Haze