Private Sub Mainframe_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim procs() As System.Diagnostics.Process = System.Diagnostics.Process.GetProcesses
Dim f As String
For Each proc As System.Diagnostics.Process In procs
f = GetProcessFileName(proc)
If f.Length > 0 Then
ListBox1.Items.Add(f)
ListBox1.Items.Add("MD5: " & GetMD5String(f))
ListBox1.Items.Add(String.Empty)
End If
Next
End Sub
Private Function GetProcessFileName(proc As System.Diagnostics.Process) As String
Dim strRet As String = String.Empty
Try
strRet = proc.MainModule.FileName
Catch ex As Exception
' This catch used to ignore "Access is denied" exception.
End Try
Return strRet
End Function
Private Function GetMD5String(ByVal strFilename As String) As String
Dim cMD5 = System.Security.Cryptography.MD5.Create
Dim bytHash As Byte()
Dim sb As New System.Text.StringBuilder
Dim scanbox As New TextBox
scanbox.Text = My.Computer.FileSystem.ReadAllText("viruslist.txt").ToString
Using cStream As New IO.FileStream(strFilename, IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.Read)
bytHash = cMD5.ComputeHash(cStream)
End Using
For Each B In bytHash
sb.Append(B.ToString("X2"))
Next
If scanbox.Text.Contains(sb.ToString) Then
Detect.Show()
End If
Return sb.ToString
End Function
"Doubt is a pain too lonely to know that faith is his twin brother."