Function GenerateRandomString(ByVal LongueurPasse As Integer) As String ' Dico Dim allowableChars As String allowableChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789#$%&'()*+,-./:;<=>?@[\]^_`{|}~" ' Initialisations GenerateRandomString = "" Dim max As Integer = allowableChars.Length Dim NbAleatoire As Integer Dim rnd As System.Random = New System.Random Dim t As Integer ' Boucle de formation du passe For t = 1 To LongueurPasse NbAleatoire = rnd.Next(0, max) GenerateRandomString = GenerateRandomString & allowableChars.Substring(NbAleatoire, 1) Next End Function
Et on n'a toujours pas vu où et comment, dans son code, il teste la validité d'un mot de passe.
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionDo Until GenerateRandomString(8) = "A12B3C4D" Loop
Bon, là, Zorro... c'est vrai que tu devrais apprendre les bases avant... sinon, tu n'iras pas loin comme ça.
Private Function BruteForce(ByVal vnLongMin As Integer, ByVal vnLongMax As Integer) As String() Dim Caractères() As Char = New String("ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz1234567890<>,?;.:/!§*µù%$£¤¨+=})]à@ç^\\_`è|-[({'#""é~&").ToCharArray() Dim Lg As Integer = vnLongMin - 1 Dim y As Integer Dim xsRet As Stack(Of String) = New Stack(Of String) Erase BruteForce For Lg = vnLongMin - 1 To vnLongMax - 1 Dim Buff() As Char = New String("A", Lg + 1).ToCharArray Dim nChar(Lg) As Integer Do For Each c As Char In Caractères Buff(Lg) = c xsRet.Push(New String(Buff)) Next c For y = Lg - 1 To 0 Step -1 nChar(y) += 1 If nChar(y) > Caractères.GetUpperBound(0) Then nChar(y) = 0 Buff(y) = Caractères(0) If y = 0 Then Exit Do End If Else Buff(y) = Caractères(nChar(y)) Exit For End If Next y Loop Next Lg ReDim BruteForce(xsRet.Count - 1) xsRet.CopyTo(BruteForce, 0) End Function