Skip to content

Commit

Permalink
Add tests for escaped characters and weak password patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
Buba98 committed Dec 19, 2024
1 parent 0ab6618 commit 9543b43
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/test_escape_char.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,19 @@ def test_escaped_characters_inside_character_class():
possibilities = ['[', ']']

f_finite(regexEnumerator, possibilities)


def test_escaped_char_interrups_range_after_divider():
regexEnumerator = RegexEnumerator(r'[a-\d]')
possibilities = ['a', '-', '0', '1', '2',
'3', '4', '5', '6', '7', '8', '9']

f_finite(regexEnumerator, possibilities)


def test_escaped_char_interrups_range_after_1st_char():

regexEnumerator = RegexEnumerator(r'[\[\d]')
possibilities = ['[', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']

f_finite(regexEnumerator, possibilities)
23 changes: 23 additions & 0 deletions tests/test_mixed.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,26 @@ def test_done():
possibilities = ['', None]

f_finite(regexEnumerator, possibilities)

def test_weak_password():
regexEnumerator = RegexEnumerator(r'[Ll][Oo0][Vv][Ee3]([Yy][Oo0][Uu])?(2023|2024)[!1.]{1,2}')
possibilities = []

you_or_not = []
for y in 'Yy':
for o in 'Oo0':
for u in 'Uu':
you_or_not.append(y + o + u)
you_or_not.append('')

for l in 'Ll':
for o in 'Oo0':
for v in 'Vv':
for e in 'Ee3':
for y in you_or_not:
for year in ['2023', '2024']:
for special_1 in ['!', '1', '.']:
for special_2 in ['!', '1', '.', '']:
possibilities.append(l + o + v + e + y + year + special_1 + special_2)

f_finite(regexEnumerator, possibilities)

0 comments on commit 9543b43

Please sign in to comment.