HWID Protect Your Programs

Discussion in 'Programming' started by poblo10, Mar 1, 2010.

  1. #1
    HWID Protection
    So this is for all you VB coders out there that make programs to sell.
    Now this is one way of preventing people of sharing your program and leaking it through out the web. People can loose $100's even $1000's due to leaking.
    So anyways heres my TUT In 2 parts
    1. Making Application To Grab HWID
    So first off start up VB 2008 and make a new Windows Application.
    And make the following
    • 1 Button
    • 1 Text Box
    And before we get into the source .etc
    Above the public class section add the following
    Imports System.Management
    Code (markup):
    Now double click button1 and add the following
    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
    
        End Sub
    Code (markup):
    Ok then when you debug and click button 1 your HWID will show up in textbox1
    Now you would send this application to the user that bought your "HWID enabled application" and they would send you there HWID.
    Now that you have there HWID you need to make it so when they run your program they can access it.
    So just make a text file called database.txt
    and just add there HWID there and just press enter after ever HWID
    Then just upload datebase.txt to your website or a freesite (ripway works best if you dont have a site of your own)
    And if they violate your program terms of use you can just remove there HWID from the text file and they will no longer be able to use.


    2. Now to add the code to your program
    First add the following
    Imports System.Net
    Imports System.Management
    Code (markup):
    On to the rest
    Now we are going to call your program Form1 for the purpose of this tut.
    So double click Form1 and add the following.
    
    Public Class Form1
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
            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
    
            Dim HWID As String
    
            HWID = cpuInfo
            Dim wc As New WebClient
            Dim strings As String
            strings = wc.DownloadString("http://h1.ripway.com/vorfin12345/Database.txt")
            wc.Dispose()
    
            If strings.Contains(HWID) Then
                MessageBox.Show("HWID Matches!", "Open!", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Else
                MessageBox.Show("Error, HWID Does Not Match!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error)
                Me.Close()
            End If
        End Sub
    
    Code (markup):
    So now if you have HWID enabled on your program when the user runs it, before it starts it checks that database.txt to see if they are allowed to use that program.

    If you have any questions feel free to PM me
    -----------------------------------------------------------------------------------------------
    Originality Posted At
    http://f47al3rr0r.net/forum/
    &
    http://www.techforumz.net/forum/
     
    poblo10, Mar 1, 2010 IP