首先,我想说清楚,我不是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有什么建议吗?
提前谢谢。
发布于 2017-02-16 21:20:06
我已经找到了解决问题的方法。下面是我写的代码:
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 Ifhttps://stackoverflow.com/questions/42261495
复制相似问题