首先,我要说清楚,我不是" PRO"在visual basic,c#都没有。但是我脑子里有几天这个问题。
"是否可以在表单加载之前验证HWID?它是如何工作的?"
由于我正在为本地健身房创建一个软件,我想实现一些安全性,而不仅仅是一个基本的登录表单"。所以,它让我想到了这个问题......我如何创建一种简单的方法来从CPU获取HWID并从纯文本中验证(如果该列表中有相同的值,则可以使用md5哈希编写)? 我正在寻找关于如何实现它以及如何在VB.NET和C#上实现它的一些解释。
Private Sub frmprincipal_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim janela As New frmLogin
janela.MdiParent = Me
janela.Show()
Label4.Text = "Faça login!"
tmrRelogio.Enabled = True
bttLogout.Enabled = False
bttLogout.Visible = False
Dim hwid 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 hwid = "" Then
hwid = mo.Properties("processorID").Value.ToString()
Exit For
End If
Next
Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("https://www.dropbox.com/s/zewro4zubg9qc1s/HWID.txt")
Dim response As System.Net.HttpWebResponse = request.GetResponse()
Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())
Dim hwidcheck As String = sr.ReadToEnd
If hwidcheck.Contains(hwid) Then
MsgBox("This is the original copy!", "INFORTGEI", MessageBoxButtons.OK)
If DialogResult.OK = True Then
Close()
End If
Else
MsgBox("Contact the admin to activate the copy!", MessageBoxButtons.OK, "INFORTGEI")
End If
End Sub
有任何建议吗?
提前致谢。
答案 0 :(得分:0)
我找到了解决问题的方法。 这是我做的代码:
Dim hwid 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 hwid = "" Then
hwid = mo.Properties("processorID").Value.ToString()
Exit For
End If
Next
Dim hash As List(Of String) = New List(Of String)(System.IO.File.ReadAllLines("..\HWID.txt"))
If Not hash.Contains(hwid) Then
MsgBox("Contact administrator to activate the hardware on the database.", MessageBoxButtons.OK, "INFORTGEI")
If DialogResult.OK = True Then
Close()
End If
Else
MsgBox("Activated sucessfully!", MessageBoxButtons.OK, "INFORTGEI")
End If