Imports System
Imports System.IO
Imports System.Text
Imports System.Security
Imports System.Security.Cryptography
Public Class frmMain
Public Function MD5(ByVal Word) As String
Dim Bytes() As Byte = ASCIIEncoding.ASCII.GetBytes(Word)
Dim md5h As New MD5CryptoServiceProvider
Dim Byt() As Byte = md5h.ComputeHash(Bytes)
Dim i As Integer = (Byt.Length * 2 + (Byt.Length / 8))
Dim StrBuild As StringBuilder = New StringBuilder(i)
Dim i2 As Integer
For i2 = 0 To Byt.Length - 1
StrBuild.Append(BitConverter.ToString(Byt, i2, 1))
Next i2
Return StrBuild.ToString().TrimEnd(New Char() {" "c}).ToLower
End Function
Private Sub cmdload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdload.Click
Try
lstwords.Items.Clear()
OFD.ShowDialog()
Dim Sr As StreamReader = New StreamReader(OFD.FileName)
Dim Str As String = ""
While Not Sr.EndOfStream
Str = Sr.ReadLine
lstwords.Items.Add(Str)
End While
Catch ex As Exception
MessageBox.Show("Impossibile caricare il file!", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Sub cmdattack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdattack.Click
On Error Resume Next
Dim Stat As Boolean
Stat = False
If Len(txthash.Text) = 0 Or lstwords.Items.Count = 0 Then
MessageBox.Show("Inserire un hash da crakkare,o controllare che vi sia almeno un elemento nella lista!", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
Dim i As Integer
For i = 0 To lstwords.Items.Count
Dim Str As String
Str = lstwords.Items.Item(i)
If MD5(Str) = txthash.Text Then
MessageBox.Show("L'hash " & txthash.Text & " corrisponde alla parola " & lstwords.Items.Item(i), Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Information)
lblwordstat.Text = lstwords.Items.Item(i)
Stat = True
End If
Next i
If Stat = False Then
lblwordstat.Text = "Non trovata"
End If
MessageBox.Show("Attacco dizionario eseguito!", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End Sub
End Class