Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.IO, System.Management, System, System.Security.Cryptography, System.Text, System.Threading, System.Security.Permissions
- Public Class LoginForm
- Dim cpuInfo As String = String.Empty
- Dim mc As New ManagementClass("win32_processor")
- Dim moc As ManagementObjectCollection = mc.GetInstances()
- Dim WC As New Net.WebClient()
- #Region "Useful Variables"
- Dim INFO_WEBPAGE As String = "http://bennyclient.x10.mx/info/info.php"
- Dim MY_USERNAME As String
- Dim MY_PASSWORD As String
- Dim MY_HWID As String
- #End Region
- Public Function ENCRYPT(ByVal input As String, ByVal pass As String) As String
- Dim AES As New System.Security.Cryptography.RijndaelManaged
- Dim Hash_AES As New System.Security.Cryptography.MD5CryptoServiceProvider
- Dim encrypted As String = ""
- Dim hash(31) As Byte
- Dim temp As Byte() = Hash_AES.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(pass))
- Array.Copy(temp, 0, hash, 0, 16)
- Array.Copy(temp, 0, hash, 15, 16)
- AES.Key = hash
- AES.Mode = Security.Cryptography.CipherMode.ECB
- Dim DESEncrypter As System.Security.Cryptography.ICryptoTransform = AES.CreateEncryptor
- Dim Buffer As Byte() = System.Text.ASCIIEncoding.ASCII.GetBytes(input)
- encrypted = Convert.ToBase64String(DESEncrypter.TransformFinalBlock(Buffer, 0, Buffer.Length))
- Return encrypted
- End Function
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- Dim cpuInfos As String
- For Each mo As ManagementObject In moc
- If cpuInfo = "" Then
- cpuInfo = mo.Properties("processorID").Value.ToString()
- cpuInfos = mo.Properties("processorID").Value.GetHashCode().ToString()
- Exit For
- End If
- Next
- Dim HWID As String
- HWID = cpuInfo
- Dim Os As OperatingSystem = Environment.OSVersion
- Dim Major = Os.Version.Major
- Dim Minor = Os.Version.Minor
- Dim Build = Os.Version.Build
- Dim Revis = Os.Version.Revision
- Dim NameLength = Environment.MachineName.Length.ToString()
- Dim Count = Environment.ProcessorCount.ToString()
- Dim CmdLind = Environment.CommandLine.Length.ToString()
- Dim Id = Net.Dns.GetHostEntry(Net.Dns.GetHostName).AddressList(0).ToString()
- Dim CustomHWID As String = Major.ToString() + (Build.ToString() * 600) * Revis.ToString() + NameLength + Count * Id.Length * HWID.Length.ToString() * 771 * 91 * 25 * 11
- Dim FinalHWID As String = CustomHWID * 777
- Dim WebString As String = WC.DownloadString(INFO_WEBPAGE)
- MY_USERNAME = ENCRYPT(TextBox1.Text, 25).ToString()
- MY_PASSWORD = ENCRYPT(TextBox2.Text, 25).ToString()
- MY_HWID = ENCRYPT(FinalHWID, 25).ToString()
- If WebString.Contains(Path.Combine(MY_USERNAME & "%%" & MY_PASSWORD & "%%" & MY_HWID)) Then
- Me.Hide()
- MainForm.Show()
- MessageBox.Show("Welcome " & TextBox1.Text & "!")
- Else
- MessageBox.Show("Wrong login. The client will now exit.")
- Application.Exit()
- End If
- End Sub
- Private Sub MainForm_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
- Application.Exit()
- End Sub
- Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, _
- ByVal keyData As System.Windows.Forms.Keys) _
- As Boolean
- If msg.WParam.ToInt32() = CInt(Keys.Enter) Then
- Button1.PerformClick()
- Return True
- End If
- Return MyBase.ProcessCmdKey(msg, keyData)
- End Function
- Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click
- End Sub
- Private Sub LoginForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement