1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| Private Sub teste(ByVal password As String, ByVal intMax As Integer)
If intMax = 0 Then
String.IsNullOrEmpty(password)
Else
For i As Integer = 1 To intMax
Dim SB As New StringBuilder(i)
Dim thisChar As Char = allChars(0)
For j As Integer = 1 To i
SB.Append(thisChar)
Next
Attackteste(password, 0, SB, i)
Next
End If
End Sub
Private Function Attackteste(ByVal password As String, ByVal position As Integer, ByVal SB As StringBuilder, ByVal Length As Integer) As Integer
For i As Integer = 0 To allChars.Length - 1
SB.Replace(SB(position), allChars(i), position, 1)
If position >= Length - 1 Then
password = SB.ToString
If password = TextBox1.Text Then ' ex : abc
TextBox3.Text = password ' afficher le résulta abc
Exit For
Else
TextBox2.Text = password ' aa,ab,ac,aaa,aab,aac...etc 1 à 5
TextBox2.Refresh()
End If
Else
AttackBruteForce(password, position + 1, SB, Length)
End If
Next
Return position
End Function |
Partager