예제 #1
0
    def test_generate_44_max_domain(self):
        for n in range(44, 45):
            pg = PasswordGenerator(length=n,
                                   numbers=True,
                                   symbols=True,
                                   lowercase=True,
                                   uppercase=True)
            p = pg.generate()

            # validate length
            self.assertEqual(n, len(p))
예제 #2
0
 def test_validate_4_nlus(self):
     pg = PasswordGenerator(length=4,
                            numbers=True,
                            lowercase=True,
                            uppercase=True,
                            symbols=True)
     p = pg.generate()
     # print(p)
     helper = PasswordHelper()
     self.assertTrue(
         helper.validate(password=p,
                         numbers=True,
                         lowercase=True,
                         uppercase=True,
                         symbols=True))
예제 #3
0
    def test_generate_1_to_1000_max_domain(self):
        for n in range(1, 1001):
            pg = PasswordGenerator(length=n,
                                   numbers=True,
                                   symbols=True,
                                   lowercase=True,
                                   uppercase=True)
            p = pg.generate()

            # validate length
            self.assertEqual(n, len(p))

            # validate complexity
            for c in p:
                self.assertTrue(c in pg.getActiveDomain())
예제 #4
0
파일: test.py 프로젝트: mvanorder/pwdpy
 def test_generate_domain_analysis(self):
     pwl = 10
     pg = PasswordGenerator(length=pwl,
                            numbers=True,
                            symbols=True,
                            lowercase=True,
                            uppercase=True)
     p = pg.generate()
     n, l, u, s = 0, 0, 0, 0
     for c in p:
         if c in pg.NUMBERS:
             n += 1
         if c in pg.LOWER_CASE:
             l += 1
         if c in pg.UPPER_CASE:
             u += 1
         if c in pg.SYMBOLS:
             s += 1
     diff = numpy.subtract((n, l, u, s),
                           (pwl / 4, pwl / 4, pwl / 4, pwl / 4))
     for x in diff:
         self.assertTrue(abs(x) < 2)
예제 #5
0
 def test_generate_default_blank(self):
     pg = PasswordGenerator()
     self.assertEqual(len(pg.generate()), 0)
예제 #6
0
 def test_generate_5_max_domain(self):
     pg = PasswordGenerator(length=5)
     p = pg.generate()
     self.assertEqual(len(p), 5)
예제 #7
0
 def test_generate_1_lowercase(self):
     pg = PasswordGenerator(length=1, lowercase=True)
     p = pg.generate()
     self.assertTrue(p in pg.LOWER_CASE)
예제 #8
0
 def test_generate_1_symbol(self):
     pg = PasswordGenerator(length=1, symbols=True)
     p = pg.generate()
     self.assertTrue(p in pg.SYMBOLS)
예제 #9
0
 def test_generate_1_number(self):
     pg = PasswordGenerator(length=1, numbers=True)
     p = pg.generate()
     self.assertTrue(p in pg.NUMBERS)
예제 #10
0
 def test_generate_1_defaults(self):
     pg = PasswordGenerator(length=1)
     self.assertEqual(len(pg.generate()), 1)
예제 #11
0
 def test_get_domain_group_count(self):
     pg = PasswordGenerator(length=1)
     dgc = pg.getDomainGroupCount()
     self.assertEqual(dgc, 4)
예제 #12
0
 def test_generate_1_uppercase(self):
     pg = PasswordGenerator(length=1, uppercase=True)
     p = pg.generate()
     self.assertTrue(p in pg.UPPER_CASE)
예제 #13
0
# Generate output to measure time spent on processing
from datetime import datetime
import time
from pwdpy import PasswordGenerator

start = time.time()

pgen4 = PasswordGenerator(
    length=1,
    symbols=False,
    numbers=True,
    uppercase=False,
    lowercase=False)

password = pgen4.generate()
#print(len(pgen4.NUMBERS+pgen4.LOWER_CASE+pgen4.UPPER_CASE+pgen4.SYMBOLS))
#print(pgen4.NUMBERS+pgen4.LOWER_CASE+pgen4.UPPER_CASE+pgen4.SYMBOLS)

print("password: "******""
found = False

print(pgen4.getStrength())

exit()

while found == False:
    # Max base is 92, the len of 5479231608oyjbwsqzimtalrfnvudgcxphkePGWUCZNXEOKVJYHAQMIDLTSFRB'?[^)&|:{/%@!`$}=,+;(]_\-#*."~
    for j in pgen4.getMaxDomain():
        if password == guess + j: