Password Project
Password Project
Password Project
# Divide the password so that it is a password in one place and the number of
# times it was hacked in one place
def get_password_leaks_counter(hashes, hash_to_check):
hashes = (line.split(':') for line in hashes.text.splitlines())
for h, counter in hashes:
if h == hash_to_check:
return counter
return 0
def guess_password(your_password):
global guess
while guess != your_password:
guess = ""
# generating random passwords using for loop
for letter in range(len(your_password)):
guess_letter = characters[randint(0, 76)]
guess = str(guess_letter) + str(guess)
# print(guess)
# Calculate the number of attempts the hacker needs to hack the password and
# the time
def tryPassword(user_password, passwordSet):
start = dt.datetime.now()
attempts = 0
for passcode in product(ascii_letters + digits + punctuation,
repeat=len(user_password)):
letters = "".join(passcode)
attempts += 1
if letters == passwordSet:
end = dt.datetime.now()
distance = end - start
return attempts, distance