How to make a application to test Passord Strength,كيف تصنع برنامج فحص قوة الباسوورد

بسم الله آلرحمن آلرحيم 


 آلسلام عليكُم ورحمةُ آلله وبركآتهُ

وَهُو [ شَرح برنَآمج كشِف قُوة آلبآسووردآت بطرِيقة مُتطوِر ] !


آلشَرِح :





آلآكوآد ، كُود آلتِكستْ :
كود Visual Basic
?
1
Label1.Caption = PWMeter(Text2.Text)


كُود آلمُودل :
كود Visual Basic
?
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
' Coder name : Mouhammed ajel
' Company name : Dev-PoinT
' Gr33tz to : All my friends
 
Public Function PWMeter(pw As String) As String
Dim score As Integer
 
 
score = score + Len(pw) * 4
score = score - chkRepetition(1, pw) '(1 char repetition)
score = score - chkRepetition(2, pw) '(2 char repetition)
score = score - chkRepetition(3, pw) '(3 char repetition)
score = score - chkRepetition(4, pw) '(4 char repetition)
 
 
Dim IsNumber As Boolean
Dim IsChar As Boolean
Dim IsUpper As Boolean
Dim IsLower As Boolean
Dim IsSymbol As Boolean
 
Dim CountNumber As Long
Dim CountChar As Long
Dim CountUpper As Long
Dim CountLower As Long
Dim CountSymbol As Long
 
CountNumber = 0
CountChar = 0
CountUpper = 0
CountLower = 0
CountSymbol = 0
 
For i = 1 To Len(pw)
    IsNumber = False
    IsChar = False
    IsUpper = False
    IsSymbol = False
    IsLower = False
    IsSymbol = False
     
    If Asc(Mid$(pw, i, 1)) >= 48 And Asc(Mid$(pw, i, 1)) <= 57 Then
        IsNumber = True
        CountNumber = CountNumber + 1
    End If
    If Asc(Mid$(pw, i, 1)) >= 97 And Asc(Mid$(pw, i, 1)) <= 122 Then
        IsLower = True
        CountLower = CountLower + 1
    End If
    If Asc(Mid$(pw, i, 1)) >= 65 And Asc(Mid$(pw, i, 1)) <= 90 Then
        IsUpper = True
        CountUpper = CountUpper + 1
    End If
    If IsLower Or IsUpper Then
        IsChar = True
        CountChar = CountChar + 1
    End If
    If Not (IsNumber Or IsChar) Then
        IsSymbol = True
        CountSymbol = CountSymbol + 1
    End If
Next i
If CountNumber >= 3 Then score = score + 5
If CountSymbol >= 2 Then score = score + 5
If CountLower > 0 And CountUpper > 0 Then score = score + 10
If CountNumber > 0 And CountChar > 0 Then score = score + 15
If CountNumber > 0 And CountSymbol > 0 Then score = score + 15
If CountChar > 0 And CountSymbol > 0 Then score = score + 15
If Len(pw) = CountChar Then score = score - 10
If Len(pw) = CountNumber Then score = score - 10
 
If score > 100 Then score = 100
 
Select Case score
Case Is <= 20
    PWMeter = "Very Weak"
    Form1.Shape2.Width = ("135")
Case Is <= 40
    PWMeter = "Weak"
    Form1.Shape2.Width = ("1000")
Case Is <= 75
    PWMeter = "Good"
    Form1.Shape2.Width = ("1800")
Case Is <= 90
    PWMeter = "Strong"
    Form1.Shape2.Width = ("2400")
Case Is > 90
    PWMeter = "Very strong"
    Form1.Shape2.Width = ("3135")
End Select
End Function
 
Private Function chkRepetition(pLen As Long, str As String)
    x = 0
    Dim i As Long, j As Long
    For i = 1 To Len(str)
        For j = i + 1 To Len(str)
            If Mid$(str, i, pLen) = Mid$(str, j, pLen) Then
                x = x + 1
            End If
        Next j
    Next i
    chkRepetition = x
End Function

لتَحمِِيل آلسُورس كُود :
[ منْ مَركز رفع دِيف بوِينتْ ]


تمّ آلشرح ولله آلحمدُ و آلشكر ، آن شآء الله مآكُون وفقت بشِي
في آمآن الله وحفظِه

ليست هناك تعليقات