Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- from password_strength import PasswordPolicy
- from password_strength import PasswordStats
- #policy
- policy = PasswordPolicy.from_names(
- length=8, # min length: 8
- uppercase=2, # need min. 2 uppercase letters
- numbers=2, # need min. 2 digits
- special=2, # need min. 2 special characters
- nonletters=2,) # need min. 2 non-letter characters (digits, specials, anything)
- #Variables
- password = ""
- combinations="qwertyuiopasdfghjklzxcxvbnm1234567890QWERTYUIOPASDFGHJKLZXCVBNM!$%^&*"
- #pradzia
- print("Sveiki!")ivestisma = input("Kuria programa naudosite? 1. Sugeneruoti slaptazodi\n2. Patikrinti slaptazodzio sauguma\nIvestis: \n
- if ivestis == 1:
- generuoti()
- ):
- #funkci
- def generuot):ks
- global password
- global combinat
- i = input("Kokio ilgio slaptazodzio just noritežodis: ")
- #generuoja skaicius
- try:
- for x in range(int(i)):
- password += random.choice(combinations)
- except:
- print("Klaida!")
- print(password)
- #test
- stats = PasswordStats(password)
- saugumas = stats.strength()
- policy_saugumas = policy.test(password)
- if policy_saugumas != []:
- print("Slaptazodziui truksta: " + str(policy_saugumas))
- elif policy_saugumas == [] and float(saugumas) >= 0.3:
- print("Slaptazodis saugus!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement